/* ============================================================
   BIODATA.CSS — Marriage Biodata Module Styles
   Drop-in addition to styles.css — no conflicts
============================================================ */

/* ── Biodata Gallery Page ────────────────────────────────── */
#biodataPage {
  position: fixed;
  inset: 0;
  background: #fdfaef;
  z-index: 802;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .55s cubic-bezier(.22,.61,.36,1);
  overflow: hidden;
}
#biodataPage.open { transform: translateY(0); }

.bio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px,4vw,40px);
  height: 62px;
  background: #fff;
  border-bottom: 1px solid rgba(201,168,76,.2);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.bio-topbar-left { display: flex; align-items: center; gap: 12px; }
.bio-topbar-title {
  font-size: 1.2rem; font-weight: 700;
  font-family: 'Playfair Display', 'Cormorant Garamond', serif;
  color: #3a1a1a;
}
.bio-badge-count {
  background: linear-gradient(135deg,#7a1520,#a82030);
  color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 3px 11px; border-radius: 50px;
  letter-spacing: .3px;
}
.bio-filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 13px clamp(16px,4vw,40px);
  border-bottom: 1px solid rgba(201,168,76,.15);
  background: rgba(255,251,240,.85);
  flex-shrink: 0;
}
.bio-filter-label { font-size: .78rem; font-weight: 600; color: #8a7070; margin-right: 4px; }
.bio-chip {
  border: 1.5px solid #e0d4c4; background: none;
  color: #8a7070; padding: 5px 16px; border-radius: 50px;
  font-size: .8rem; font-weight: 500; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.bio-chip.active, .bio-chip:hover {
  background: #7a1520; border-color: #7a1520; color: #fff;
}
.bio-grid-scroll { flex: 1; overflow-y: auto; padding: 22px clamp(16px,4vw,40px); }
.bio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 20px;
  max-width: 1100px; margin: 0 auto;
}

/* ── Biodata Preview Modal ───────────────────────────────── */
#biodataPreviewModal {
  position: fixed; inset: 0;
  z-index: 812;
  background: rgba(10,4,2,.78);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
#biodataPreviewModal.open { opacity: 1; pointer-events: all; }
#biodataPreviewModal .modal-box { transform: scale(.96); transition: transform .25s; }
#biodataPreviewModal.open .modal-box { transform: scale(1); }
/* Give the biodata modal header a maroon accent */
#biodataPreviewModal .modal-header {
  background: linear-gradient(135deg,#2e0a10,#5C0A1C);
  border-bottom-color: rgba(201,168,76,.2);
}
#biodataPreviewModal .modal-title { color: #fff; }
#biodataPreviewModal .modal-actions .btn-primary-sm {
  background: linear-gradient(135deg,#C9A84C,#E2C96E);
  color: #1a0a00;
}
#biodataPreviewModal .btn-icon-close { color: rgba(255,255,255,.7); }
#biodataPreviewModal .btn-icon-close:hover { color: #fff; background: rgba(255,255,255,.12); }

/* ── Biodata Editor Page ─────────────────────────────────── */
#biodataEditorPage {
  position: fixed; inset: 0;
  z-index: 960;
  display: flex; flex-direction: column;
  background: var(--surface-2, #f8f5ee);
  transform: translateX(100%);
  transition: transform .45s cubic-bezier(.22,.61,.36,1);
  overflow: hidden;
}
#biodataEditorPage.open { transform: translateX(0); }

/* Maroon-gold topbar override */
#biodataEditorPage .editor-topbar {
  background: linear-gradient(135deg,#2e0a10,#5C0A1C);
  border-bottom: 1.5px solid rgba(201,168,76,.25);
}
#biodataEditorPage .editor-tpl-name { color: #C9A84C; font-size: 1rem; }
#biodataEditorPage .editor-tpl-sub  { color: rgba(255,255,255,.5); }
#biodataEditorPage .btn-ghost { color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.06); }
#biodataEditorPage .btn-ghost:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color:#fff; }
#biodataEditorPage .btn-ghost-sm { color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.2); background:none; padding:7px 14px; border-radius:7px; font-size:.84rem; cursor:pointer; transition:.15s; }
#biodataEditorPage .btn-ghost-sm:hover, #biodataEditorPage .btn-ghost-sm.active { background: rgba(201,168,76,.18); border-color: rgba(201,168,76,.4); color: #C9A84C; }
#biodataEditorPage .btn-download { background: linear-gradient(135deg,#7a1520,#a82030); }

/* iframe sizing */
#biodataEditorFrame { width: 794px; height: 1123px; border: none; display: block; }

/* ── Scrollable preview fix ──────────────────────────────────
   Root cause 1: align-items:center on a flex container with
   overflow:auto makes the cross-axis overflow non-scrollable
   (the browser can't scroll to show content that overflows
   on the "start" side of a centered item).
   Fix: switch to align-items:flex-start + margin:auto on child.

   Root cause 2: .preview-wrap has overflow:hidden which clips
   the 794×1123 iframe — we make it visible so the panel scrolls.
──────────────────────────────────────────────────────────── */
#biodataEditorPage .editor-preview-panel {
  align-items: flex-start;   /* makes overflow properly scrollable */
  overflow: auto;
  padding: 24px 20px;
}
#biodataEditorPage .preview-wrap {
  margin: 0 auto;            /* centre horizontally when there's space */
  overflow: visible;         /* let the panel—not the wrap—control scroll */
  flex-shrink: 0;            /* never shrink below the iframe's natural size */
}

