/* Kongu Sudar — design system ("Turmeric & Teal", spec §3).
   All sizing in rem/em so the A / A+ control (root font-size) scales everything. */

:root {
  /* White page + glass-finish cards, matching the portal (client 2026-07-09;
     was sandalwood #FCF6E3 / #FFFDF6 / #F6EFD4). */
  --bg: #ffffff;
  --surface: #ffffff;
  --header: #ffffff;
  /* Portal's glass shadow — cards read as floating on a glass floor. */
  --glass: 0 1px 2px rgba(44, 62, 61, .05), 0 14px 30px -16px rgba(44, 62, 61, .22);
  --primary: #3E8A89;
  --primary-dark: #2C5E5D;
  --teal-bg: #DCEDEA;
  --teal-border: #BEDDD6;
  --amber: #9A6A12;
  --amber-bg: #F6E8C8;
  --neutral-bg: #EDEED2;
  --neutral-text: #5E6B6A;
  --text: #2C3E3D;
  --text-muted: #7E857F;
  --border: #DDDFB8;
  --border-soft: #EFE4BF;
  --danger: #A32D2D;
  --verified: #1D9E75;
  --verified-bg: #E1F5EE;
  --silhouette-bg: #EDEED2;
  --silhouette-icon: #A8A06A;

  /* Logo colours — same round green/red mark as the portal (portal-web
     Header.astro / favicon.svg); keep these two in sync if either re-themes. */
  --logo-green: #0a7a0a;
  --logo-red: #cc0000;

  font-size: 100%; /* A = 100%, A+ = 150% (set on <html>) */
}
html.text-lg { font-size: 150%; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans Tamil', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ---- App bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--header);
  box-shadow: 0 1px 8px rgba(44, 62, 61, .08);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem; gap: 0.5rem;
}
.appbar .brand { font-weight: 500; color: var(--primary-dark); font-size: 1.15rem; }
.appbar .brand-logo { height: 1.5rem; width: auto; display: block; }
.appbar .controls { display: flex; gap: 0.4rem; }
/* Absolutely centered so it stays in the middle regardless of how wide the
   brand text / controls on either side are (.appbar's sticky position also
   establishes the positioning context). */
.appbar-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; }
.logo-mark { width: 2rem; height: 2rem; display: block; }
.logo-mark .seg-green { fill: var(--logo-green); }
.logo-mark .seg-red { fill: var(--logo-red); }
.ctrl {
  font-family: inherit; font-size: 0.85rem;
  background: var(--surface); color: var(--primary-dark);
  border: 1px solid var(--teal-border); border-radius: 0.5rem;
  padding: 0.3rem 0.6rem; cursor: pointer;
}
.ctrl[aria-pressed="true"] { background: var(--teal-bg); }

/* ---- Computer jathakam (public tool) ---- */
.jk-h { color: var(--primary-dark); font-size: 1.05rem; margin: 0 0 0.6rem; }
.jk-grid2 { display: grid; grid-template-columns: 1fr; gap: 0.35rem 1rem; }
@media (min-width: 560px) { .jk-grid2 { grid-template-columns: 1fr 1fr; } }
.jk-row { display: flex; gap: 0.4rem; font-size: 0.95rem; flex-wrap: wrap; }
.jk-k { color: var(--text-muted); flex: 0 0 auto; }
.jk-k::after { content: ":"; }
.jk-v { font-weight: 500; min-width: 0; }
/* Long lines (dasa balance) take a full-width row instead of squeezing. */
.jk-row-wide { margin-top: 0.35rem; }
.jk-charts { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .jk-charts { grid-template-columns: 1fr 1fr; } }
/* South-Indian chart: fixed 4×4, centre 2×2 merged for the title. */
.jk-chart {
  display: grid; grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, minmax(3.6rem, auto));
  border: 2px solid var(--primary-dark); border-radius: 0.4rem; overflow: hidden;
}
.jk-cell { border: 1px solid var(--border); padding: 0.2rem 0.3rem; min-width: 0; }
.jk-centre {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary-dark); background: var(--teal-bg);
}
.jk-rasi { font-size: 0.55rem; color: var(--text-muted); }
/* Wrap BETWEEN planet marks, never inside one ("செ(வ)" must stay whole). */
.jk-planets { font-size: 0.8rem; font-weight: 600; line-height: 1.35; display: flex; flex-wrap: wrap; gap: 0 0.3rem; }
.jk-planets .jk-p { white-space: nowrap; }
/* AM/PM birth-time entry (hour : minute AM/PM). */
.jk-time-row { display: flex; gap: 0.3rem; align-items: center; }
.jk-time-row select { width: auto; flex: 1; }
.jk-time-sep { font-weight: 700; }
.jk-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.jk-table th, .jk-table td { text-align: left; padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--border-soft); }
.jk-table th { color: var(--primary-dark); }
.jk-current td { font-weight: 700; background: var(--teal-bg); }
.jk-advanced summary { color: var(--primary-dark); cursor: pointer; font-size: 0.9rem; margin: 0.3rem 0; }
.jk-disclaimer { border-top-color: var(--amber); }

