/* ================================================================
   AI Screener — Dark Theme Wizard UI
   ================================================================ */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #22252f;
  --bg-input: #2a2d3a;
  --border: #333848;
  --border-focus: #5b8def;
  --text-primary: #e4e6eb;
  --text-secondary: #9ca3b0;
  --text-muted: #6b7280;
  --accent: #5b8def;
  --accent-hover: #4a7de0;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-hover: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header h1 { font-size: 18px; font-weight: 600; }
.header h1 span { color: var(--accent); }
.header-nav a {
  color: var(--text-secondary);
  margin-left: 20px;
  font-size: 14px;
}
.header-nav a:hover { color: var(--text-primary); text-decoration: none; }

/* ---- Container ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-success { background: var(--success); color: #000; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2, .card h3 {
  margin-bottom: 16px;
  font-weight: 600;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
input[type="text"], input[type="number"], input[type="email"],
input[type="tel"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}
textarea { resize: vertical; min-height: 120px; }

/* ---- Wizard Step Indicator ---- */
.wizard-steps {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}
.wizard-step {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 2px solid transparent;
  font-size: 12px;
  color: var(--text-muted);
  cursor: default;
  transition: all 0.2s;
}
.wizard-step .step-num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}
.wizard-step.active {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--text-primary);
}
.wizard-step.completed {
  background: rgba(52, 211, 153, 0.1);
  border-color: var(--success);
  color: var(--success);
}
.wizard-step.clickable { cursor: pointer; }
.wizard-step.clickable:hover { background: var(--bg-card); }

/* ---- Wizard Navigation ---- */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg-input);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tr:hover { background: rgba(91, 141, 239, 0.05); }

/* ---- File Upload ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-secondary);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.05);
}
.upload-zone .icon { font-size: 36px; margin-bottom: 8px; display: block; }
.upload-zone p { font-size: 14px; }
.upload-zone .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- File list ---- */
.file-list { list-style: none; margin-top: 16px; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 14px;
}
.file-item .file-name { flex: 1; }
.file-item .file-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 12px;
}
.file-item .file-status.parsed { background: rgba(52,211,153,0.15); color: var(--success); }
.file-item .file-status.pending { background: rgba(251,191,36,0.15); color: var(--warning); }
.file-item .file-status.error { background: rgba(248,113,113,0.15); color: var(--danger); }

/* ---- Badge / Tags ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
}
.badge-pass { background: rgba(52,211,153,0.15); color: var(--success); }
.badge-fail { background: rgba(248,113,113,0.15); color: var(--danger); }
.badge-pending { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-info { background: rgba(91,141,239,0.15); color: var(--accent); }

/* ---- Rating bar ---- */
.rating-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.rating-bar .bar {
  width: 80px;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.rating-bar .bar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ---- Questions editor ---- */
.question-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.question-item .q-num {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.question-item .q-text { flex: 1; font-size: 14px; }
.question-item .q-text textarea {
  min-height: 40px;
  padding: 6px 10px;
}
.question-item .q-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.question-item .q-source {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Progress / Spinner ---- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

/* ---- SSE Log ---- */
.sse-log {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.8;
}
.sse-log .log-entry { color: var(--text-secondary); }
.sse-log .log-entry.success { color: var(--success); }
.sse-log .log-entry.error { color: var(--danger); }
.sse-log .log-entry.info { color: var(--accent); }

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}
.toast-success { background: var(--success); color: #000; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--accent); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Sessions list (landing page) ---- */
.session-list { list-style: none; }
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: background 0.2s;
}
.session-item:hover { background: var(--bg-card); }
.session-item .session-meta { color: var(--text-secondary); font-size: 13px; }
.session-item .session-step { font-size: 12px; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 16px; margin-bottom: 16px; }

/* ---- Inline edit ---- */
.editable { cursor: text; }
.editable:hover { background: rgba(91,141,239,0.08); border-radius: 4px; }

/* ---- Collapsible candidate edit panel ---- */
.cedit-toggle {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  font-family: inherit;
}
.cedit-toggle:hover { text-decoration: underline; }
.cedit-panel {
  display: none;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 8px;
  margin-bottom: 8px;
}
.cedit-panel.open { display: block; }
.cedit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.cedit-grid .form-group { margin-bottom: 0; }
.cedit-grid input { padding: 6px 10px; font-size: 13px; }
.cedit-grid label { font-size: 12px; margin-bottom: 3px; }
@media (max-width: 768px) { .cedit-grid { grid-template-columns: 1fr; } }

/* ---- Transcript panel ---- */
.transcript-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.8;
}

/* ---- Verdict cards ---- */
.verdict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.verdict-card {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
}
.verdict-card.pass { border-color: var(--success); }
.verdict-card.fail { border-color: var(--danger); }
.verdict-card .candidate-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.verdict-card .verdict-label {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.verdict-card .verdict-label.pass { color: var(--success); }
.verdict-card .verdict-label.fail { color: var(--danger); }

/* ---- Settings panel (inline collapsible) ---- */
.settings-toggle {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.settings-toggle:hover { color: var(--text-secondary); }
.settings-panel {
  display: none;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.settings-panel.open { display: block; }
.settings-panel .form-group { margin-bottom: 12px; }
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .wizard-steps { gap: 2px; }
  .wizard-step { min-width: 70px; padding: 8px 4px; font-size: 10px; }
  .wizard-step .step-num { font-size: 14px; }
  .settings-row { grid-template-columns: 1fr; }
  .verdict-grid { grid-template-columns: 1fr; }
}
