/* =============================================================================
 *  styles.css — AautoMeet production styles
 *  -------------------------------------------------------------------------
 *  Notes:
 *    • CSS variables so we can theme later without a touch of every file.
 *    • All measurements in rem so text scales with the user's settings.
 *    • No CSS framework, no preprocessor — this file is what ships.
 *  Style heritage:
 *    Same tokens as NorCompliance (modules/aautomeeting.js): dark navy,
 *    cream ink, teal accent, Syne + DM Sans.
 * ========================================================================== */

:root {
  --bg:       #0D1B2E;
  --card:     #132236;
  --card-2:   #1A2D45;
  --ink:      #F7F6F2;
  --muted:    rgba(247,246,242,0.62);
  --line:     rgba(255,255,255,0.08);
  --accent:   #00C6A2;
  --warn:     #FFB347;
  --danger:   #FF6B6B;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: radial-gradient(1200px 800px at 70% -10%, #1A2D45 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit; color: inherit;
}

button {
  background: transparent; border: 1px solid var(--line);
  padding: 10px 16px; border-radius: var(--r-pill);
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s, background 0.15s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
  font-weight: 700;
}
button.danger {
  background: var(--danger); color: var(--bg); border-color: var(--danger);
  font-weight: 700;
}
button.ghost { border-color: var(--line); }
button[disabled] { opacity: 0.4; cursor: not-allowed; }

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
h1 { font-weight: 800; font-size: 2.2rem; line-height: 1.1; }
h2 { font-weight: 700; font-size: 1.4rem; }
h3 { font-weight: 600; font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- Shell ----------------------------------------------------- */
.app {
  max-width: 1080px; margin: 0 auto;
  padding: 28px 24px 48px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 8px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem;
}
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 16px var(--accent);
}
.nav-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: 0.82rem; color: var(--muted);
}
.nav-pill .live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}

/* ---------- Screens --------------------------------------------------- */
.screen { display: none; flex: 1; }
.screen.is-active {
  display: flex; flex-direction: column; gap: 24px;
  animation: fade-in 0.25s ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Card ------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
}

/* ---------- Form ------------------------------------------------------ */
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid-two { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--muted); }
.field input, .field select {
  background: var(--card-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--r-sm); padding: 10px 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 13px; border: 1px solid var(--line);
  border-radius: var(--r-pill); cursor: pointer; font-size: 0.85rem;
  background: var(--card-2); transition: all 0.15s;
  user-select: none;
}
.chip:hover { background: var(--card); }
.chip.is-on {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
  font-weight: 700;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }

/* ---------- Photo capture -------------------------------------------- */
.photo-tile {
  position: relative;
  width: 100%; max-width: 360px; margin: 0 auto;
  aspect-ratio: 4/3; border-radius: var(--r-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 30% 25%, rgba(247,246,242,0.06), transparent 60%),
    linear-gradient(135deg, #2C4263, #1A2D45);
  display: grid; place-items: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.28), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.photo-tile video, .photo-tile img, .photo-tile canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.photo-tile.is-captured {
  background: linear-gradient(135deg, #00C6A2, #1A2D45);
}
.photo-tile .ring {
  position: absolute; inset: 14px;
  border: 2px dashed rgba(247,246,242,0.18);
  border-radius: var(--r-lg);
  pointer-events: none; z-index: 2;
}
.photo-tile.is-captured .ring { border-color: rgba(0,198,162,0.5); }
.photo-tile .avatar-fallback {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #2C4263);
  display: grid; place-items: center;
  color: var(--bg); font-family: var(--font-display); font-weight: 800;
  font-size: 2.2rem;
  z-index: 1;
}
.photo-hints {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 14px;
}
.photo-hints .hint-chip {
  font-size: 0.78rem; color: var(--muted);
  padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--card-2);
}
.photo-hints .hint-chip.is-met {
  color: var(--accent); border-color: rgba(0,198,162,0.35);
  background: rgba(0,198,162,0.08);
}
.step-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--muted);
  padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-pill);
}