/* ---- Idle auto-logout countdown (30 min; warning from minute 25) ---- */
.idle-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; gap: 0.8rem;
  padding: 0.7rem 1rem; flex-wrap: wrap;
  background: var(--amber-bg); color: var(--amber);
  border-top: 2px solid var(--amber); font-size: 0.95rem;
  box-shadow: 0 -4px 14px rgba(44, 62, 61, .15);
}
.idle-bar .btn { background: var(--amber); color: #fff; border-color: var(--amber); padding: 0.4rem 0.9rem; }

/* ---- Split-screen login (Directus style, client 2026-07-10) ---- */
.auth { display: flex; min-height: 100vh; }
/* margin:auto (not align/justify center) so the form scrolls instead of
   clipping its top when taller than the viewport (A+ text on small phones). */
.auth-left {
  flex: 0 0 30rem; max-width: 100%; display: flex;
  overflow-y: auto; background: var(--surface);
}
.auth-form { width: 100%; max-width: 21rem; margin: auto; padding: 2rem 1rem; }
.auth-form h1 { color: var(--primary-dark); font-size: 1.35rem; margin: 0.4rem 0 1.2rem; }
.auth-form label { margin-top: 0.8rem; display: block; font-size: 0.9rem; color: var(--primary-dark); margin-bottom: 0.3rem; }
.auth-form .btn.block { margin-top: 1.1rem; }
.auth-form .btn.link { margin-top: 0.4rem; }
.auth-art {
  flex: 1; background: linear-gradient(135deg, #2C5E5D 0%, #3E8A89 55%, #9A6A12 130%);
  background-size: cover; background-position: center;
}
@media (max-width: 760px) { .auth-art { display: none; } .auth-left { flex: 1; } }

/* ---- Layout ---- */
#app { max-width: 30rem; margin: 0 auto; padding: 1rem; padding-bottom: 6rem; }
/* Full-screen start / sign-in panels begin BELOW the sticky app bar (they used
   to slide under it, hiding their first lines). --appbar-h is measured in app.js. */
#app .auth { position: fixed; top: var(--appbar-h, 3.5rem); left: 0; width: 100vw; height: calc(100vh - var(--appbar-h, 3.5rem)); min-height: 0; max-width: none; padding: 0; margin: 0; }
.view-title { color: var(--primary-dark); font-weight: 500; font-size: 1.4rem; margin: 0.25rem 0 1rem; }
/* Every grouping box carries the thick teal top edge (client rule — applies to
   every group on every screen; new screens get it automatically via .card). */
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-top: 4px solid var(--primary);
  border-radius: 0.85rem; padding: 1.1rem; margin-bottom: 1rem;
  box-shadow: var(--glass);
}
.muted { color: var(--text-muted); font-size: 0.9rem; }
/* Association office/contact box on the landing page. */
.contact-card p { margin: 0 0 0.15rem; font-size: 0.9rem; line-height: 1.4; }
.contact-card .contact-org { font-weight: 600; color: var(--primary); font-size: 1rem; margin-bottom: 0.5rem; }
.contact-card .contact-label { font-weight: 600; margin-top: 0.5rem; }
.contact-card .contact-addr { color: var(--text-muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 0.85rem; }

/* ---- Fields ---- */
.field { display: block; margin-bottom: 0.9rem; }
.field > label { display: block; font-size: 0.9rem; color: var(--primary-dark); margin-bottom: 0.3rem; }
/* Unscoped (not .field-only) so any required-marker asterisk renders the same
   size/weight everywhere it's used — including outside a .field wrapper, like
   the Photos section heading. */
.req { color: var(--danger); font-weight: 700; font-size: 1.05rem; margin-left: 0.1rem; }
.req-tag { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.field .hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
input, select, textarea {
  font-family: inherit; font-size: 1rem; width: 100%;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 0.6rem;
  padding: 0.6rem 0.7rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-border); border-color: var(--primary); }
.field-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.field-row > .field { flex: 1; }
.input-with-mic { display: flex; gap: 0.4rem; align-items: stretch; }
.input-with-mic > input, .input-with-mic > textarea { flex: 1; }

/* checkbox / radio groups */
.check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.95rem; }
.check input { width: auto; }
.radio-list { display: flex; flex-direction: column; gap: 0.4rem; }

/* Visibility accordion (spec §7 step 7): only the selected option expands —
   the other three collapse to just their name, so picking "Listed to matches
   only" (which can carry a full country/state/district/height filter block)
   never buries the Unlisted/Private options under a long scroll, especially
   on mobile. Selected = teal highlight, matching the app's existing
   teal-for-active convention (badges, stepper dots, borders). */
.vis-accordion { display: flex; flex-direction: column; gap: 0.5rem; }
.vis-item { border: 1px solid var(--border-soft); border-radius: 0.6rem; overflow: hidden; }
.vis-item.selected { border-color: var(--primary); background: var(--teal-bg); }
.vis-header { display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 0.9rem; cursor: pointer; margin: 0; }
.vis-header input { width: auto; flex: 0 0 auto; }
.vis-item .vis-name { flex: 1 1 auto; }
.vis-body { padding: 0 0.9rem 0.9rem; }
.vis-body .hint { margin-top: 0; }

/* ---- Buttons ---- */
.btn {
  font-family: inherit; font-size: 1rem; cursor: pointer;
  border-radius: 0.6rem; padding: 0.7rem 1rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bg); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary-dark); text-decoration: underline; cursor: pointer; padding: 0; font-size: 0.9rem; }
