/* ═══════════════════════════════════════════
   A.I.R.C. Pro — stylesheet
   Aesthetic: Retro-futuristic terminal + dark luxury
═══════════════════════════════════════════ */

:root {
  --bg:        #080c12;
  --surface:   #0d1420;
  --surface2:  #111926;
  --border:    rgba(0,220,180,.12);
  --accent:    #00ddb4;
  --accent2:   #00aaff;
  --danger:    #ff4757;
  --warn:      #ffa502;
  --muted:     #4d6480;
  --text:      #cde0f0;
  --text2:     #7a99b8;
  --font-head: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius:    10px;
  --glow:      0 0 18px rgba(0,221,180,.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
}

/* noise grain overlay */
.noise {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: .4;
}

.app { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 0 20px 40px; }

/* ── TOPBAR ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }
.logo-icon { color: var(--accent); font-size: 22px; }
.logo em { color: var(--accent); font-style: normal; }
.status-pill {
  font-size: 10px; font-family: var(--font-mono); letter-spacing: 2px;
  padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border);
  color: var(--muted); transition: all .3s;
}
.status-pill.running { color: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }

.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 8px; }
.tab {
  padding: 7px 18px; border-radius: 6px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-family: var(--font-head); font-size: 13px; font-weight: 600;
  transition: all .2s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface2); color: var(--accent); box-shadow: var(--glow); }

.perm-chip { font-size: 11px; color: var(--muted); }
.perm-chip.ok { color: var(--accent); }
.perm-chip.err { color: var(--danger); }

/* ── TAB PANELS ── */
.tab-panel { display: none; padding-top: 20px; }
.tab-panel.active { display: block; }

/* ── CARD ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}

/* ── INTERVIEW GRID ── */
.interview-grid {
  display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start;
}
.col-left { display: flex; flex-direction: column; gap: 12px; }
.col-right { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }

/* ── VIDEO CARD ── */
.video-card { padding: 0; overflow: hidden; }
.video-wrap { position: relative; height: 320px; background: #000; }
video { width: 100%; height: 100%; object-fit: cover; display: block; }
canvas { position: absolute; inset: 0; }
.no-cam {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #050c18, #0a1425);
  color: var(--muted);
}
.cam-icon { font-size: 48px; opacity: .3; }

/* waveform */
.waveform {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 3px; height: 28px; opacity: 0;
  transition: opacity .4s;
}
.waveform.active { opacity: 1; }
.waveform span {
  display: block; width: 4px; border-radius: 2px;
  background: var(--accent); height: 6px;
  animation: wavebar 1.2s ease-in-out infinite;
}
.waveform span:nth-child(2) { animation-delay: .1s; }
.waveform span:nth-child(3) { animation-delay: .2s; }
.waveform span:nth-child(4) { animation-delay: .3s; }
.waveform span:nth-child(5) { animation-delay: .4s; }
.waveform span:nth-child(6) { animation-delay: .3s; }
.waveform span:nth-child(7) { animation-delay: .2s; }
.waveform span:nth-child(8) { animation-delay: .1s; }
.waveform span:nth-child(9) { animation-delay: .05s; }
.waveform span:nth-child(10) { animation-delay: 0s; }
@keyframes wavebar {
  0%, 100% { height: 4px; }
  50% { height: 22px; }
}

.timer-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.65); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 20px; font-size: 13px;
  font-family: var(--font-mono); color: var(--accent); letter-spacing: 1px;
  display: none;
}

