/* ==========================================================
   National Suvidha Biodata Maker — Design System
   Palette: Deep maroon + antique gold + ivory + emerald accent
   Display type: 'Cormorant Garamond' (invite-card serif)
   Body type: 'Inter'
   Utility type: 'IBM Plex Mono' (for reference codes / QR)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* --- colour tokens --- */
  --maroon-900: #4A1428;
  --maroon-700: #6B1E3C;
  --maroon-500: #7A1F3D;
  --gold-500: #C9A24B;
  --gold-300: #E4C583;
  --ivory-50: #FBF6EF;
  --ivory-100: #F4EBDD;
  --emerald-700: #1F4B43;
  --emerald-500: #2C6B5F;
  --blush-100: #F3E1D8;
  --ink-900: #2B2320;
  --ink-600: #5B5049;
  --ink-300: #A99C8E;
  --line: rgba(43, 35, 32, 0.12);
  --white: #FFFFFF;

  --shadow-soft: 0 8px 30px rgba(74, 20, 40, 0.08);
  --shadow-lift: 0 16px 48px rgba(74, 20, 40, 0.16);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--ivory-50);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(201, 162, 75, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(31, 75, 67, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--maroon-900);
  letter-spacing: 0.01em;
}

.text-mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.text-muted-soft { color: var(--ink-600) !important; }
.text-gold { color: var(--gold-500) !important; }
.text-maroon { color: var(--maroon-700) !important; }

a { color: var(--maroon-700); text-decoration: none; }
a:hover { color: var(--maroon-900); }

::selection { background: var(--gold-300); color: var(--maroon-900); }

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------- Layout shell ---------------- */
.bp-pricing-strip {
  background: var(--maroon-900);
  color: var(--ivory-50);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 12px;
  text-align: center;
}
.bp-pricing-strip strong { color: var(--gold-300); }
.bp-pricing-strip a {
  color: var(--white);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bp-navbar {
  background: rgba(251, 246, 239, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.bp-navbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--maroon-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bp-navbar .brand .dot { color: var(--gold-500); }

.bp-container { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; }

/* ---------------- Buttons ---------------- */
.btn-bp-primary {
  background: linear-gradient(135deg, var(--maroon-700), var(--maroon-900));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-bp-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); color: var(--white); }
.btn-bp-primary:active { transform: translateY(0); }

.btn-bp-gold {
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  color: var(--maroon-900);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.75rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-bp-gold:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); color: var(--maroon-900); }

.btn-bp-outline {
  background: transparent;
  color: var(--maroon-700);
  border: 1.5px solid var(--maroon-700);
  border-radius: var(--radius-md);
  padding: 0.7rem 1.6rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-bp-outline:hover { background: var(--maroon-700); color: var(--white); }

.btn-bp-ghost {
  background: transparent;
  color: var(--ink-600);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.4rem;
  font-weight: 500;
}
.btn-bp-ghost:hover { border-color: var(--maroon-500); color: var(--maroon-700); }

/* ---------------- Hero ---------------- */
.hero {
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--emerald-700);
  background: rgba(31, 75, 67, 0.08);
  border: 1px solid rgba(31, 75, 67, 0.18);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.08;
  margin-bottom: 1.25rem;
}
.hero h1 em {
  font-style: italic;
  color: var(--gold-500);
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--ink-600);
  max-width: 560px;
  margin-bottom: 2rem;
}
.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 3rem;
}
.hero-stats .stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--maroon-900);
}
.hero-stats .stat-label {
  font-size: 0.82rem;
  color: var(--ink-600);
}

/* ornamental corner motif - the page's signature element */
.ornament-corner {
  position: absolute;
  width: 180px;
  height: 180px;
  opacity: 0.5;
  pointer-events: none;
}
.ornament-corner.tr { top: -20px; right: -20px; }
.ornament-corner.bl { bottom: -20px; left: -20px; transform: rotate(180deg); }

/* ---------------- Card frame (invite-style) ---------------- */
.invite-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  position: relative;
  overflow: hidden;
}
.invite-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1.5px solid var(--gold-300);
  border-radius: calc(var(--radius-lg) - 4px);
  pointer-events: none;
}

/* ---------------- Section wrapper ---------------- */
.section { padding: 4.5rem 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 3rem; }
.section-head .eyebrow { justify-content: center; }
.section-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.section-head p { color: var(--ink-600); }

/* ---------------- Feature / plan cards ---------------- */
.bp-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 1.75rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}
.bp-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.bp-card .icon-badge {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
  color: var(--white);
  margin-bottom: 1rem;
}