#biodataEditorPage .editor-form-panel { border-right-color: rgba(201,168,76,.15); }

/* ── Photo Upload UI ─────────────────────────────────────── */
.bio-photo-row { display: flex; gap: 16px; align-items: flex-start; }
.bio-photo-circle {
  width: 84px; height: 84px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  border: 3px solid #c9a84c;
  background: #f5ede0;
  display: flex; align-items: center; justify-content: center;
}
.bio-photo-circle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.bio-photo-controls { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.btn-bio-photo {
  display: inline-block; background: #7a1520; color: #fff;
  padding: 8px 13px; border-radius: 7px; font-size: 12.5px;
  font-weight: 600; cursor: pointer; text-align: center; border: none;
  transition: background .15s; font-family: inherit;
}
.btn-bio-photo:hover { background: #a82030; }
.btn-bio-remove {
  background: none; border: 1.5px solid #e0d4c4; color: #888;
  padding: 6px 11px; border-radius: 7px; font-size: 12px;
  cursor: pointer; transition: .15s; font-family: inherit;
}
.btn-bio-remove:hover { border-color: #7a1520; color: #7a1520; }

/* ── Homepage category card art ─────────────────────────── */
.cat-art-biodata {
  background: linear-gradient(145deg, #4E0A14 0%, #7A1520 50%, #A82030 100%);
}
.cat-art-biodata .art-bg-circle.c1 { background: rgba(201,168,76,.20); }
.cat-art-biodata .art-bg-circle.c2 { background: rgba(201,168,76,.10); }

/* ── Mobile hide/show for biodata editor (mirrors existing editor mobile behaviour) */
@media (max-width: 768px) {
  .bio-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  #biodataEditorPage .editor-form-panel.hide { display: none; }
  #biodataEditorPage .editor-preview-panel.show { display: flex; }
  .bio-topbar { height: auto; padding: 12px 16px; }
  .frow-2 { grid-template-columns: 1fr; }
}

/* ── Add / Remove Field UI ───────────────────────────────── */

/* Field row with header bar */
.bio-frow {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bio-frow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 20px;
}
.bio-frow-header label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
  line-height: 1.3;
}

/* × remove button on built-in fields */
.bio-field-rm {
  background: none;
  border: 1px solid transparent;
  color: #ccc;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}
.bio-field-rm:hover {
  background: #fff0f0;
  color: #e53935;
  border-color: #ffcdd2;
}

/* Custom field row — editable label input */
.bio-custom-frow {
  background: rgba(201,168,76,.05);
  border: 1.5px dashed rgba(201,168,76,.35);
  border-radius: 8px;
  padding: 8px 10px;
  gap: 6px;
}
.bio-label-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: #7a5200;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0;
  min-width: 0;
  font-family: inherit;
}
.bio-label-input::placeholder {
  color: rgba(201,168,76,.5);
  font-weight: 600;
  text-transform: none;
}
.bio-label-input:focus {
  border-bottom: 1px solid rgba(201,168,76,.5);
}

/* Restore tray — hidden field chips */
.bio-restore-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 6px 0 2px;
  border-top: 1px dashed #ece5da;
  margin-top: 4px;
}
.bio-restore-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-right: 2px;
}
.bio-restore-chip {
  background: none;
  border: 1px dashed #c9a84c;
  color: #7a5200;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 50px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.bio-restore-chip:hover {
  background: #c9a84c;
  color: #fff;
  border-color: #c9a84c;
}

/* + Add Field button at section bottom */
.bio-add-field-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px 0;
  background: none;
  border: 1.5px dashed rgba(201,168,76,.4);
  border-radius: 8px;
  color: #a07820;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .3px;
  transition: background .15s, border-color .15s, color .15s;
}
.bio-add-field-btn:hover {
  background: rgba(201,168,76,.08);
  border-color: #c9a84c;
  color: #7a5200;
}
