/* Misty-Land - Memory feature styles extracted from style.css */
/* ============================================================
   === MEMORY PAGE ============================================
   ============================================================ */

/* Page wrapper */
.mem-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(76px - var(--space-lg) * 0.65);
  padding-bottom: 20px;
  box-sizing: border-box;
}
.mem-page-loading {
  padding-top: 90px;
  text-align: center;
  color: rgba(42,31,18,0.45);
  font-family: var(--font-primary);
  font-size: 14px;
}

/* Outer card — matches .main-card exactly */
.mem-outer-card {
  width: min(96vw, 950px);
  max-width: 950px;
  height: calc(100vh - var(--space-lg) * 0.35 - 96px);
  background: var(--bg-card);
  border-radius: var(--radius-large);
  border: 1px solid #e0c98a;
  box-shadow: var(--shadow-elevated), var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.mem-outer-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../assets/background2.jpg") center/300px auto repeat;
  opacity: 0.04;
  pointer-events: none;
  border-radius: var(--radius-large);
  z-index: 0;
}

/* Two side-by-side inner cards */
.mem-inner-card {
  flex: 1;
  border-radius: 14px;
  border: 1px solid rgba(224,201,138,0.55);
  background: rgba(253,248,240,0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  z-index: 1;
}

/* Row holding the two inner cards */
.mem-inner-cards-row {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 10px;
  gap: 10px;
  box-sizing: border-box;
}

/* Controls bar (search + sort, per panel) */
.mem-controls {
  display: flex;
  border-bottom: 1px solid rgba(224,201,138,0.45);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.mem-controls-side {
  flex: 1;
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mem-controls-divider { display: none; }
.mem-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-primary);
  font-weight: 550;
  font-size: 16px;
  color: var(--text-dark);
}
.mem-count {
  background: rgba(160,120,64,0.13);
  color: #a07840;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
}
.mem-count--muted {
  background: rgba(42,31,18,0.07);
  color: rgba(42,31,18,0.45);
}
.mem-ctrl-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.mem-search {
  flex: 1;
  height: 30px;
  border: 1px solid rgba(224,201,138,0.6);
  border-radius: 7px;
  padding: 0 10px;
  font-family: var(--font-primary);
  font-size: 12px;
  background: rgba(255,255,255,0.7);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.15s;
}
.mem-search:focus { border-color: #e0c98a; background: #fff; }
.mem-search::placeholder { color: rgba(42,31,18,0.35); font-style: italic; }
.mem-sort-sel {
  flex: 1;
  height: 30px;
  border: 1px solid rgba(224,201,138,0.6);
  border-radius: 7px;
  padding: 0 8px;
  font-family: var(--font-primary);
  font-size: 11.5px;
  background: rgba(255,255,255,0.7);
  color: var(--text-dark);
  outline: none;
  cursor: pointer;
}
.mem-search--sm { flex: 2; }
.mem-filter-toggle {
  width: 28px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid rgba(196,169,106,0.6);
  border-radius: 7px;
  background: var(--gold-light);
  color: #7a5c28;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.2s;
  padding: 0;
}
.mem-filter-toggle:hover { background: rgba(224,201,138,0.6); color: #5a3e10; }
.mem-filter-toggle--open { transform: rotate(180deg); }
.mem-filter-sel { flex: 1; }

/* Panels row */
.mem-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.mem-panel {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  box-sizing: border-box;
}
.mem-panel::-webkit-scrollbar { width: 4px; }
.mem-panel::-webkit-scrollbar-track { background: transparent; }
.mem-panel::-webkit-scrollbar-thumb { background: rgba(160,120,64,0.25); border-radius: 4px; }
.mem-divider { display: none; }

/* Memory cards */
.mem-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(224,201,138,0.4);
  background: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  position: relative;
  user-select: none;
}
.mem-card:hover {
  border-color: #e0c98a;
  box-shadow: 0 2px 10px rgba(160,120,64,0.13);
  background: rgba(255,255,255,0.95);
}
.mem-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(160,120,64,0.11);
  color: #a07840;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mem-card-icon--hist { background: rgba(106,78,160,0.09); color: #6a4ea0; }
.mem-card-body { flex: 1; min-width: 0; }
.mem-semibold { font-weight: 500; }
.mem-card-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.mem-card-name {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.mem-card-sub {
  font-family: var(--font-primary);
  font-size: 11px;
  color: rgba(42,31,18,0.5);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mem-card-date {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 10.5px;
  color: rgba(42,31,18,0.75);
  margin-top: 2px;
}
.mem-card-remark {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 11.5px;
  color: rgba(42,31,18,0.82);
  margin-top: 6px;
  max-width: calc(62% + 34px);
  width: fit-content;
  min-width: 180px;
  padding: 5px 10px;
  border: 1px solid rgba(224,201,138,0.55);
  border-radius: 10px;
  background: rgba(255, 250, 241, 0.92);
  text-align: left;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mem-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 4px;
}
.mem-del-btn {
  opacity: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f0b0b0;
  border: none;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
}
.mem-card:hover .mem-del-btn { opacity: 1; }
.mem-card-right .mem-bundle-badge { flex-shrink: 0; }
.mem-del-btn:hover { background: #e88080; transform: scale(1.1); }

/* Week / project group labels */
.mem-week-group { display: flex; flex-direction: column; gap: 5px; }
.mem-items-wrap { display: flex; flex-direction: column; gap: 5px; }
.mem-week-label {
  font-family: var(--font-primary);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(42,31,18,0.38);
  padding: 6px 2px 1px;
}

/* Empty state */
.mem-empty {
  font-family: var(--font-primary);
  font-size: 12.5px;
  color: rgba(42,31,18,0.38);
  text-align: center;
  padding: 28px 16px;
  line-height: 1.65;
}

/* ── Memory Modal ──────────────────────────────────────────────────────── */
.mem-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,22,12,0.52);
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.mem-modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-large);
  border: 1px solid #e0c98a;
  box-shadow: 0 10px 50px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.mem-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(224,201,138,0.45);
  flex-shrink: 0;
}
.mem-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dark);
}
.mem-modal-close-btn {
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  color: rgba(42,31,18,0.55);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.mem-modal-close-btn:hover { color: var(--text-dark); background: rgba(0,0,0,0.12); }

/* Page count label in topbar title */
.mem-modal-page-count {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(42,31,18,0.45);
  background: rgba(224,201,138,0.3);
  border: 1px solid rgba(224,201,138,0.55);
  border-radius: 5px;
  padding: 1px 7px;
  margin-right: 4px;
  letter-spacing: 0.02em;
}

/* Topbar right side: PDF btn + close btn */
.mem-modal-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 4px;
}
.mem-modal-pdf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 28px;
  height: 30px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--primary-gold);
  background: var(--gold-light);
  color: #1a1a1a;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), var(--shadow-button);
  transition: transform 0.15s, box-shadow 0.15s;
}
.mem-modal-pdf-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../assets/white pattern.png") center/360px auto repeat;
  opacity: 0.1;
  pointer-events: none;
}
.mem-modal-pdf-btn > * { position: relative; z-index: 1; }
.mem-modal-pdf-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* Modal body: scrollable column — mirrors right-panel */
.mem-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.mem-modal-body:hover { scrollbar-color: rgba(0,0,0,0.15) transparent; }
.mem-modal-body::-webkit-scrollbar { width: 4px; }
.mem-modal-body::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.mem-modal-body:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }

/* Hide Add-to-Bundle / Download buttons inside memory modal */
.mem-modal-body .output-btns { display: none; }

/* Output card inside modal body */
.mem-modal-body .output-card {
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  border-radius: 20px;
  background: #fdf8f0;
  border: 1px solid rgba(224,201,138,0.6);
}
.mem-modal-body .output-card .ps-body { width: 100%; }

/* Bundle: space between stacked sheets */
.mm-bundle-sheet + .mm-bundle-sheet { margin-top: 14px; }

/* "No Name" placeholder on history cards */
.mem-no-name {
  color: rgba(42,31,18,0.38);
  font-style: italic;
}

/* Bundle / Single PDF badge — right-aligned on name row */
.mem-bundle-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(224,201,138,0.35);
  border: 1px solid rgba(224,201,138,0.6);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: #7a5c28;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ============================================================
   === END MEMORY PAGE ========================================