.plan-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 2rem 1.6rem;
  text-align: center;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.plan-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); }
.plan-card.featured {
  border-color: var(--gold-500);
  background: linear-gradient(180deg, var(--white) 0%, var(--blush-100) 220%);
}
.plan-card .badge-popular {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gold-500); color: var(--maroon-900);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.3rem 0.9rem; border-radius: 999px; text-transform: uppercase;
}
.plan-card .price { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: var(--maroon-900); }
.plan-card .price small { font-size: 1rem; font-weight: 500; color: var(--ink-600); }
.plan-card ul { list-style: none; padding: 0; margin: 1.5rem 0; text-align: left; }
.plan-card ul li { display: flex; align-items: start; gap: 0.6rem; padding: 0.4rem 0; color: var(--ink-600); font-size: 0.92rem; }
.plan-card ul li svg { flex-shrink: 0; margin-top: 3px; color: var(--emerald-700); }

/* ==========================================================
   WIZARD
   ========================================================== */
.wizard-shell { padding: 2rem 0 5rem; }

.stepper {
  display: flex;
  overflow-x: auto;
  gap: 0.4rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}
.stepper::-webkit-scrollbar { height: 5px; }
.stepper::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }

.step-pill {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-600);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.step-pill .num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ivory-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--ink-600);
}
.step-pill.active {
  background: var(--maroon-700); color: var(--white); border-color: var(--maroon-700);
  box-shadow: var(--shadow-soft);
}
.step-pill.active .num { background: var(--gold-500); color: var(--maroon-900); }
.step-pill.done .num { background: var(--emerald-500); color: var(--white); }
.step-pill.done { color: var(--emerald-700); }

.wizard-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 2.2rem;
}
.wizard-panel h3 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.wizard-panel .step-sub { color: var(--ink-600); font-size: 0.9rem; margin-bottom: 1.75rem; }

/* floating label inputs */
.bp-field { position: relative; margin-bottom: 1.4rem; }
.bp-field label {
  position: absolute; left: 14px; top: 13px;
  font-size: 0.95rem; color: var(--ink-300);
  pointer-events: none;
  transition: all 0.15s ease;
  background: var(--white);
  padding: 0 4px;
}
.bp-field input,
.bp-field select,
.bp-field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 14px 8px;
  font-size: 0.98rem;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bp-field textarea { min-height: 88px; resize: vertical; padding-top: 20px; }
.bp-field input:focus, .bp-field select:focus, .bp-field textarea:focus {
  outline: none;
  border-color: var(--maroon-500);
  box-shadow: 0 0 0 3px rgba(122, 31, 61, 0.1);
}
.bp-field input:focus + label,
.bp-field input:not(:placeholder-shown) + label,
.bp-field textarea:focus + label,
.bp-field textarea:not(:placeholder-shown) + label,
.bp-field select.has-value + label,
.bp-field.select-field label {
  top: -8px; left: 10px; font-size: 0.72rem; color: var(--maroon-700); font-weight: 600;
}
.bp-field.select-field select { padding-top: 14px; }
.bp-field .req { color: var(--maroon-500); }
.bp-field.invalid input, .bp-field.invalid select, .bp-field.invalid textarea { border-color: #C0392B; }
.bp-field .err-msg { display: none; font-size: 0.76rem; color: #C0392B; margin-top: 4px; }
.bp-field.invalid .err-msg { display: block; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 640px) { .field-grid { grid-template-columns: 1fr; } }

.wizard-nav {
  display: flex; justify-content: space-between;
  margin: 2rem -2.2rem -2.2rem;
  padding: 1rem 2.2rem;
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  z-index: 5;
}

.autosave-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; color: var(--ink-300);
}
.autosave-pill .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--emerald-500);
}

