/* ============================================================================
   GeniusLaw — Foreclosure Defense Intake
   SF Pro Display · light + dark · GeniusLaw gradient orb.
============================================================================ */

:root {
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --brand: #2f6bff;
  --brand-strong: #1d54e8;
  --green: #16a34a;
  --red: #e5484d;

  --r-card: 20px;
  --r-sm: 12px;
}

[data-theme="light"] {
  --bg: #f5f8fd;
  --bg-tint: rgba(47, 107, 255, 0.06);
  --card: #ffffff;
  --card-2: #fbfcfe;
  --text: #0b1220;
  --text-2: #41506b;
  --muted: #5e6c84; /* WCAG AA on white/cards */
  --line: rgba(13, 27, 62, 0.09);
  --line-2: rgba(13, 27, 62, 0.14);
  --chip-bg: #eaf1ff;
  --chip-text: #2f6bff;
  --soft-bg: #f1f5fb;
  --shadow-sm: 0 1px 2px rgba(13, 27, 62, 0.05);
  --shadow: 0 1px 2px rgba(13, 27, 62, 0.05), 0 18px 40px -26px rgba(13, 27, 62, 0.28);
}

[data-theme="dark"] {
  --bg: #080d1a;
  --bg-tint: rgba(92, 147, 255, 0.08);
  --card: #0e1626;
  --card-2: #111b2e;
  --text: #eaf1fb;
  --text-2: #b6c6e2;
  --muted: #7e90af;
  --line: rgba(150, 180, 225, 0.12);
  --line-2: rgba(150, 180, 225, 0.2);
  --chip-bg: rgba(92, 147, 255, 0.14);
  --chip-text: #9dbeff;
  --soft-bg: rgba(255, 255, 255, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 50px -28px rgba(0, 0, 0, 0.8);
  --brand: #4d86ff;
}

* { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  /* full-height flex column so the footer is always pinned to the bottom */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

.page-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(80% 50% at 78% -5%, var(--bg-tint), transparent 60%),
    radial-gradient(60% 40% at 5% 0%, var(--bg-tint), transparent 55%);
}

code { font-family: ui-monospace, "SF Mono", monospace; font-size: 0.92em; }

.topbanner {
  position: relative; z-index: 5; text-align: center; font-size: 13px; color: #b06d00;
  padding: 9px 16px;
  background: rgba(217, 138, 22, 0.12);
  border-bottom: 1px solid rgba(217, 138, 22, 0.3);
}

/* ----------------------------- nav ------------------------------------- */
.nav { position: sticky; top: 0; z-index: 20; padding: 16px clamp(14px, 3vw, 28px); }
.nav__inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px 10px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
[data-theme="dark"] .brand__mark { filter: drop-shadow(0 2px 8px rgba(77, 134, 255, 0.5)); }
.brand__word { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; line-height: 1; }
.brand__word b { color: var(--text); }
.brand__word i { color: var(--brand); font-style: normal; }
.brand__word sup { font-size: 8px; color: var(--muted); top: -0.9em; }

.nav__right { display: flex; align-items: center; gap: 10px; }
.themebtn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 999px; cursor: pointer; color: var(--text-2);
  background: var(--soft-bg); border: 1px solid var(--line); transition: all 0.2s ease;
}
.themebtn:hover { color: var(--text); border-color: var(--line-2); }
.themebtn .i-moon { display: none; }
[data-theme="dark"] .themebtn .i-sun { display: none; }
[data-theme="dark"] .themebtn .i-moon { display: block; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding: 7px 13px;
  border-radius: 999px; color: var(--chip-text); background: var(--chip-bg); white-space: nowrap;
}
.chip--soft { color: var(--muted); background: var(--soft-bg); font-weight: 500; }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip__dot--green { background: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }

