/* ═══════════════════════════════════════════════════════
   GEOINT CTF — Main Stylesheet
   ═══════════════════════════════════════════════════════ */

:root {
  --bg:        #0a0e1a;
  --bg2:       #0f1526;
  --bg3:       #161d33;
  --surface:   #1a2240;
  --border:    #2a3a6e;
  --primary:   #00d4ff;
  --primary2:  #0099cc;
  --accent:    #00ff88;
  --warn:      #ff6b35;
  --danger:    #ff3366;
  --text:      #e0e8ff;
  --text2:     #8899cc;
  --text3:     #556088;
  --success:   #00ff88;
  --font:      'Courier New', 'Consolas', monospace;
  --radius:    8px;
}

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

html { scroll-behavior: smooth; }

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

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track  { background: var(--bg2); }
::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }

/* ── Grid bg animation ───────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0,212,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ──────────────────────────────────────── */
h1, h2, h3 { letter-spacing: 0.05em; }

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

/* ── Utilities ───────────────────────────────────────── */
.hidden  { display: none !important; }
.flex    { display: flex; }
.gap-1   { gap: .5rem; }
.gap-2   { gap: 1rem; }
.center  { text-align: center; }
.mt-1    { margin-top: .5rem; }
.mt-2    { margin-top: 1rem; }
.mt-3    { margin-top: 1.5rem; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .05em;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 12px rgba(0,212,255,.2); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
  font-weight: bold;
}
.btn-primary:hover { background: var(--primary2); border-color: var(--primary2); color: #000; box-shadow: 0 0 20px rgba(0,212,255,.4); }
.btn-success  { background: var(--accent);  border-color: var(--accent);  color: #000; font-weight: bold; }
.btn-success:hover  { box-shadow: 0 0 20px rgba(0,255,136,.4); color: #000; }
.btn-danger   { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover   { background: var(--danger); color: #fff; }
.btn-warn     { background: transparent; border-color: var(--warn); color: var(--warn); }
.btn-warn:hover     { background: var(--warn); color: #fff; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: .3rem .8rem; font-size: .75rem; }

/* ── Inputs ──────────────────────────────────────────── */
.input {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color .2s;
  outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,212,255,.15); }
.input::placeholder { color: var(--text3); }

select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 80px; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
}
.card-header {
  font-size: .7rem;
  color: var(--primary);
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}

/* ── Hint / task text (large scenarios) ───────────────────────── */
.hint-text-lg {
  min-height: 130px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  padding: .6rem .75rem;
  border-radius: 10px;
  background: rgba(10,14,26,.35);
  border: 1px solid rgba(42,58,110,.55);
}

/* ── Glowing header ──────────────────────────────────── */
.logo {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary);
  text-shadow: 0 0 20px var(--primary);
  letter-spacing: .2em;
}
.logo span { color: var(--accent); }

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10,14,26,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: .8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-right { display: flex; align-items: center; gap: 1rem; font-size: .8rem; color: var(--text2); }

/* ── Alerts / Messages ───────────────────────────────── */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  border: 1px solid;
  margin: .5rem 0;
}
.alert-success { background: rgba(0,255,136,.1); border-color: var(--accent); color: var(--accent); }
.alert-error   { background: rgba(255,51,102,.1); border-color: var(--danger); color: var(--danger); }
.alert-warn    { background: rgba(255,107,53,.1);  border-color: var(--warn);  color: var(--warn); }
.alert-info    { background: rgba(0,212,255,.1);   border-color: var(--primary); color: var(--primary); }

/* ── Badge ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: bold;
  letter-spacing: .05em;
}
.badge-primary { background: rgba(0,212,255,.2); color: var(--primary); border: 1px solid var(--primary); }
.badge-success { background: rgba(0,255,136,.2); color: var(--accent);  border: 1px solid var(--accent); }
.badge-danger  { background: rgba(255,51,102,.2); color: var(--danger); border: 1px solid var(--danger); }
.badge-warn    { background: rgba(255,107,53,.2); color: var(--warn);   border: 1px solid var(--warn); }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead { background: var(--bg3); }
th { padding: .7rem 1rem; text-align: left; color: var(--primary); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
td { padding: .7rem 1rem; border-top: 1px solid var(--border); color: var(--text); white-space: nowrap; }
tr:hover td { background: rgba(0,212,255,.04); }

/* ── Progress bar ────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .5s ease;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color .2s;
}
.modal-close:hover { color: var(--danger); }

/* ── Form fields ─────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .75rem; color: var(--text2); margin-bottom: .3rem; letter-spacing: .05em; }

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

/* ── Scan line effect ────────────────────────────────── */
@keyframes scanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* ── LOGIN PAGE ─────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

.login-box {
  width: 100%;
  max-width: 420px;
}

.login-title {
  text-align: center;
  margin-bottom: 2rem;
}
.login-title h1 {
  font-size: 2rem;
  color: var(--primary);
  text-shadow: 0 0 30px var(--primary);
}
.login-title p {
  color: var(--text2);
  font-size: .85rem;
  margin-top: .3rem;
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 0 40px rgba(0,212,255,.08);
}

/* ── GAME PAGE ───────────────────────────────────────── */
.game-page {
  padding-top: 60px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.game-header {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--bg2);
}

.level-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.level-badge {
  font-size: 1rem;
  font-weight: bold;
  color: var(--primary);
  background: rgba(0,212,255,.1);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: .3rem .8rem;
  white-space: nowrap;
}

/* ── Timer ───────────────────────────────────────────── */
.timer-wrap { text-align: right; }
.timer {
  font-size: 2rem;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  transition: color .3s;
  letter-spacing: .05em;
}
.timer.ok      { color: var(--accent); text-shadow: 0 0 15px rgba(0,255,136,.5); }
.timer.warn    { color: var(--warn);   text-shadow: 0 0 15px rgba(255,107,53,.5); }
.timer.danger  { color: var(--danger); text-shadow: 0 0 20px rgba(255,51,102,.7); animation: blink .5s step-end infinite; }
@keyframes blink { 50% { opacity: .4; } }

.timer-label { font-size: .65rem; color: var(--text3); letter-spacing: .1em; text-transform: uppercase; }

/* ── Image panel ─────────────────────────────────────── */
.game-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.photo-panel {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
}

.photo-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 1rem;
}

.photo-label {
  font-size: .7rem;
  color: var(--primary);
  letter-spacing: .15em;
  text-transform: uppercase;
}

.photo-crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  pointer-events: none;
  opacity: .4;
}
.photo-crosshair::before,
.photo-crosshair::after {
  content: '';
  position: absolute;
  background: var(--primary);
}
.photo-crosshair::before { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%); }
.photo-crosshair::after  { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%); }