/* Member self-service pause/delete (spec §15) — visually distinct from the
   default teal .card border so the two actions read as different weights. */
.lifecycle-pause { border-top-color: var(--amber); }
.lifecycle-delete { border-top-color: var(--danger); }
.mic { flex: 0 0 auto; width: 2.6rem; border-radius: 0.6rem; border: 1px solid var(--teal-border); background: var(--teal-bg); cursor: pointer; }
.mic.recording { background: var(--danger); color: #fff; border-color: var(--danger); }
.mic.transcribing { opacity: 0.6; cursor: progress; }
.mic-status { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; min-height: 1em; }

/* ---- Sticky action bar ---- */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--header); border-top: 1px solid var(--border-soft);
  box-shadow: 0 -1px 8px rgba(44, 62, 61, .08);
  display: flex; gap: 0.6rem; padding: 0.7rem 1rem;
  max-width: 30rem; margin: 0 auto;
}
.sticky-bar .btn { flex: 1; }

/* ---- Stepper ---- */
.stepper { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.stepper .dot { flex: 1; height: 0.35rem; border-radius: 999px; background: var(--neutral-bg); }
.stepper .dot.active { background: var(--primary); }
.stepper .dot.done { background: var(--teal-border); }
.step-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
/* Each form section sits in its own card; a thick teal top edge separates them. */
.group-card { border-top: 4px solid var(--primary); }
.group-card .sec-title { margin-top: 0.25rem; }

/* ---- Badges / tags (spec §3 tag system) ---- */
.badge { display: inline-block; font-size: 0.78rem; border-radius: 999px; padding: 0.2rem 0.6rem; }
.badge-trust { background: var(--teal-bg); color: var(--primary-dark); }
.badge-recency { background: var(--neutral-bg); color: var(--neutral-text); }
.badge-status { background: var(--amber-bg); color: var(--amber); }
.badge-verified { background: var(--verified-bg); color: var(--verified); }
.badge-danger { background: var(--danger); color: #fff; }
.id-strong { font-weight: 700; color: var(--text); }

/* ---- Media ---- */
.thumbs { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.thumb { position: relative; width: 5.5rem; height: 5.5rem; border-radius: 0.6rem; overflow: hidden; border: 1px solid var(--border-soft); background: var(--silhouette-bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .pin { position: absolute; top: 2px; left: 2px; font-size: 0.65rem; background: var(--teal-bg); color: var(--primary-dark); padding: 0 0.3rem; border-radius: 0.4rem; }
.thumb .pin-rejected { top: auto; bottom: 2px; background: #f3dada; color: #A32D2D; }
.thumb .x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.5); color:#fff; border:none; border-radius: 0.4rem; cursor:pointer; font-size:0.7rem; padding: 0 0.3rem; }

/* ---- Banners ---- */
.banner { border-radius: 0.6rem; padding: 0.6rem 0.8rem; font-size: 0.9rem; margin-bottom: 0.8rem; }
.banner-info { background: var(--teal-bg); color: var(--primary-dark); }
.banner-warn { background: var(--amber-bg); color: var(--amber); }
.banner-error { background: var(--danger); color: #fff; font-weight: 500; border: 2px solid #7d1f1f; }
/* Highlight required fields that failed validation. */
.field-error > label { color: var(--danger); font-weight: 500; }
.field-error input, .field-error select, .field-error textarea {
  border: 2px solid var(--danger);
  background: #FBE9E9;
}
.vis-name { font-weight: 600; color: var(--primary-dark); }
.selected-box { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; padding: 0.5rem 0.6rem; background: var(--surface); border: 1px dashed var(--border); border-radius: 0.5rem; }
.chip-sel { background: var(--teal-bg); color: var(--primary-dark); border: 1px solid var(--teal-border); border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.8rem; }
select[multiple] { padding: 0.3rem; }
.divider { border: none; border-top: 1px solid var(--border-soft); margin: 0.4rem 0; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stat { background: var(--teal-bg); border-radius: 0.6rem; padding: 0.7rem; text-align: center; }
.stat-btn { font-family: inherit; border: 1px solid var(--teal-border); cursor: pointer; }
.stat-n { font-size: 1.6rem; font-weight: 600; color: var(--primary-dark); }
.stat-l { font-size: 0.8rem; color: var(--neutral-text); }
/* Mini list rows (reciprocity + activity lists): photo thumbnail + name + open. */
.mini-row { align-items: center; }
.mini-main { flex: 1; }
.mini-name { font-weight: 500; }
.mini-date { font-size: 0.75rem; }
/* Greyed-out "who can see me" for unlisted/private profiles (filter doesn't apply). */
.rfilter-disabled { opacity: 0.6; }
.mini-thumb { width: 2.6rem; height: 2.6rem; border-radius: 0.5rem; object-fit: cover;
  background: var(--silhouette-bg); flex: 0 0 auto; }
.mini-silhouette { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.banner-confirm { background: var(--verified-bg); color: var(--verified); }

.completeness { height: 0.5rem; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.completeness > span { display: block; height: 100%; background: var(--primary); }

/* ---- Search results (minimal cards, spec §14) ---- */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.s-card {
  display: flex; flex-direction: column; text-align: left;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 0.85rem; overflow: hidden; padding: 0; cursor: pointer;
  font-family: inherit; color: var(--text);
  box-shadow: var(--glass);
}
.s-card .carousel-main { aspect-ratio: 1 / 1; border-radius: 0; }
.s-card-body { padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; }
.s-card-name { font-weight: 500; color: var(--primary-dark); font-size: 1rem; }
.s-card .badge-row { margin-top: 0.2rem; }

.hidden { display: none !important; }
.spinner { text-align: center; color: var(--text-muted); padding: 2rem 0; }

/* ---- Profile view ---- */
.sec-title { color: var(--primary-dark); font-weight: 500; font-size: 1.05rem; margin: 0 0 0.6rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.dl { display: flex; flex-direction: column; gap: 0.4rem; }
.drow { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.95rem; }
.drow .dk { color: var(--text-muted); }
.drow .dv { color: var(--text); text-align: right; font-weight: 500; }
.row-gap { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.carousel { position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 0.85rem; overflow: hidden; box-shadow: var(--glass); }
.carousel-main { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; background: var(--silhouette-bg); }
.carousel-main .photo { width: 100%; height: 100%; object-fit: cover; }
.photo-locked { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 2rem; text-align: center; filter: blur(0.5px); }
.lock-icon { font-size: 2rem; }
.silhouette { font-size: 4rem; color: var(--silhouette-icon); }
.carousel-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,253,246,0.85); border: 1px solid var(--border-soft); border-radius: 999px; width: 2.2rem; height: 2.2rem; font-size: 1.4rem; cursor: pointer; color: var(--primary-dark); }
.carousel-arrow.left { left: 0.5rem; }
.carousel-arrow.right { right: 0.5rem; }
.dots { position: absolute; bottom: 0.5rem; left: 0; right: 0; display: flex; justify-content: center; gap: 0.3rem; }
.dot-i { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: rgba(255,255,255,0.6); }
.dot-i.on { background: var(--primary); }
.video { width: 100%; border-radius: 0.6rem; }
.share-link { font-family: monospace; font-size: 0.85rem; word-break: break-all; background: var(--teal-bg); color: var(--primary-dark); padding: 0.5rem 0.7rem; border-radius: 0.5rem; }

/* Printable biodata (spec §12) is now rendered server-side (WeasyPrint, fixed
   pt/mm units — immune to the text-size A/A+ toggle) and opened as a PDF; see
   backend/app/services/biodata_pdf.py + templates/biodata.html.jinja. The
   "Print biodata" button just links straight to that endpoint. */

/* Register-by-WhatsApp box on the sign-in screen (until phone codes are live). */
.wa-reg { margin-top: 1.4rem; text-align: left; }
.wa-reg h2 { font-size: 1.05rem; color: var(--primary-dark); margin: 0 0 0.4rem; }
.wa-reg p { font-size: 0.9rem; margin: 0 0 0.8rem; }
.wa-reg-link { display: block; text-align: center; text-decoration: none; margin-top: 0.5rem; }
.wa-reg-link:hover { text-decoration: none; }

/* Breathing room between the app bar and the start / sign-in content. */
.auth-form { padding-top: 2.5rem; }

/* Main-site menu (☰) — public matrimony pages only. */
.appbar-start { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.menu-toggle { font-size: 1.1rem; line-height: 1; padding: 0.3rem 0.55rem; }
.site-menu {
  position: absolute; top: 100%; left: 0.6rem; z-index: 20;
  min-width: 15rem; max-width: calc(100vw - 1.2rem);
  display: flex; flex-direction: column; padding: 0.4rem;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-top: 3px solid var(--primary); border-radius: 0.6rem;
  box-shadow: 0 12px 28px -12px rgba(44, 62, 61, .35);
}
.site-menu[hidden] { display: none; }
.site-menu a {
  padding: 0.6rem 0.7rem; border-radius: 0.4rem; color: var(--text);
  text-decoration: none; font-size: 0.95rem;
}
.site-menu a:hover, .site-menu a:focus-visible { background: var(--teal-bg); color: var(--primary-dark); outline: none; }
/* With the ☰ button in the bar: controls never wrap; the logo shrinks instead. */
.appbar .controls { flex: none; }
.appbar .ctrl { white-space: nowrap; }
.appbar-start { flex: 1 1 auto; }
.appbar .brand { min-width: 0; }
.appbar .brand-logo { height: auto; max-height: 1.5rem; max-width: 100%; }
