/* ═══════════════════════════════════════════════════════════════════════════
   HackBoard — Global Styles
   ══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #09090f;
  --surface: #12121c;
  --surface2: #1a1a2e;
  --border: rgba(255,255,255,0.07);
  --text: #e8e8f0;
  --text-muted: #7070a0;
  --accent: #7c3aed;
  --accent2: #06b6d4;
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #b45309;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 32px rgba(0,0,0,0.5);
  --font: 'Inter', system-ui, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

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

/* ── Animated background ──────────────────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(124,58,237,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%; filter: blur(120px); opacity: 0.15;
}
.glow-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent), transparent);
  top: -200px; left: -200px;
  animation: drift1 18s ease-in-out infinite alternate;
}
.glow-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent2), transparent);
  bottom: -150px; right: -150px;
  animation: drift2 22s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(80px, 60px); } }
@keyframes drift2 { to { transform: translate(-80px, -60px); } }

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(9,9,15,0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem;
}
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 1.5rem; }
.logo-text {
  font-family: var(--font-head);
  font-size: 1.25rem; font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
nav { display: flex; gap: 0.5rem; }
.nav-link {
  padding: 0.4rem 1rem; border-radius: 999px;
  color: var(--text-muted); text-decoration: none;
  font-size: 0.875rem; font-weight: 600;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
main { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.hero { text-align: center; padding: 3rem 0 2rem; }
.hero-title {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(135deg, #fff 30%, var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1.15; margin-bottom: 0.5rem;
}
.hero-sub { color: var(--text-muted); font-size: 1rem; margin-bottom: 1rem; }

/* Live badge */
.live-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; border-radius: 999px;
  padding: 0.3rem 0.9rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ── Podium ───────────────────────────────────────────────────────────────── */
.podium-section { padding: 1.5rem 0 2.5rem; }
.podium-wrap {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap;
}
.podium-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.25rem 1.5rem 0; border-radius: var(--radius) var(--radius) 0 0;
  min-width: 160px; position: relative;
  background: var(--surface2); border: 1px solid var(--border);
  transition: transform 0.2s;
}
.podium-card:hover { transform: translateY(-4px); }
.podium-1st { min-height: 180px; background: linear-gradient(160deg, #2d1e0a, #1a1200); border-color: var(--gold); }
.podium-2nd { min-height: 140px; }
.podium-3rd { min-height: 120px; }
.podium-medal { font-size: 2.2rem; margin-bottom: 0.4rem; }
.podium-name { font-weight: 700; font-size: 0.95rem; text-align: center; margin-bottom: 0.3rem; }
.podium-pts { font-size: 1.5rem; font-weight: 900; color: var(--accent2); }
.podium-pts span { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.podium-base {
  width: 100%; margin-top: auto; padding: 0.5rem 0;
  border-top: 1px solid var(--border); text-align: center;
}
.podium-rank { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

/* ── Table section ────────────────────────────────────────────────────────── */
.table-section { margin-top: 0.5rem; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem;
}
.search-input {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 0.6rem 1rem; font-size: 0.875rem; width: 260px;
  transition: border-color 0.2s;
  font-family: var(--font);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.last-updated { color: var(--text-muted); font-size: 0.8rem; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table thead { background: var(--surface2); }
.lb-table th {
  padding: 0.85rem 1.2rem; text-align: left;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.lb-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:hover { background: var(--surface2); }

.row-gold   { background: rgba(245,158,11,0.07); }
.row-silver { background: rgba(148,163,184,0.05); }
.row-bronze { background: rgba(180,83,9,0.06); }

.lb-table td { padding: 0.9rem 1.2rem; font-size: 0.9rem; }
.rank-cell { width: 80px; }
.pts-cell { font-weight: 700; font-size: 1rem; color: var(--accent2); }
.name-cell { font-weight: 600; }

/* Rank badges */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; border-radius: 6px;
  font-size: 0.8rem; font-weight: 700;
  background: var(--surface2); color: var(--text-muted);
}
.badge-gold   { background: rgba(245,158,11,0.2); color: var(--gold); }
.badge-silver { background: rgba(148,163,184,0.15); color: var(--silver); }
.badge-bronze { background: rgba(180,83,9,0.2); color: #cd7c3a; }

/* Change indicators */
.change-up   { color: var(--success); font-weight: 700; font-size: 0.8rem; }
.change-down { color: var(--danger);  font-weight: 700; font-size: 0.8rem; }
.change-neutral { color: var(--text-muted); font-size: 0.8rem; }

.loading-row { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  position: relative; z-index: 1;
  text-align: center; padding: 2rem;
  color: var(--text-muted); font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════════════════════════════
   ADMIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Login overlay */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9,9,15,0.92); backdrop-filter: blur(8px);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem;
  width: 100%; max-width: 380px; text-align: center;
  box-shadow: var(--shadow);
}
.login-icon { font-size: 3rem; margin-bottom: 1rem; }
.login-card h2 { font-family: var(--font-head); font-size: 1.5rem; margin-bottom: 0.4rem; }
.login-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.login-input {
  width: 100%; padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 1rem; font-family: var(--font);
  margin-bottom: 0.75rem; transition: border-color 0.2s;
}
.login-input:focus { outline: none; border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; min-height: 1.2em; }

/* Admin main */
.admin-main { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.hidden { display: none !important; }

/* Global actions bar */
.admin-global {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; font-family: var(--font);
  border: none; cursor: pointer; transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: linear-gradient(135deg, var(--accent), #5b21b6); color: #fff; }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn-danger   { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.btn-add      { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.btn-sub      { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #f87171; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn:hover { opacity: 0.85; }

/* Admin toolbar */
.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem;
}
.team-count { color: var(--text-muted); font-size: 0.85rem; }

/* Admin grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.admin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.admin-card-header {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1rem; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.admin-rank {
  font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
  background: var(--bg); border-radius: 4px; padding: 0.2rem 0.4rem;
}
.admin-team-name { flex: 1; font-weight: 700; font-size: 0.9rem; }
.admin-pts-badge {
  font-weight: 900; font-size: 0.95rem; color: var(--accent2);
  background: rgba(6,182,212,0.1); border-radius: 6px;
  padding: 0.2rem 0.6rem;
}
.admin-card-body { padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.point-controls { display: flex; flex-direction: column; gap: 0.5rem; }
.quick-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.custom-row { display: flex; gap: 0.4rem; }
.pts-input {
  flex: 1; padding: 0.35rem 0.6rem; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.85rem; font-family: var(--font);
  min-width: 0;
}
.pts-input:focus { outline: none; border-color: var(--accent); }
.reset-btn { align-self: flex-start; }

/* Toast */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 999;
  padding: 0.85rem 1.5rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  transform: translateY(20px); opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: rgba(34,197,94,0.2); border: 1px solid rgba(34,197,94,0.4); color: #4ade80; }
.toast-error   { background: rgba(239,68,68,0.2);  border: 1px solid rgba(239,68,68,0.4);  color: #f87171; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: 0.75rem 1rem; }
  .logo-text { font-size: 1rem; }
  .podium-card { min-width: 120px; }
  .lb-table th, .lb-table td { padding: 0.65rem 0.75rem; }
  .admin-grid { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
}

/* ── Add Team section ─────────────────────────────────────────────────────── */
.add-team-section {
  margin-bottom: 1.5rem;
}
.add-team-form {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 1rem 1.25rem;
}
.add-team-form .search-input { flex: 1; min-width: 200px; }

/* Delete button */
.btn-delete {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: #f87171;
}
.btn-delete:hover { opacity: 0.85; }

/* Card footer row — reset + delete side by side */
.card-footer-row {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