/* ---------------- Live preview: plain single A4 sheet (same outer box/size as before) ---------------- */
.preview-sticky { position: sticky; top: 100px; }
.preview-card {
  background: #EDEBE6;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 210 / 297;
  position: relative;
}
/* The actual page — plain white A4 sheet, no extra background page behind it. */
.bp-a4-page {
  background: #FFFFFF;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  position: relative;
}
.a4-inner {
  width: 100%; height: 100%;
  box-sizing: border-box;
  padding: 16px 18px;
  overflow: hidden;
  font-size: 100%;
  display: flex; flex-direction: column;
  position: relative;
  z-index: 0;
}
.a4-corner { position: absolute; width: 42px; height: 42px; opacity: 0.6; pointer-events: none; }
.a4-corner-svg { width: 100%; height: 100%; display: block; }
.a4-bgflower { position: absolute; inset: 0; z-index: -1; opacity: 0.9; pointer-events: none; overflow: hidden; }
.a4-bgflower-svg { width: 100%; height: 100%; }
.a4-corner-tl { top: 6px; left: 6px; }
.a4-corner-tr { top: 6px; right: 6px; transform: scaleX(-1); }
.a4-corner-bl { bottom: 6px; left: 6px; transform: scaleY(-1); }
.a4-corner-br { bottom: 6px; right: 6px; transform: scale(-1, -1); }
.a4-header { padding-bottom: 8px; }
.a4-header-row, .a4-header-split-row { display: flex; align-items: center; gap: 10px; }
.a4-header-split { padding: 12px 16px; margin: -16px -18px 10px; }
.a4-name { font-weight: 700; font-style: italic; font-size: 1.15em; line-height: 1.2; }
.a4-tagline { font-size: 0.62em; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.a4-sections-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-content: start; }
.a4-sections-single { display: block; }
.a4-section { margin-bottom: 8px; }
.a4-section-title { font-size: 0.72em; font-weight: 700; font-style: italic; border-bottom: 1px solid; padding-bottom: 2px; margin-bottom: 4px; }
.a4-kv { display: flex; font-size: 0.58em; padding: 1.5px 0; line-height: 1.35; }
.a4-k { flex: 0 0 40%; font-weight: 600; opacity: 0.92; }
.a4-sep { flex: 0 0 4%; opacity: 0.7; }
.a4-v { flex: 1; word-break: break-word; }
.a4-watermark { margin-top: auto; text-align: center; font-size: 0.5em; opacity: 0.45; padding-top: 6px; }
.a4-empty { font-size: 0.75em; color: var(--ink-300); text-align: center; padding: 1.5em 1em; }

/* ---- Reusable feature: pill-shaped section header badge (instead of underline) ---- */
.a4-section-title-pill { border-bottom: none !important; border-radius: 999px; padding: 3px 10px !important; display: inline-block; font-style: normal !important; }

/* ---- Reusable feature: coloured dot bullet before each field row ---- */
.a4-kv-icon { align-items: flex-start; gap: 4px; }
.a4-kv-dot { width: 5px; height: 5px; border-radius: 50%; margin-top: 4px; flex: 0 0 auto; }
.a4-kv-icon .a4-k { flex: 0 0 36%; }

