/* db3 Interview — design tokens follow the portal's module-base.css palette
   so the admin surface visually matches the rest of db3-portal. The candidate
   surface uses the same tokens for consistency. */

:root {
  --bg: #0a0f1a;
  --card: #111b2c;
  --card-h: #182840;
  --border: #1e3350;
  --t1: #e8ecf0;
  --t2: #a0a8b4;
  --t3: #7a8694;
  --accent: #B6622D;
  --accent-h: #d07840;
  --accent-bg: rgba(182, 98, 45, 0.12);
  --green: #4ADE80;
  --red: #EF6B4A;
  --amber: #F59E0B;
  --blue: #3B82F6;
  --purple: #A855F7;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Segoe UI', system-ui, monospace;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--t1);
  font-size: 15px; line-height: 1.55; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
textarea { resize: vertical; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

/* ----- Layout ----- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 26, 0.95); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.3px; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.brand .sub { color: var(--t2); font-weight: 400; }

nav.tabs { display: flex; gap: 4px; }
nav.tabs button {
  background: transparent; border: 1px solid transparent; color: var(--t2);
  padding: 6px 12px; border-radius: 6px; font-size: 14px;
}
nav.tabs button:hover { color: var(--t1); background: var(--card); }
nav.tabs button.active { color: var(--t1); border-color: var(--border); background: var(--card); }
nav.tabs button.active::after {
  content: ''; display: block; height: 2px; background: var(--accent);
  margin: 4px -12px -7px;
}

.auth-pill { font-size: 12px; color: var(--t3); display: flex; align-items: center; gap: 6px; }
.auth-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.auth-pill.ok .dot { background: var(--green); }

main { flex: 1; padding: 24px 20px 60px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ----- Common ----- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
h1 { font-size: 22px; font-weight: 600; margin-bottom: 16px; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--t1); }
h3 { font-size: 14px; font-weight: 600; color: var(--t2); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: var(--t2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--t1);
  padding: 9px 11px; border-radius: 6px; font-size: 14px; transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 80px; line-height: 1.45; }

button.primary, button.secondary, button.ghost, button.danger {
  border: none; padding: 9px 16px; border-radius: 6px; font-size: 14px;
  font-weight: 500; transition: background 0.15s, transform 0.05s;
}
button.primary { background: var(--accent); color: white; }
button.primary:hover { background: var(--accent-h); }
button.primary:disabled { background: var(--card-h); color: var(--t3); cursor: not-allowed; }
button.secondary { background: var(--card-h); color: var(--t1); border: 1px solid var(--border); }
button.secondary:hover { background: var(--border); }
button.ghost { background: transparent; color: var(--t2); }
button.ghost:hover { color: var(--t1); background: var(--card-h); }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
button.danger:hover { background: rgba(239, 107, 74, 0.12); }
button:active:not(:disabled) { transform: translateY(1px); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; }
.badge.green { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.badge.amber { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.badge.red   { background: rgba(239, 107, 74, 0.15); color: var(--red); }
.badge.blue  { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.badge.gray  { background: var(--card-h); color: var(--t2); }
.badge.purple{ background: rgba(168, 85, 247, 0.15); color: var(--purple); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--t3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--t1); }
tr:hover td { background: var(--card-h); }
tr.clickable { cursor: pointer; }

.empty-state { text-align: center; color: var(--t3); padding: 40px 20px; }
.empty-state strong { display: block; color: var(--t2); margin-bottom: 8px; font-size: 16px; }

.toast { position: fixed; bottom: 20px; right: 20px; padding: 12px 18px; background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; max-width: 360px; z-index: 1000; box-shadow: var(--shadow); }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }

.help { font-size: 12px; color: var(--t3); margin-top: 4px; line-height: 1.45; }

/* ----- Persona card ----- */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.persona-card { background: var(--card-h); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.persona-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; background: var(--bg); }
.persona-card .name { font-weight: 600; margin-top: 10px; }
.persona-card .meta { font-size: 12px; color: var(--t3); margin-top: 2px; }
.persona-card audio { width: 100%; margin-top: 8px; }

/* ----- Rubric editor ----- */
.rubric-row { display: grid; grid-template-columns: 2fr 80px 3fr 28px; gap: 8px; align-items: center; margin-bottom: 6px; }
.rubric-row input { padding: 6px 8px; font-size: 13px; }
.rubric-row .x { background: transparent; border: 1px solid var(--border); color: var(--t3); border-radius: 4px; padding: 0; font-size: 16px; line-height: 1; height: 28px; }
.rubric-row .x:hover { color: var(--red); border-color: var(--red); }

.rubric-card { background: var(--card-h); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.rubric-card-header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rubric-card-header input { padding: 6px 8px; font-size: 13px; }
.rubric-card-header > input:nth-of-type(1) { flex: 2; min-width: 140px; }
.rubric-card-header > input:nth-of-type(2) { flex: 1; min-width: 100px; }
.rubric-card-header > select { padding: 6px 8px; font-size: 13px; }
.rubric-card .x { background: transparent; border: 1px solid var(--border); color: var(--t3); border-radius: 4px; padding: 0; font-size: 16px; line-height: 1; height: 28px; width: 28px; margin-left: auto; }
.rubric-card .x:hover { color: var(--red); border-color: var(--red); }

.question-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: start; padding: 10px; background: var(--card-h); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.question-row textarea { font-size: 13px; min-height: 50px; }
.question-row select { padding: 4px 6px; font-size: 12px; }
.question-row input[type=number] { width: 64px; padding: 4px 6px; font-size: 12px; }
.question-row .x { background: transparent; border: 1px solid var(--border); color: var(--t3); border-radius: 4px; padding: 0; font-size: 16px; line-height: 1; height: 28px; width: 28px; }
.question-row .x:hover { color: var(--red); border-color: var(--red); }

details summary { cursor: pointer; }
details summary:hover { color: var(--t1); }

/* ----- Candidate flow ----- */
.candidate-stage { max-width: 720px; margin: 0 auto; }
.interviewer-frame { position: relative; aspect-ratio: 1/1; max-width: 360px; margin: 0 auto 20px; border-radius: 50%; overflow: hidden; border: 2px solid var(--border); background: var(--card); }
.interviewer-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.interviewer-frame.speaking { border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-bg); }
.interviewer-frame .pulse {
  position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--accent); opacity: 0;
}
.interviewer-frame.speaking .pulse { animation: pulse 2s ease-out infinite; }
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}
.question-text {
  text-align: center; font-size: 20px; line-height: 1.5; color: var(--t1);
  padding: 20px; max-width: 600px; margin: 0 auto;
}
.question-meta { text-align: center; color: var(--t3); font-size: 13px; margin-bottom: 20px; }
.recorder-frame { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 24px; }
.recorder-frame video { width: 100%; max-height: 320px; background: var(--bg); border-radius: 8px; }
.recorder-controls { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.record-btn {
  background: var(--red); color: white; border: none; padding: 12px 24px;
  border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.record-btn:hover { background: #d65535; }
.record-btn.recording { background: var(--card-h); color: var(--red); border: 1px solid var(--red); }
.record-btn .blink {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red);
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.timer { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 18px; color: var(--t2); text-align: center; margin-top: 8px; }
.progress-bar { height: 4px; background: var(--card-h); border-radius: 2px; overflow: hidden; margin: 16px 0; }
.progress-bar > div { height: 100%; background: var(--accent); transition: width 0.3s; }

/* ----- Scorecard ----- */
.verdict { display: inline-block; padding: 4px 14px; border-radius: 14px; font-weight: 600; font-size: 13px; letter-spacing: 0.3px; text-transform: uppercase; }
.verdict.strong_hire    { background: rgba(74, 222, 128, 0.2); color: var(--green); }
.verdict.hire           { background: rgba(74, 222, 128, 0.12); color: var(--green); }
.verdict.no_hire        { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.verdict.strong_no_hire { background: rgba(239, 107, 74, 0.15); color: var(--red); }
.score-big {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 48px; font-weight: 600; color: var(--accent); line-height: 1;
}
.score-big .denom { font-size: 22px; color: var(--t3); margin-left: 4px; }
.response-block { background: var(--card-h); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.response-block .q { color: var(--t2); font-size: 13px; margin-bottom: 6px; }
.response-block .a { color: var(--t1); font-size: 14px; margin-bottom: 8px; line-height: 1.55; white-space: pre-wrap; }
.response-block .fb { color: var(--t2); font-size: 13px; font-style: italic; padding-left: 12px; border-left: 2px solid var(--border); }
.response-block video { width: 100%; max-width: 320px; border-radius: 6px; background: var(--bg); margin-top: 8px; }

/* ----- Share modal ----- */
.share-url { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-family: var(--mono); font-size: 13px; word-break: break-all; color: var(--accent); margin: 12px 0; }

/* ----- Upload overlay ----- */
.overlay { position: fixed; inset: 0; background: rgba(10,15,26,0.8); display: flex; align-items: center; justify-content: center; z-index: 200; }
