/**
 * Quiz & Buzzer System Design System
 * Theme: Premium Dark Glassmorphism with High-Contrast Game-Show Accents
 */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-glass: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.25);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;
  --accent-purple: #8b5cf6;

  /* Button Choice Colors */
  --btn-a: #ef4444; /* Red */
  --btn-b: #3b82f6; /* Blue */
  --btn-c: #f59e0b; /* Yellow/Amber */
  --btn-d: #10b981; /* Green */

  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-dot.online {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-dot.active {
  background-color: var(--accent-amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

/* Layout Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  flex: 1;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards & Panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-indigo);
  color: white;
}
.btn-primary:hover {
  background: #4f46e5;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--accent-emerald);
  color: white;
}
.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--accent-amber);
  color: #111827;
}
.btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--accent-rose);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1.1rem;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Question Banner */
.question-hero {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(17, 24, 39, 0.95));
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.question-category {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #818cf8;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  color: #ffffff;
  margin-bottom: 1.5rem;
}

/* Choices Grid */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .choices-grid {
    grid-template-columns: 1fr;
  }
}

.choice-box {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
  position: relative;
}

.choice-letter {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}

.choice-box.choice-a .choice-letter { background: var(--btn-a); }
.choice-box.choice-b .choice-letter { background: var(--btn-b); }
.choice-box.choice-c .choice-letter { background: var(--btn-c); }
.choice-box.choice-d .choice-letter { background: var(--btn-d); }

.choice-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: #e2e8f0;
}

.choice-box.is-correct {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.18);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.choice-box.is-correct::after {
  content: "✓ CORRECT";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--accent-emerald);
}

/* Remote Matrix (8 Buzzers Grid) */
.remotes-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .remotes-matrix {
    grid-template-columns: repeat(2, 1fr);
  }
}

.remote-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: all 0.25s ease;
}

.remote-card.winner {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
  animation: pulseWinner 1.5s infinite;
}

@keyframes pulseWinner {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.remote-card.buzzed {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.1);
}

.remote-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remote-badge {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: white;
}

.remote-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  border: none;
  background: transparent;
  width: 100%;
}

.remote-name:focus {
  outline: 1px solid var(--accent-indigo);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 2px 4px;
}

.remote-score {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-btns {
  display: flex;
  gap: 0.3rem;
}

.remote-buzz-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 0.25rem;
}

.remote-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Serial Log Console */
.serial-log {
  background: #050811;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  height: 180px;
  overflow-y: auto;
  color: #38bdf8;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.log-entry {
  white-space: pre-wrap;
  word-break: break-all;
}

.log-entry.buzz { color: #4ade80; }
.log-entry.error { color: #f87171; }
.log-entry.cmd { color: #fbbf24; }

/* Control Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Timer Display */
.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