/* ---- Reusable feature: bottom photo-gallery strip (extra uploaded photos) ---- */
.a4-gallery { display: flex; gap: 6px; margin-top: 6px; justify-content: center; }
.a4-gallery-item { width: 15%; aspect-ratio: 1/1; border-radius: 6px; overflow: hidden; border: 1.5px solid; }
.a4-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Layout: sidebar (full-height colour panel + photo/name, content on the right) ---- */
.a4-inner-sidebar { flex-direction: row; padding: 0; }
.a4-sidebar {
  width: 34%; flex: 0 0 34%; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 12px; border-radius: 0 34px 34px 0;
  text-align: center;
}
.a4-sidebar-name { color: #FFFFFF; font-weight: 700; font-size: 1em; margin-top: 10px; line-height: 1.25; }
.a4-sidebar-tag { font-size: 0.58em; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 4px; }

.a4-sidebar-section { width: 100%; margin-top: 12px; text-align: left; }
.a4-sidebar-section-title {
  color: #fff; font-weight: 700; font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255,255,255,0.4); padding-bottom: 3px; margin-bottom: 5px;
}
.a4-sidebar-row { font-size: 0.56em; color: #fff; padding: 2px 0; line-height: 1.35; }
.a4-sidebar-row-k { display: block; font-weight: 700; opacity: 0.92; }
.a4-sidebar-row-v { display: block; opacity: 0.95; word-break: break-word; }
.a4-main { flex: 1; box-sizing: border-box; padding: 18px 16px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; position: relative; }
.a4-main .a4-sections-grid { grid-template-columns: 1fr; }

/* ---- Layout: archphoto (rounded-top arch photo beside a large name) ---- */
.a4-inner-arch { position: relative; }
.a4-arch-header { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 10px; }
.a4-arch-photo-wrap {
  width: 92px; height: 118px; flex: 0 0 auto;
  border-radius: 46px 46px 4px 4px; overflow: hidden; border: 1px solid;
}
.a4-name-big { font-weight: 800; font-size: 1.5em; line-height: 1.1; }

/* ---- Layout: duotone (two colour blocks, circular photo overlapping the seam) ---- */
.a4-inner-duotone { padding: 0; }
.a4-duotone-header { position: relative; display: flex; height: 92px; flex: 0 0 auto; }
.a4-duotone-block { flex: 1; }
.a4-duotone-dark { flex: 0 0 30%; }
.a4-duotone-light { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-left: 44px; box-sizing: border-box; overflow: hidden; }
.a4-duotone-name { color: #fff; font-weight: 800; font-size: 1.05em; line-height: 1.15; }
.a4-duotone-tag { color: #fff; font-size: 0.56em; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.9; margin-top: 3px; }
.a4-duotone-photo {
  position: absolute; left: 30%; top: 50%; transform: translate(-50%, -50%);
  width: 66px; height: 66px; border-radius: 50%; overflow: hidden; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.a4-inner-duotone > .a4-sections, .a4-inner-duotone > .a4-watermark { padding: 0 16px; box-sizing: border-box; }
.a4-inner-duotone > .a4-sections { padding-top: 12px; }

/* ---- Layout: ringsidebar (colour header band, dashed ring around photo, pill badges) ---- */
.a4-inner-ringsidebar { padding: 0; }
.a4-ring-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; flex: 0 0 auto; }
.a4-ring-photo-wrap { position: relative; width: 78px; height: 78px; flex: 0 0 auto; }
.a4-ring-svg { position: absolute; inset: -6px; width: 90px; height: 90px; }
.a4-ring-photo-wrap img, .a4-ring-photo-wrap > div { position: relative; }
.a4-inner-ringsidebar > .a4-sections, .a4-inner-ringsidebar > .a4-gallery, .a4-inner-ringsidebar > .a4-watermark { padding: 0 16px; box-sizing: border-box; }
.a4-inner-ringsidebar > .a4-sections { padding-top: 12px; }

/* ---- Layout: arcbehind (colour arc sits behind a rectangular photo) ---- */
.a4-inner-arcbehind { padding: 16px 18px; }
.a4-arcbehind-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.a4-arcbehind-textblock { flex: 1; min-width: 0; }
.a4-arcbehind-photowrap { position: relative; width: 84px; height: 84px; flex: 0 0 auto; overflow: hidden; border-radius: 8px; }
.a4-arcbehind-arc { position: absolute; inset: 0; border-radius: 50% 0 0 0; opacity: 0.85; }
.a4-arcbehind-photo { position: absolute; right: 0; bottom: 0; width: 72%; height: 72%; overflow: hidden; border-radius: 6px; }
.a4-arcbehind-photo img, .a4-arcbehind-photo > div { width: 100%; height: 100%; }
.a4-arcbehind-rule { height: 2px; margin: 10px 0; opacity: 0.85; }

/* ---- Layout: gridminimal (hairline rules, ultra-minimal) ---- */
.a4-inner-gridminimal { padding: 16px 18px; }
.a4-grid-header { position: relative; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid currentColor; min-height: 70px; }
.a4-grid-name { font-weight: 700; font-size: 1.3em; letter-spacing: 0.02em; max-width: 65%; }
.a4-grid-photo { position: absolute; top: 0; right: 0; width: 64px; height: 64px; overflow: hidden; border-radius: 4px; }
.a4-grid-photo img, .a4-grid-photo > div { width: 100%; height: 100%; }

/* ---------------- Print: only the live A4 sheet, exactly ONE page ----------------
   Uses a dedicated top-level #printArea (see create.php) that JS fills with
   the exact live preview HTML right before printing. display:none (not
   visibility:hidden) is used to hide everything else so hidden elements
   don't still reserve page height — that was the earlier "3 blank pages" bug. */
/* ---------------- Template gallery ---------------- */
.template-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.2rem;
  max-height: 58vh;
  overflow-y: auto;
  padding: 0.25rem 0.4rem 0.25rem 0.05rem;
  margin: 0 -0.4rem 0 -0.05rem;
}
.template-grid::-webkit-scrollbar { width: 8px; }
.template-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.template-grid::-webkit-scrollbar-thumb:hover { background: var(--gold-500); }
.template-tile {
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  aspect-ratio: 210/297;
  position: relative;
  background: var(--white);
}
.template-tile.selected { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.25); }
.template-tile:hover { transform: translateY(-3px); }
.template-tile .tag {
  position: absolute; top: 8px; left: 8px;
  font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(43,35,32,0.75); color: white; letter-spacing: 0.04em;
}
.template-tile .tag.premium { background: var(--gold-500); color: var(--maroon-900); }
.template-tile .label { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,0.92); font-size: 0.72rem; font-weight: 600; text-align: center; padding: 6px 4px 22px; }
.template-tile .tpl-cat { display: block; font-size: 0.6rem; font-weight: 500; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 1px; }
.tpl-swatch-mini {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -55%);
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 600;
}