/* ── SETUP CARD ── */
.setup-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
@media (max-width: 760px) { .setup-row { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
select {
  width: 100%; padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-family: var(--font-mono); font-size: 12px;
  cursor: pointer; outline: none; transition: border-color .2s;
}
select:focus { border-color: var(--accent); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── BUTTONS ── */
.btn {
  padding: 9px 16px; border-radius: 7px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; transition: all .18s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .3; cursor: default; }
.btn.primary {
  background: linear-gradient(135deg, #003d30, #005040);
  border-color: var(--accent); color: var(--accent);
}
.btn.primary:hover:not(:disabled) { box-shadow: var(--glow); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: rgba(255,71,87,.1); }
.btn.accent { border-color: var(--accent2); color: var(--accent2); }
.btn.sm { padding: 6px 12px; font-size: 11px; }

/* ── PERM BANNER ── */
.perm-banner { border-color: rgba(255,71,87,.3); }
.banner-title { font-family: var(--font-head); font-weight: 700; color: var(--danger); margin-bottom: 6px; }
.banner-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── QUESTION CARD ── */
.q-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-badge {
  font-size: 10px; letter-spacing: 1px; background: rgba(0,221,180,.07);
  border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px;
  color: var(--accent); white-space: nowrap;
}
.q-progress-wrap { flex: 1; height: 3px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.q-progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width .5s ease; width: 0%; }
.q-timer { font-size: 12px; color: var(--warn); white-space: nowrap; }
.q-timer.urgent { color: var(--danger); animation: blink .7s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.q-text { font-family: var(--font-head); font-size: 16px; font-weight: 600; line-height: 1.5; color: #e8f4ff; }
.hint-chip {
  margin-top: 8px; padding: 5px 10px; border-radius: 6px;
  background: rgba(0,170,255,.07); border: 1px solid rgba(0,170,255,.2);
  font-size: 11px; color: var(--accent2);
}
.answer-label { font-size: 10px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 12px; margin-bottom: 5px; }
.current-answer {
  padding: 10px; border-radius: 7px; background: rgba(0,221,180,.03);
  border: 1px solid var(--border); min-height: 52px;
  font-size: 13px; line-height: 1.6; color: var(--text2);
}
textarea {
  width: 100%; padding: 9px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-family: var(--font-mono); font-size: 12px;
  resize: vertical; outline: none; transition: border-color .2s;
}
textarea:focus { border-color: var(--accent); }

/* ── METRICS (right col) ── */
.metric-card { padding: 12px 14px; }
.metric-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.metric-value { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--accent); }
.metric-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
.metric-bar-wrap { height: 3px; background: var(--surface2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.metric-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; width: 0%; }

/* SCORE RING */
.score-ring-wrap { position: relative; width: 80px; height: 80px; margin: 6px 0; }
.score-ring { width: 80px; height: 80px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface2); stroke-width: 6; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .6s ease, stroke .3s; }
.score-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 18px; font-weight: 800; color: var(--accent); }

.transcript-card { }
.transcript-box { height: 180px; overflow-y: auto; font-size: 12px; line-height: 1.8; color: var(--text2); padding-right: 4px; }
.transcript-box::-webkit-scrollbar { width: 3px; }
.transcript-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.notes-box { font-size: 12px; color: var(--text2); line-height: 1.7; }

/* ── HISTORY ── */
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.history-header h2 { font-family: var(--font-head); font-size: 20px; font-weight: 800; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.session-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 12px; cursor: pointer; transition: border-color .2s;
}
.session-card:hover { border-color: var(--accent); }
.session-date { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.session-title { font-family: var(--font-head); font-weight: 700; font-size: 14px; color: var(--text); }
.session-chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chip {
  font-size: 10px; padding: 2px 8px; border-radius: 20px;
  background: rgba(0,221,180,.06); border: 1px solid var(--border); color: var(--muted);
}
.chip.hi { color: var(--accent); border-color: rgba(0,221,180,.3); }
.session-score { font-family: var(--font-head); font-size: 32px; font-weight: 800; color: var(--accent); text-align: right; }
.score-grade { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.session-actions { display: flex; gap: 6px; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; line-height: 2; }

/* ── ANALYTICS ── */
.analytics-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.analytics-card { text-align: center; }
.analytics-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.analytics-big { font-family: var(--font-head); font-size: 40px; font-weight: 800; color: var(--accent); }
.span2 { grid-column: span 2; text-align: left; }
canvas { width: 100% !important; }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,10,20,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(6px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; max-width: 700px; width: 95%; max-height: 85vh; overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 14px; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 18px; transition: color .2s;
}
.modal-close:hover { color: var(--danger); }
.modal-section { margin-bottom: 18px; }
.modal-section h3 { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--accent2); margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.modal-meta-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.modal-meta-item { background: var(--surface2); border-radius: 7px; padding: 10px; }
.modal-meta-label { font-size: 10px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.modal-meta-val { font-family: var(--font-head); font-size: 20px; font-weight: 800; color: var(--accent); }
.modal-qa { display: flex; flex-direction: column; gap: 10px; }
.modal-qa-item { background: var(--surface2); border-radius: 7px; padding: 12px; }
.modal-qa-q { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.modal-qa-a { font-size: 13px; color: var(--text); line-height: 1.6; }
.modal-transcript { font-size: 12px; color: var(--text2); line-height: 1.8; max-height: 180px; overflow-y: auto; }

/* ── TOASTS ── */
#toastContainer { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; font-size: 12px; color: var(--text);
  animation: toastIn .3s ease; max-width: 280px;
}
.toast.ok { border-color: var(--accent); }
.toast.err { border-color: var(--danger); }
@keyframes toastIn { from { transform: translateX(30px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .interview-grid { grid-template-columns: 1fr; }
  .col-right { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .setup-row { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: span 2; }
}
@media (max-width: 520px) {
  .tabs .tab { padding: 6px 10px; font-size: 11px; }
  .analytics-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .col-right { grid-template-columns: 1fr; }
}

/* ── WELCOME CARD ── */
.welcome-card { background: linear-gradient(135deg, rgba(0,221,180,.07), rgba(0,170,255,.05)); }
.welcome-card h2 { font-family: var(--font-head); font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.welcome-sub { font-size: 12px; color: var(--text2); line-height: 1.7; margin-bottom: 14px; }
.welcome-checklist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.w-item { font-size: 12px; color: var(--text); background: var(--surface2); border-radius: 7px; padding: 9px 12px; }
.w-item b { color: var(--accent); margin-right: 6px; }

/* ── ROUND STEPPER ── */
.round-stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.round-step {
  display: flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: .5px;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px 6px 8px; white-space: nowrap; transition: all .25s;
}
.round-step span {
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
}
.round-step.active { color: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }
.round-step.active span { background: var(--accent); color: #06110d; }
.round-step.done { color: var(--accent2); }
.round-step.done span { background: var(--accent2); color: #06110d; }
.round-step.done::after { content: '✓'; margin-left: 2px; color: var(--accent2); }

/* ── INTRO RESULT BANNER ── */
.intro-banner { border-color: rgba(0,221,180,.3); }
.intro-banner.warn { border-color: rgba(255,165,2,.4); }
.intro-banner-title { font-family: var(--font-head); font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.intro-checklist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.intro-check-chip { font-size: 10px; padding: 4px 9px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); }
.intro-check-chip.pass { color: var(--accent); border-color: rgba(0,221,180,.35); }
.intro-check-chip.fail { color: var(--text2); }

/* ── COMPANY / CATEGORY BADGES ── */
.round-label {
  display: inline-block; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent2); background: rgba(0,170,255,.08); border: 1px solid rgba(0,170,255,.25);
  border-radius: 20px; padding: 3px 10px; margin-bottom: 8px;
}

/* ── ANSWER FEEDBACK / LEARNING MODE ── */
.answer-feedback { margin-top: 14px; padding: 12px; background: var(--surface2); border-radius: 8px; border-left: 3px solid var(--accent2); font-size: 12px; }
.answer-feedback h4 { font-family: var(--font-head); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent2); margin-bottom: 8px; }
.af-score-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.af-score-chip { font-size: 10px; padding: 3px 8px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); color: var(--text2); }
.af-score-chip b { color: var(--accent); }
.af-block { margin-top: 8px; line-height: 1.6; color: var(--text2); }
.af-block b { color: var(--text); }

/* ── CODING ROUND ── */
.coding-card h3 { margin-bottom: 6px; }
.code-editor {
  width: 100%; margin-top: 10px; background: #060a10; color: #cde0f0; border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  resize: vertical; outline: none;
}
.code-editor:focus { border-color: var(--accent); }
.code-results { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.code-test-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; background: var(--surface2); border-radius: 6px; }
.code-test-row.pass { border-left: 3px solid var(--accent); }
.code-test-row.fail { border-left: 3px solid var(--danger); }
.code-summary { font-family: var(--font-head); font-weight: 800; font-size: 14px; margin-top: 4px; }

/* ── FEEDBACK CARD ── */
.feedback-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin: 16px 0; }
.feedback-grid .fb-item { background: var(--surface2); border-radius: 8px; padding: 12px; text-align: center; }
.feedback-grid .fb-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.feedback-grid .fb-val { font-family: var(--font-head); font-size: 22px; font-weight: 800; color: var(--accent); }
.feedback-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
.feedback-cols h3 { font-family: var(--font-head); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent2); margin-bottom: 8px; }
.feedback-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.feedback-list li { font-size: 12px; color: var(--text2); background: var(--surface2); border-radius: 6px; padding: 8px 10px; line-height: 1.5; }
@media (max-width: 700px) { .feedback-cols { grid-template-columns: 1fr; } }

/* ── DASHBOARD ── */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.dash-hero { grid-column: span 2; display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; text-align: center; }
.dash-unit { font-size: 14px; color: var(--muted); margin-left: 2px; }
.badge-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-pill {
  display: flex; align-items: center; gap: 7px; font-size: 11px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px; padding: 7px 12px; color: var(--text);
}
.badge-pill .b-icon { font-size: 15px; }
.topic-list { display: flex; flex-direction: column; gap: 7px; }
.topic-row { display: flex; justify-content: space-between; font-size: 12px; background: var(--surface2); border-radius: 6px; padding: 8px 10px; }
.topic-row b { color: var(--accent); }
.dash-period-row { font-size: 13px; color: var(--text2); margin-top: 6px; }
.dash-period-row span { color: var(--accent); font-weight: 700; }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } .dash-hero { grid-column: span 1; grid-template-columns: repeat(2,1fr); } }

/* ── RESUME CHIP ── */
#resumeStatus.ok { color: var(--accent); border-color: rgba(0,221,180,.3); }
