/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #003087;
  --gold:    #FFD700;
  --text:    #1a1a2e;
  --muted:   #6b7280;
  --border:  #e5e7eb;
  --surface: #ffffff;
  --hover:   #f3f4f6;
  --danger:  #dc2626;
  --success: #16a34a;
  --radius:  8px;
  --shadow:  0 2px 8px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; color: var(--text); background: #f0f4f8; min-height: 100vh; }

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

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  background: var(--blue);
  color: #fff;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}
.navbar a { color: #fff; opacity: .85; }
.navbar a:hover { opacity: 1; text-decoration: none; }
.navbar .brand { font-size: 1.15rem; font-weight: 700; opacity: 1; }
.navbar .spacer { flex: 1; }
.navbar .nav-links { display: flex; gap: 1.25rem; font-size: .9rem; }

/* ── Hero (home page) ─────────────────────────────────────── */
.hero {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue) 0%, #1a3a8f 60%, #0d1f5c 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.hero-content { text-align: center; max-width: 900px; width: 100%; }
.logo-icon { font-size: 4rem; margin-bottom: .5rem; }
.hero h1 { color: #fff; font-size: 2.5rem; font-weight: 800; margin-bottom: .5rem; }
.subtitle { color: rgba(255,255,255,.75); font-size: 1.1rem; margin-bottom: 2.5rem; }

.nav-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.nav-card {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: 1.75rem 1.25rem;
  color: #fff;
  transition: transform .2s, background .2s;
  text-decoration: none;
}
.nav-card:hover { background: rgba(255,255,255,.2); transform: translateY(-3px); text-decoration: none; }
.nav-icon { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
.nav-card h2 { font-size: 1.1rem; margin-bottom: .5rem; color: var(--gold); }
.nav-card p { font-size: .85rem; opacity: .85; line-height: 1.5; }

/* ── Page Layout ──────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: #f8f9fa;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; gap: .5rem;
}
.card-body { padding: 1.25rem; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .35rem; }
.form-control {
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .95rem; transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,48,135,.1); }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius); border: none;
  cursor: pointer; font-size: .9rem; font-weight: 600; transition: all .15s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #002070; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--hover); }
.btn-gold { background: var(--gold); color: var(--blue); }
.btn-gold:hover { background: #e6c200; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: #f8f9fa; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .6rem .9rem; border-bottom: 2px solid var(--border); text-align: left; }
td { padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--hover); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2em .55em; border-radius: 99px;
  font-size: .75rem; font-weight: 600; line-height: 1.4;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gold { background: #fef9c3; color: #854d0e; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #6b7280; }

/* ── Rank Badges ──────────────────────────────────────────── */
.rank-1 { background: #FFD700; color: #000; padding: .25rem .6rem; border-radius: 6px; font-weight: 700; }
.rank-2 { background: #C0C0C0; color: #000; padding: .25rem .6rem; border-radius: 6px; font-weight: 700; }
.rank-3 { background: #CD7F32; color: #fff; padding: .25rem .6rem; border-radius: 6px; font-weight: 700; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  padding: .65rem 1.25rem; border: none; background: transparent;
  cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  padding: 1.5rem; max-height: 90vh; overflow-y: auto;
  position: relative;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h3 { font-size: 1.15rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; line-height: 1; color: var(--muted); }
.modal-close:hover { color: var(--text); }

/* ── QR Code display ──────────────────────────────────────── */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.25rem; }
.qr-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; text-align: center; box-shadow: var(--shadow);
}
.qr-card img { width: 160px; height: 160px; margin: 0 auto .75rem; display: block; }
.qr-card .entry-num { font-size: 1.1rem; font-weight: 700; color: var(--blue); }
.qr-card .entry-title { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.qr-card .entry-name { font-size: .85rem; font-weight: 600; }

/* ── Judging form ─────────────────────────────────────────── */
.score-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 0; border-bottom: 1px solid var(--border);
}
.score-row:last-child { border-bottom: 0; }
.score-label { flex: 1; }
.score-label strong { display: block; font-size: .95rem; }
.score-label span { font-size: .8rem; color: var(--muted); }
.score-input { width: 90px; text-align: center; font-size: 1.1rem; font-weight: 700; }
.score-max { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.elig-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.elig-row:last-child { border-bottom: 0; }
.elig-question { flex: 1; font-size: .95rem; }
.elig-toggle { display: flex; gap: .5rem; }
.elig-btn {
  padding: .3rem .7rem; border-radius: var(--radius); border: 1px solid var(--border);
  cursor: pointer; font-size: .85rem; font-weight: 600; transition: all .15s; background: #fff;
}
.elig-btn.yes.active { background: var(--success); color: #fff; border-color: var(--success); }
.elig-btn.no.active  { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ── Progress ─────────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin: .5rem 0; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 99px; transition: width .3s; }

/* ── Loading spinner ──────────────────────────────────────── */
.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Print styles ─────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
  .qr-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .nav-cards { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .tabs { overflow-x: auto; }
}