/* ── Answer panel ────────────────────────────────────── */
.answer-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.flag-input-wrap {
  position: relative;
}
.flag-prefix {
  position: absolute;
  left: .8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: .85rem;
  pointer-events: none;
}
.flag-input {
  padding-left: 5.5rem !important;
}

/* ── Score widget ────────────────────────────────────── */
.score-widget {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.score-widget .score-val {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 15px rgba(0,255,136,.4);
}
.score-widget .score-lbl {
  font-size: .65rem;
  color: var(--text3);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ── Overlay screens ─────────────────────────────────── */
.overlay-screen {
  position: fixed;
  inset: 0;
  background: rgba(10,14,26,.92);
  backdrop-filter: blur(8px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.overlay-box {
  text-align: center;
  max-width: 480px;
}
.overlay-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
}
.overlay-title {
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: .1em;
  margin-bottom: .5rem;
}
.overlay-sub {
  color: var(--text2);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

/* ── Admin layout ────────────────────────────────────── */
.admin-page {
  padding-top: 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.admin-content {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.admin-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: .5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text2);
  font-family: var(--font);
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .05em;
}
.tab-btn:hover  { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #000; font-weight: bold; }

.admin-section { display: none; }
.admin-section.active { display: block; }

/* ── Stats cards ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}
.stat-val  { font-size: 1.6rem; font-weight: bold; color: var(--primary); }
.stat-lbl  { font-size: .7rem; color: var(--text3); letter-spacing: .08em; text-transform: uppercase; margin-top: .2rem; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .game-main { grid-template-columns: 1fr; }
  .photo-panel { aspect-ratio: 4/3; }
  .game-header { padding: .8rem 1rem; }
}
@media (max-width: 600px) {
  .admin-content { padding: 1rem; }
  .modal { padding: 1.2rem; }
  .navbar { padding: .8rem 1rem; }
  .timer { font-size: 1.4rem; }
}
