/* ============================================================
   KBC Quiz Portal — Admin Panel Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --sidebar-w:     240px;
  --sidebar-bg:    #0f0f1f;
  --sidebar-border:#1e1e3a;
  --brand-gold:    #f59e0b;
  --accent-blue:   #3b82f6;
  --accent-green:  #10b981;
  --accent-red:    #ef4444;
  --accent-purple: #8b5cf6;
  --bg-body:       #0a0a1a;
  --bg-card:       #13132a;
  --bg-card-hover: #1a1a35;
  --text-primary:  #f0f0ff;
  --text-muted:    #6b7280;
  --border:        #1e1e3a;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --transition:    0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg-body);
  color: var(--text-primary);
}

/* ── Login Page ────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(245,158,11,.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59,130,246,.12) 0%, transparent 50%),
    var(--bg-body);
}

.login-container { width: 100%; max-width: 420px; padding: 24px; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.trophy-icon { font-size: 48px; display: block; }
.login-title { font-size: 22px; font-weight: 700; color: var(--brand-gold); margin: 8px 0 4px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; }

.form-control, .form-select {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  background: rgba(255,255,255,.07);
  border-color: var(--brand-gold);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(245,158,11,.2);
}
.form-control::placeholder { color: var(--text-muted); }

.input-group-text {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.toggle-pass { cursor: pointer; }

.form-label { color: rgba(255,255,255,.8); font-size: 13px; margin-bottom: 6px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.btn-login {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #000;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: all var(--transition);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(245,158,11,.4); color: #000; }

.login-hint { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 16px; }
.login-hint code { background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 4px; color: var(--brand-gold); }

/* ── Layout: Sidebar ───────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-icon { font-size: 22px; }
.brand-text {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-gold);
  letter-spacing: .5px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
  padding: 8px 18px 4px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.sidebar-nav .nav-link.active {
  color: var(--brand-gold);
  background: rgba(245,158,11,.1);
  border-left-color: var(--brand-gold);
}
.sidebar-nav .nav-link.text-danger-custom { color: rgba(239,68,68,.8); }
.sidebar-nav .nav-link.text-danger-custom:hover { color: #ef4444; background: rgba(239,68,68,.1); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(239,68,68,.12);
  color: #ef4444;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid rgba(239,68,68,.2);
}
.logout-btn:hover { background: rgba(239,68,68,.22); color: #ef4444; }

/* ── Layout: Main ──────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.top-bar {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,.08); }

.top-bar-right { display: flex; align-items: center; gap: 12px; }

.admin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245,158,11,.12);
  color: var(--brand-gold);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(245,158,11,.25);
}

.content-area { flex: 1; padding: 28px; }

/* ── Page Header ───────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Cards ─────────────────────────────────────────────── */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-header h5 { font-size: 14px; font-weight: 600; margin: 0; color: var(--text-primary); }