/* ---------- Lobby ----------------------------------------------------- */
.lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 800px) { .lobby { grid-template-columns: 1fr; } }
.self-tile {
  position: relative; overflow: hidden;
  background:
    radial-gradient(60% 50% at 30% 25%, rgba(247,246,242,0.06), transparent 60%),
    linear-gradient(135deg, #2C4263, #1A2D45);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  aspect-ratio: 4/3;
  display: grid; place-items: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.28), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.self-tile video {
  width: 100%; height: 100%; object-fit: cover;
  /* mirror our own preview only — peer video is shown un-mirrored */
  transform: scaleX(-1);
}
.self-tile::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 50%, transparent 60%, rgba(13,27,46,0.5));
  pointer-events: none;
}
.hd-corner {
  position: absolute; top: 14px; left: 14px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(13,27,46,0.55); border: 1px solid var(--line);
  font-size: 0.74rem; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 6px; z-index: 2;
}
.hd-corner .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.matching-line {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  color: var(--muted); font-size: 0.92rem;
}
.dots span {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 4px;
  animation: bounce 1.2s infinite;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.match-summary {
  margin-top: 14px; padding: 14px; border: 1px dashed var(--line);
  border-radius: var(--r-md); font-size: 0.88rem; color: var(--muted);
}

/* ---------- Preview (mutual consent) --------------------------------- */
.preview-stage {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
@media (max-width: 800px) { .preview-stage { grid-template-columns: 1fr; } }
.peer-preview {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #2A4565, #14233a);
  aspect-ratio: 4/3;
  filter: blur(18px) saturate(0.85);
  transition: filter 0.3s;
}
.peer-preview.is-revealing { filter: blur(0) saturate(1); }
.peer-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.peer-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.peer-id {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
}
.consent-meter {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px; border-radius: var(--r-md);
  background: var(--card-2); border: 1px solid var(--line);
}
.consent-meter .you, .consent-meter .them {
  display: flex; align-items: center; gap: 8px; font-size: 0.85rem;
}
.consent-meter .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.consent-meter .dot.is-yes {
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.countdown {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.6rem; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- In-call --------------------------------------------------- */
.call { display: grid; grid-template-rows: 1fr auto; gap: 16px; min-height: 540px; }
.call-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(60% 50% at 30% 25%, rgba(247,246,242,0.06), transparent 60%),
    linear-gradient(70% 60% at 70% 80%, rgba(0,198,162,0.07), transparent 60%),
    linear-gradient(135deg, #2A4565, #14233a 70%);
  min-height: 560px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.32), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.call-stage video.peer {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.call-stage::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 50%, transparent 60%, rgba(13,27,46,0.55));
  pointer-events: none;
}
.peer-name {
  position: absolute; left: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 2px; z-index: 2;
}
.peer-name b { font-family: var(--font-display); font-size: 1.1rem; }
.ai-status {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-pill);
  font-size: 0.82rem; background: rgba(0,198,162,0.16);
  border: 1px solid rgba(0,198,162,0.4); color: var(--accent);
}
.ai-status .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.hd-badge {
  position: absolute; top: 16px; right: 92px; z-index: 2;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(13,27,46,0.6); border: 1px solid var(--line);
  color: var(--ink); font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 6px;
}
.hd-badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.timer {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(13,27,46,0.6); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; font-size: 0.85rem;
}
.self-pip {
  position: absolute; right: 16px; bottom: 16px; z-index: 2;
  width: 200px; aspect-ratio: 4/3; border-radius: var(--r-md);
  background: linear-gradient(135deg, #2C4263, #1A2D45);
  border: 1px solid var(--line);
  overflow: hidden;
}
.self-pip video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.call-controls {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.ctrl {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card-2);
  display: grid; place-items: center; font-size: 1.2rem;
  cursor: pointer;
}
.ctrl.is-on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.ctrl.danger { background: var(--danger); color: var(--bg); border-color: var(--danger); }
.ctrl-label {
  width: 56px; text-align: center; font-size: 0.7rem; color: var(--muted); margin-top: 4px;
}
.ctrl-stack { display: flex; flex-direction: column; align-items: center; }

/* ---------- Misc ------------------------------------------------------ */
.legal {
  margin-top: auto; padding-top: 20px; color: var(--muted);
  font-size: 0.78rem; text-align: center;
}
kbd {
  display: inline-block;
  font: 600 0.75rem var(--font-body);
  background: var(--card-2); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 6px;
  color: var(--ink); margin-left: 4px;
}
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 12px 18px;
  font-size: 0.88rem; z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  display: none;
}
.toast.is-open { display: block; animation: fade-in 0.2s ease; }
.toast.is-error { border-color: rgba(255,107,107,0.5); color: var(--danger); }
