/* =====================================================================
   CSUN Campus Map Quiz — Stylesheet
   CSUN branded: red, black, white — dark & sleek
   ===================================================================== */

/* ===================== CSS VARIABLES ===================== */
:root {
  --bg:         #0d0d0d;
  --panel-bg:   #141414;
  --surface:    #1c1c1c;
  --accent:     #cc0000;      /* CSUN red */
  --accent-dim: #991111;
  --green:      #22c55e;
  --red-wrong:  #ef4444;
  --text:       #f0f0f0;
  --muted:      #888888;
  --border:     #2a2a2a;
  --panel-w:    300px;
  --radius:     6px;
}

/* ===================== RESET / BASE ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===================== HEADER ===================== */
header {
  background: var(--panel-bg);
  border-bottom: 2px solid var(--accent);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  z-index: 1000;
  position: relative;
}

/* Red left bar accent on header */
header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 56px;
  background: var(--accent);
}

.header-logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.header-logo span {
  color: var(--accent);
}

.header-subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 500;
}

.header-stats {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.stat-box {
  text-align: center;
  background: var(--surface);
  padding: 5px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-width: 68px;
  position: relative;
  overflow: hidden;
}

/* Subtle red top line on stat boxes */
.stat-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.5;
}

.stat-box .val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.stat-box .lbl {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1px;
}

/* Individual stat colors */
#timer-val   { color: #f0f0f0;          }
#correct-val { color: var(--green);     }
#wrong-val   { color: var(--red-wrong); }
#streak-val  { color: var(--accent);    }

/* ===================== MAIN LAYOUT ===================== */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===================== SIDE PANEL ===================== */
#side-panel {
  width: var(--panel-w);
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-section h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Current question */
#current-q {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: 0.3px;
}

#q-number {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ===================== PROGRESS DOTS ===================== */
.progress-dots {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}

.dot {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.dot.correct { background: var(--green);     }
.dot.wrong   { background: var(--red-wrong); }
.dot.active  {
  background: var(--accent);
  animation: pulse-dot 1s infinite alternate;
}

@keyframes pulse-dot {
  from { opacity: 1;   }
  to   { opacity: 0.3; }
}

/* ===================== FEEDBACK MESSAGE ===================== */
#feedback {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  display: none;
  letter-spacing: 0.2px;
}

#feedback.correct {
  background: rgba(34, 197, 94, 0.08);
  border-color: var(--green);
  color: var(--green);
  display: block;
}

#feedback.wrong {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--red-wrong);
  color: var(--red-wrong);
  display: block;
}

/* ===================== ANSWER LOG ===================== */
#answer-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#answer-log::-webkit-scrollbar       { width: 3px; }
#answer-log::-webkit-scrollbar-track { background: transparent; }
#answer-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.log-item {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  border-left: 3px solid transparent;
  animation: slide-in 0.25s ease;
  background: var(--surface);
}

@keyframes slide-in {
  from { transform: translateX(-8px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.log-item.correct { border-left-color: var(--green);     }
.log-item.wrong   { border-left-color: var(--red-wrong); }

.log-item .loc-name {
  font-weight: 600;
  color: var(--text);
}

.log-item .loc-result {
  font-size: 0.75rem;
  margin-top: 2px;
}

.log-item.correct .loc-result { color: var(--green);     }
.log-item.wrong   .loc-result { color: var(--red-wrong); }

/* ===================== MAP CONTAINER ===================== */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ===================== MAP HINT BANNER ===================== */
#map-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.5px;
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
}

/* ===================== STREAK TOAST ===================== */
#streak-toast {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  z-index: 900;
  background: var(--accent);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 20px;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

#streak-toast.show {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* ===================== GAME OVER OVERLAY ===================== */
#game-over-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.75);
  justify-content: center;
  align-items: center;
  animation: fade-in 0.3s ease;
}

#game-over-overlay.show { display: flex; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Score card */
.score-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  padding: 36px 44px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.score-card h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.score-big {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  margin: 8px 0;
  letter-spacing: -1px;
}

.score-big .c   { color: var(--green);     }
.score-big .sep { color: var(--border);    font-size: 3rem; }
.score-big .w   { color: var(--red-wrong); }

.score-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.time-taken {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 4px;
}

/* High score row */
.hs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.25);
}

.hs-row span   { font-size: 0.8rem; color: var(--accent); }
.hs-row strong {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
}

/* ===================== GRADE BADGE ===================== */
.grade {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.8rem;
  font-weight: 900;
  padding: 4px 20px;
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.grade.A { background: rgba(34, 197, 94, 0.1);  color: var(--green);     }
.grade.B { background: rgba(34, 197, 94, 0.08); color: #16a34a;          }
.grade.C { background: rgba(234, 179, 8, 0.1);  color: #ca8a04;          }
.grade.D { background: rgba(249, 115, 22, 0.1); color: #ea580c;          }
.grade.F { background: rgba(239, 68, 68, 0.1);  color: var(--red-wrong); }

/* ===================== BUTTONS ===================== */
.btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 28px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

.btn:hover  { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-ghost {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

/* MAP FLASH ANIMATIONS */
@keyframes map-flash-green {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(1.15) hue-rotate(60deg) saturate(1.5); }
  100% { filter: brightness(1); }
}

@keyframes map-flash-red {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(1.1) hue-rotate(-15deg) saturate(1.5); }
  100% { filter: brightness(1); }
}

.flash-correct #map { animation: map-flash-green 0.8s ease forwards; }
.flash-wrong   #map { animation: map-flash-red   0.8s ease forwards; }