/* ── Stat Cards ────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-color) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--card-color);
  flex-shrink: 0;
}

.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ── Tables ────────────────────────────────────────────── */
.admin-table { color: var(--text-primary); }
.admin-table thead th {
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 12px 16px;
}
.admin-table tbody td {
  border-bottom: 1px solid rgba(255,255,255,.05);
  padding: 12px 16px;
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: rgba(255,255,255,.03); }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ── Status Badges ─────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-waiting  { background: rgba(107,114,128,.2); color: #9ca3af; }
.status-active   { background: rgba(16,185,129,.2); color: #10b981; }
.status-finished { background: rgba(59,130,246,.2); color: #60a5fa; }

/* ── Option Badges ─────────────────────────────────────── */
.option-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.option-A { background: rgba(245,158,11,.2); color: #f59e0b; }
.option-B { background: rgba(59,130,246,.2); color: #60a5fa; }
.option-C { background: rgba(16,185,129,.2); color: #10b981; }
.option-D { background: rgba(139,92,246,.2); color: #a78bfa; }

/* ── Buttons ───────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #000;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,158,11,.35); color: #000; }

.btn-outline-primary {
  border-color: rgba(245,158,11,.4);
  color: var(--brand-gold);
  background: transparent;
  border-radius: var(--radius-sm);
}
.btn-outline-primary:hover { background: rgba(245,158,11,.12); border-color: var(--brand-gold); color: var(--brand-gold); }

.btn-xs { padding: 3px 10px; font-size: 12px; border-radius: 6px; }

/* ── Team Cards ────────────────────────────────────────── */
.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.team-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,.4); }

.team-card-color-bar { height: 4px; background: var(--team-color); }
.team-card-body { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.team-card-avatar {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.team-card-name { font-size: 15px; font-weight: 600; }
.team-card-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.team-card-actions {
  display: flex;
  gap: 8px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
}

/* ── Team & Question Select ────────────────────────────── */
.team-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.question-select-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.question-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.question-select-item:hover { background: rgba(255,255,255,.07); }
.question-select-item.selected { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); }
.question-select-item input { display: none; }
.q-text { flex: 1; font-size: 13px; color: var(--text-primary); }
.q-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.team-select-list { display: flex; flex-direction: column; gap: 6px; }
.team-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--text-primary);
}
.team-select-item:hover { background: rgba(255,255,255,.07); }
.team-select-item:has(input:checked) { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); }
.team-select-item input { display: none; }

/* ── Dashboard specials ────────────────────────────────── */
.team-list { display: flex; flex-direction: column; gap: 8px; }
.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
}
.team-rank { font-weight: 800; font-size: 16px; width: 24px; text-align: center; }
.rank-1 { color: #f59e0b; }
.rank-2 { color: #9ca3af; }
.rank-3 { color: #cd7f32; }
.team-name { flex: 1; font-weight: 500; }
.team-score { font-weight: 700; color: var(--brand-gold); }
.team-dot { width: 10px; height: 10px; border-radius: 50%; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}
.quick-btn:hover { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: var(--brand-gold); transform: translateY(-1px); }

.question-preview { font-weight: 500; margin-bottom: 2px; }

/* ── Color Palette ─────────────────────────────────────── */
.color-palette { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 30px; height: 30px; border-radius: 8px;
  border: 2px solid transparent; cursor: pointer; transition: all var(--transition);
}
.color-swatch:hover, .color-swatch.selected { border-color: #fff; transform: scale(1.15); }
.team-preview-avatar {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
}

/* ── Game Control Specials ─────────────────────────────── */
.current-question-text { font-size: 16px; font-weight: 600; line-height: 1.5; }

.options-grid.ctrl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctrl-option {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
}

.team-pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--tc, var(--border));
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.team-pill:hover, .team-pill.active { background: rgba(245,158,11,.15); border-color: var(--brand-gold); color: var(--brand-gold); }
.tp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tp-score { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

.answer-option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer-opt-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.answer-opt-btn:hover { transform: translateY(-2px); }
.answer-opt-btn.opt-A { border-color: rgba(245,158,11,.3); }
.answer-opt-btn.opt-A:hover { background: rgba(245,158,11,.15); border-color: #f59e0b; color: #f59e0b; }
.answer-opt-btn.opt-B { border-color: rgba(59,130,246,.3); }
.answer-opt-btn.opt-B:hover { background: rgba(59,130,246,.15); border-color: #3b82f6; color: #60a5fa; }
.answer-opt-btn.opt-C { border-color: rgba(16,185,129,.3); }
.answer-opt-btn.opt-C:hover { background: rgba(16,185,129,.15); border-color: #10b981; color: #10b981; }
.answer-opt-btn.opt-D { border-color: rgba(139,92,246,.3); }
.answer-opt-btn.opt-D:hover { background: rgba(139,92,246,.15); border-color: #8b5cf6; color: #a78bfa; }
.answer-opt-btn.correct-reveal { background: rgba(16,185,129,.25) !important; border-color: #10b981 !important; color: #10b981 !important; }
.answer-opt-btn.wrong-reveal   { background: rgba(239,68,68,.25) !important; border-color: #ef4444 !important; color: #ef4444 !important; }
.opt-letter { font-weight: 800; font-size: 15px; }

/* ── Question Queue ────────────────────────────────────── */
.question-queue { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  font-size: 13px;
  transition: all var(--transition);
}
.queue-active { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); }
.queue-done   { opacity: .45; }
.queue-num { font-weight: 700; color: var(--text-muted); min-width: 20px; }
.queue-text { flex: 1; }
.queue-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ── Score Rows ────────────────────────────────────────── */
.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
  margin-bottom: 6px;
  border-left: 3px solid var(--tc, var(--border));
  transition: all var(--transition);
}
.score-rank { font-weight: 800; font-size: 16px; min-width: 22px; }
.score-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.score-name { flex: 1; font-weight: 500; }
.score-val  { font-weight: 700; color: var(--brand-gold); }

/* ── Answer History ────────────────────────────────────── */
.answer-history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  border: 1px solid transparent;
}
.answer-correct { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.2); }
.answer-wrong   { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.2); }
.ah-team { font-weight: 700; }
.ah-q    { flex: 1; color: var(--text-muted); }
.ah-opt  { font-weight: 600; }
.ah-marks{ font-weight: 700; margin-left: auto; }

/* ── Keyboard Hint ─────────────────────────────────────── */
.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}
kbd {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--brand-gold);
}

/* ── Live Indicator ────────────────────────────────────── */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #10b981;
  font-size: 12px;
  font-weight: 600;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 1.5s ease infinite;
}
@keyframes pulse-dot {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: .6; }
}

/* ── Scoreboard Table ──────────────────────────────────── */
#sbMain .sb-table { width: 100%; border-collapse: collapse; }
#sbMain .sb-table th { background: rgba(245,158,11,.1); color: var(--brand-gold); padding: 12px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; text-align: left; }
#sbMain .sb-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
#sbMain .sb-table tbody tr:first-child td { background: rgba(245,158,11,.05); font-weight: 700; }
#sbMain .sb-rank-cell { font-weight: 900; font-size: 18px; }
#sbMain .sb-score-cell { font-weight: 700; font-size: 18px; color: var(--brand-gold); }
#sbMain .sb-correct { color: #10b981; font-weight: 600; }
#sbMain .sb-wrong   { color: #ef4444; font-weight: 600; }

/* ── Alert / Bootstrap Overrides ──────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
}
.alert-success { background: rgba(16,185,129,.15); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge {
  font-weight: 600;
  border-radius: 6px;
}

/* ── Sidebar Collapse ──────────────────────────────────── */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main-content { margin-left: 0; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .content-area { padding: 16px; }
  .answer-option-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