/* ---------------- Design step ---------------- */
.design-block { margin-bottom: 1.6rem; }
.design-label { font-weight: 600; font-size: 0.85rem; color: var(--ink-900); margin-bottom: 0.6rem; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatch-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line);
  cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; padding: 0;
}
.swatch-dot:hover { transform: scale(1.08); }
.swatch-dot.active { border-color: var(--maroon-900); box-shadow: 0 0 0 2px rgba(122, 31, 43, 0.25); }
.swatch-reset { background: var(--white); color: var(--ink-300); font-size: 0.85rem; line-height: 26px; }
.font-pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.font-pill {
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--white);
  font-size: 0.9rem; cursor: pointer; transition: all 0.12s ease;
}
.font-pill.active, .font-pill:hover { border-color: var(--gold-500); background: var(--gold-100, #f6ecd6); }
.corner-pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.corner-pill {
  padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--white);
  font-size: 0.78rem; cursor: pointer; transition: all 0.12s ease;
}
.corner-pill.active, .corner-pill:hover { border-color: var(--gold-500); background: var(--gold-100, #f6ecd6); }
.order-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.order-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; font-size: 0.88rem; background: var(--white);
}
.order-list li + li { border-top: 1px solid var(--line); }
.order-arrows { display: flex; gap: 6px; }
.order-arrows button {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--ivory-100);
  cursor: pointer; font-size: 0.85rem; line-height: 1;
}
.order-arrows button:hover { background: var(--gold-100, #f6ecd6); }

/* ---------------- Photo uploader ---------------- */
.photo-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-600);
  cursor: pointer;
  transition: all 0.15s ease;
}
.photo-drop.dragover { border-color: var(--gold-500); background: var(--blush-100); }
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.6rem; margin-top: 1rem; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .rm { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.55); color: white; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 0.7rem; line-height: 1; }
.photo-thumb.primary::after { content: '★'; position: absolute; bottom: 2px; left: 2px; color: var(--gold-300); font-size: 0.8rem; }
.photo-slot-label { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.55); color: #fff; font-size: 0.62rem; text-align: center; padding: 2px 0; letter-spacing: 0.3px; }
.wizard-subheading { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }

/* ---------------- Live template preview (wizard Preview step + preview.php) ---------------- */
.a4-preview-scale { padding: 0; }
.template-live-preview table { max-width: 100%; }

/* ---------------- Print / PDF-style on-screen preview ---------------- */
/* The biodata HTML itself is built with width:100% tables (see
   render_biodata_html), so it naturally reflows to whatever container
   width it's placed in — both the narrow wizard preview pane and the
   full A4-proportioned print output below. */


/* ---------------- Paywall modal ---------------- */
.paywall-backdrop {
  position: fixed; inset: 0; background: rgba(43, 35, 32, 0.55);
  backdrop-filter: blur(3px); z-index: 1050;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.paywall-modal {
  background: var(--white); border-radius: 20px; max-width: 620px; width: 100%;
  padding: 2.5rem; box-shadow: var(--shadow-lift); text-align: center;
  position: relative;
}
.paywall-modal .lock-badge {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.2rem; color: var(--maroon-900);
}

/* ---------------- Footer ---------------- */
.bp-footer {
  background: var(--maroon-900);
  color: rgba(255,255,255,0.75);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}
.bp-footer h5 { color: var(--gold-300); font-family: var(--font-display); font-size: 1.1rem; }
.bp-footer a { color: rgba(255,255,255,0.7); }
.bp-footer a:hover { color: var(--gold-300); }
.bp-footer .bottom-bar { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 2.5rem; padding-top: 1.5rem; font-size: 0.82rem; text-align: center; color: rgba(255,255,255,0.5); }

/* ---------------- Utility animations ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.5s ease both; }

.toast-bp {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  background: var(--maroon-900); color: white; padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md); box-shadow: var(--shadow-lift);
  font-size: 0.9rem; display: flex; align-items: center; gap: 0.6rem;
  transform: translateY(20px); opacity: 0; transition: all 0.25s ease;
}
.toast-bp.show { transform: translateY(0); opacity: 1; }