/* ----------------------------- layout ---------------------------------- */
.layout {
  position: relative; z-index: 1;
  width: 100%; max-width: 1180px; margin: 0 auto;
  /* grow to fill the viewport so the footer is pushed to the bottom */
  flex: 1 0 auto;
  padding: 16px clamp(14px, 3vw, 28px) 30px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 20px; align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.pad { padding: 22px; }

/* ----------------------------- voice ----------------------------------- */
.voice { min-width: 0; padding: clamp(30px, 3.5vw, 46px) clamp(24px, 3vw, 40px); text-align: center; display: flex; flex-direction: column; align-items: center; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand); margin: 0;
}

/* ---- call control (below the orb): Begin / End / Resume ---- */
.call-controls { margin-top: clamp(18px, 2.5vh, 28px); display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-call {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-width: 184px; padding: 13px 26px; border-radius: 999px; border: none; cursor: pointer;
  font-family: var(--font); font-size: 15px; font-weight: 700; color: #fff;
  background: var(--brand); box-shadow: var(--shadow-sm);
  transition: background 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}
.btn-call:hover { background: var(--brand-strong); }
.btn-call:active { transform: translateY(1px); }
.btn-call:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn-call:disabled { opacity: 0.6; cursor: default; }
.btn-call__ic { display: inline-flex; line-height: 0; }
.btn-call .ic-stop { display: none; }
.btn-call[data-variant="stop"] { background: var(--red); }
.btn-call[data-variant="stop"]:hover { background: var(--red); filter: brightness(0.94); }
.btn-call[data-variant="stop"] .ic-start { display: none; }
.btn-call[data-variant="stop"] .ic-stop { display: inline-flex; }

/* ---- GeniusLaw gradient orb ---- */
.orb {
  --level: 0;
  position: relative; width: clamp(196px, 27vw, 248px); aspect-ratio: 1;
  margin: clamp(26px, 3.5vw, 40px) 0 0;
}
.orb__glow {
  position: absolute; inset: -12%; border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 107, 255, 0.5), transparent 66%);
  filter: blur(20px);
  opacity: calc(0.45 + var(--level) * 0.7); transition: opacity 0.12s linear;
}
.orb__sphere {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  background: radial-gradient(135% 135% at 50% 42%, #1c3f93 0%, #11317c 45%, #0a1f56 78%, #07153e 100%);
  box-shadow:
    inset 0 8px 22px rgba(150, 190, 255, 0.22),
    inset 0 -10px 40px rgba(4, 12, 38, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 26px 60px -22px rgba(20, 60, 160, 0.65);
  transform: scale(calc(1 + var(--level) * 0.085));
  transition: transform 0.1s linear;
}
.orb__blob { position: absolute; border-radius: 50%; filter: blur(22px); mix-blend-mode: screen; }
.b1 { width: 76%; height: 76%; left: -10%; top: -8%;  background: radial-gradient(circle, #4f8bff 0%, transparent 66%); animation: blobA 9s ease-in-out infinite; }
.b2 { width: 84%; height: 84%; right: -16%; bottom: -12%; background: radial-gradient(circle, #19a6e6 0%, transparent 66%); animation: blobB 11.5s ease-in-out infinite; }
.b3 { width: 58%; height: 58%; left: 24%; bottom: -6%; background: radial-gradient(circle, #7ce0f2 0%, transparent 70%); animation: blobC 14s ease-in-out infinite; }
.b4 { width: 52%; height: 52%; right: 8%;  top: 4%;  background: radial-gradient(circle, #9fb4ff 0%, transparent 72%); animation: blobA 12s ease-in-out infinite reverse; }
.orb__shade { position: absolute; width: 70%; height: 70%; left: 6%; bottom: 0; border-radius: 50%; filter: blur(24px); background: radial-gradient(circle, #050f2e 0%, transparent 68%); opacity: 0.7; animation: blobB 16s ease-in-out infinite; }

/* the orb holds still while idle/ended (saves battery); it moves during a call */
.orb[data-state="idle"] .orb__blob, .orb[data-state="ended"] .orb__blob,
.orb[data-state="idle"] .orb__shade, .orb[data-state="ended"] .orb__shade { animation-play-state: paused; }
.orb__gloss { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(48% 40% at 36% 24%, rgba(255, 255, 255, 0.22), transparent 60%); }
@keyframes blobA { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(16%, 12%) scale(1.14); } }
@keyframes blobB { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-14%, -10%) scale(1.12); } }
@keyframes blobC { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(10%, -14%) scale(1.18); } }

.orb[data-state="connecting"] .orb__glow { animation: breathe 1.3s ease-in-out infinite; }
.orb[data-state="speaking"] .b1 { animation-duration: 3.4s; }
.orb[data-state="speaking"] .b2 { animation-duration: 4.2s; }
.orb[data-state="speaking"] .b3 { animation-duration: 5s; }
.orb[data-state="speaking"] .b4 { animation-duration: 4.6s; }
.orb[data-state="speaking"] .orb__shade { animation-duration: 6s; }
.orb[data-state="ended"] .orb__sphere { filter: saturate(0.7) brightness(0.95); }
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.95; } }

/* center call control */
.orb__call {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 17px 9px 9px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.94); color: #0b1220;
  font-family: var(--font); font-weight: 600; font-size: 14.5px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 26px rgba(6, 16, 45, 0.4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: transform 0.18s ease, background 0.18s ease;
}
.orb__call:hover { background: #fff; transform: translate(-50%, -50%) translateY(-1.5px); }
.orb__call:active { transform: translate(-50%, -50%); }
.orb__call:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.orb__call-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #0b1220; color: #fff; flex: none; }

.status { font-size: 14.5px; color: var(--text-2); margin: 20px 0 0; min-height: 1.3em; font-weight: 500; }
.status b { color: var(--brand); }

.transcript {
  width: 100%; margin-top: 22px; max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 9px; text-align: left;
}
.transcript__empty {
  text-align: center; color: var(--muted); font-size: 13.5px; margin: 0;
  padding: 20px; border: 1px dashed var(--line-2); border-radius: var(--r-sm);
}
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; animation: rise 0.28s ease both; }
.bubble--agent { align-self: flex-start; background: var(--soft-bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--text); }
.bubble--user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble__who { display: block; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; margin-bottom: 3px; font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----------------------------- workspace ------------------------------- */
.workspace { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card__title { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.02em; }

.client { display: flex; align-items: center; gap: 13px; }
.avatar {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-size: 17px; font-weight: 600; color: #fff;
  background: linear-gradient(140deg, #4d86ff, #1f4fd6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.client__name { font-size: 16.5px; font-weight: 600; margin: 0; }
.client__case { font-size: 13px; color: var(--brand); margin: 2px 0 0; font-weight: 500; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.kv dt { font-size: 13px; color: var(--muted); white-space: nowrap; }
.kv dd { font-size: 13.5px; color: var(--text); margin: 0; text-align: right; font-weight: 500; }
.dd--warn { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 600; }
.dd--warn svg { flex: none; }

/* dropzone */
.dropzone {
  position: relative; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 26px 18px; border-radius: var(--r-sm);
  border: 1.5px dashed var(--line-2); background: var(--card-2); transition: all 0.2s ease;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); background: var(--chip-bg); }
.dropzone:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.dropzone.is-drag { border-color: var(--brand); background: var(--chip-bg); transform: scale(1.01); }
.dropzone__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #4d86ff, #1f4fd6); }
.dropzone__title { font-size: 15px; font-weight: 600; margin: 4px 0 0; }
.dropzone__title span { color: var(--brand); }
.dropzone__hint { font-size: 12px; color: var(--muted); margin: 0; }

.filelist { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.filelist:empty { margin: 0; }
.fileitem { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm); background: var(--card-2); border: 1px solid var(--line); animation: rise 0.28s ease both; }
.fileitem__icon { width: 36px; height: 36px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; color: #fff; background: linear-gradient(140deg, #4d86ff, #1f4fd6); text-transform: uppercase; }
.fileitem__main { flex: 1; min-width: 0; }
.fileitem__name { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fileitem__meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 7px; align-items: center; }
.fileitem__bar { height: 4px; border-radius: 999px; background: var(--soft-bg); overflow: hidden; margin-top: 6px; }
.fileitem__fill { height: 100%; width: 0%; background: var(--brand); transition: width 0.2s linear; }
.fileitem.is-done .fileitem__bar { display: none; }
.fileitem__status { font-weight: 600; }
.fileitem.is-done .fileitem__status { color: var(--green); }
.fileitem__remove { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); background: none; border: none; cursor: pointer; transition: all 0.18s ease; }
.fileitem__remove:hover { color: var(--red); background: rgba(229, 72, 77, 0.12); }

/* footer */
.foot { flex: none; position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; justify-content: center; flex-wrap: wrap; padding: 26px 22px; }
.foot__by { font-size: 13px; color: var(--muted); }
.brand--foot { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.brand--foot .brand__word { font-size: 15px; }

/* ---------------------------- complete intake -------------------------- */
.finish { display: flex; flex-direction: column; gap: 10px; }
.btn-complete {
  width: 100%; padding: 14px 18px; border: none; border-radius: 14px; cursor: pointer;
  font-family: var(--font); font-size: 15px; font-weight: 700; color: #fff;
  background: var(--brand); box-shadow: var(--shadow-sm);
  transition: background 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}
.btn-complete:hover { background: var(--brand-strong); }
.btn-complete:active { transform: translateY(1px); }
.btn-complete:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn-complete:disabled { opacity: 0.6; cursor: default; }
.finish__hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); text-align: center; }

/* --------------------------- confirm modal ----------------------------- */
.modal:not([hidden]) { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8, 13, 26, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal__card {
  position: relative; width: 100%; max-width: 400px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center;
  padding: 28px 26px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); animation: rise 0.24s ease both;
}
.modal__icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: var(--brand); background: var(--chip-bg); }
.modal__title { font-size: 19px; font-weight: 700; margin: 4px 0 0; }
.modal__text { font-size: 14px; line-height: 1.55; color: var(--text-2); margin: 0; }
.modal__actions { display: flex; gap: 10px; width: 100%; margin-top: 18px; }
.modal__actions > * { flex: 1; }
.btn-ghost {
  padding: 14px 18px; border-radius: 14px; cursor: pointer; font-family: var(--font);
  font-size: 15px; font-weight: 600; color: var(--text-2);
  background: var(--soft-bg); border: 1px solid var(--line); transition: all 0.18s ease;
}
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn-ghost:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ------------------------------ thank you ------------------------------ */
/* In-flow (between the nav and footer) — not an overlay, so the nav + footer
   stay visible and it inherits the page's light/dark theme. */
.thanks:not([hidden]) {
  position: relative; z-index: 1; flex: 1 0 auto;
  display: grid; place-items: center;
  padding: 24px clamp(14px, 3vw, 28px) 30px; text-align: center;
}
.thanks__inner {
  width: 100%; max-width: 440px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  padding: 40px 32px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow);
}
.thanks__badge {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: var(--green); box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.15);
}
.thanks__title { font-size: 26px; font-weight: 700; margin: 6px 0 0; }
.thanks__text { font-size: 15px; line-height: 1.6; opacity: 0.8; margin: 0; }
.thanks__small { font-size: 13px; line-height: 1.5; opacity: 0.5; margin: 8px 0 0; }

@media (max-width: 940px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* Desktop: lock the page to the viewport and stretch the GeniusBuddy voice/chat
   panel to fill the full screen height. The transcript (and the right column, if
   tall) scroll internally instead of growing the page. */
@media (min-width: 941px) {
  body { height: 100vh; overflow: hidden; }
  .layout { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .voice { align-self: stretch; min-height: 0; }
  .workspace { align-self: start; min-height: 0; max-height: 100%; overflow-y: auto; }
  .transcript { flex: 1 1 auto; min-height: 0; max-height: none; margin-top: clamp(18px, 2.5vh, 28px); }
  .transcript__empty { margin: auto 0; }
}

.transcript::-webkit-scrollbar { width: 7px; }
.transcript::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }

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