@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

* {
  box-sizing: border-box;
}

:root {
  /* Clean, vibrant BCA & Accelerator palette */
  --bg-deep: #051336;
  --bg-mid: #0a2560;
  --bg-accent: #0f3484;
  
  --primary-blue: #0052cc;
  --bca-blue: #0047ba;
  --electric-cyan: #00d2ff;
  
  --card-surface: rgba(10, 32, 82, 0.72);
  --card-surface-hover: rgba(15, 45, 110, 0.88);
  --card-border: rgba(56, 189, 248, 0.2);
  --card-border-hover: rgba(0, 210, 255, 0.5);
  
  --text-primary: #ffffff;
  --text-secondary: #94b8e8;
  --text-muted: #628bc4;
  
  --rank-gold: #f59e0b;
  --rank-silver: #cbd5e1;
  --rank-bronze: #f97316;
  
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font);
  background: 
    radial-gradient(circle at 50% 0%, rgba(0, 140, 255, 0.28) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 40%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient Background (User Page Only) ─────────────────── */
.ambient-bg-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 520px;
  background: url('accelerator-banner.jpeg') no-repeat center 25%;
  background-size: cover;
  opacity: 0.22;
  filter: brightness(0.9) contrast(1.1) saturate(1.2);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 55%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Page Layout ─────────────────────────────────────────── */
.board-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.25rem 3.5rem;
  position: relative;
  z-index: 1;
}

/* ── Clean Professional Header ───────────────────────────── */
.site-header {
  width: 100%;
  max-width: 820px;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.brand-meta {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--electric-cyan);
  margin-bottom: 0.35rem;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.brand-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 0 25px rgba(0, 210, 255, 0.4);
}

.brand-subtitle {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: #c7dcfa;
  font-weight: 600;
}

.header-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.6);
  color: #86efac;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 10px #22c55e;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.refresh-rate {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── Leaderboard List & Cards ────────────────────────────── */
main {
  width: 100%;
  max-width: 820px;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.row {
  display: grid;
  grid-template-columns: 4.2rem 1.4rem 1fr auto;
  align-items: center;
  gap: 1.25rem;
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 1.2rem 1.6rem;
  box-shadow: 0 8px 24px rgba(0, 10, 35, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.row:hover {
  transform: translateY(-2px);
  background: var(--card-surface-hover);
  border-color: var(--card-border-hover);
  box-shadow: 0 12px 28px rgba(0, 15, 50, 0.5), 0 0 20px rgba(0, 210, 255, 0.25);
}

.row .rank {
  font-weight: 900;
  font-size: 1.65rem;
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
  font-variant-numeric: tabular-nums;
}

.row .color-dot {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.row .name {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.row .points-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.row .points {
  font-size: 2.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #00f0ff;
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.6);
  line-height: 1;
}

.row .points-unit {
  font-size: 1.05rem;
  font-weight: 900;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* ── Top 3 Rank Highlight ─────────────────────────────────── */
.row.rank-1 {
  border-color: rgba(245, 158, 11, 0.8);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.22) 0%, rgba(10, 32, 82, 0.85) 100%);
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.3);
}
.row.rank-1 .rank { 
  color: #fde047; 
  text-shadow: 0 0 16px rgba(253, 224, 71, 0.7); 
}
.row.rank-1 .name {
  color: #ffffff;
}
.row.rank-1 .points { 
  color: #fef08a; 
  text-shadow: 0 0 22px rgba(254, 240, 138, 0.8); 
}
.row.rank-1 .points-unit {
  color: #fde047;
  text-shadow: 0 0 14px rgba(253, 224, 71, 0.6);
}

.row.rank-2 {
  border-color: rgba(203, 213, 225, 0.7);
  background: linear-gradient(90deg, rgba(203, 213, 225, 0.18) 0%, rgba(10, 32, 82, 0.85) 100%);
}
.row.rank-2 .rank { 
  color: #f8fafc; 
  text-shadow: 0 0 14px rgba(248, 250, 252, 0.7); 
}
.row.rank-2 .points { 
  color: #67e8f9; 
  text-shadow: 0 0 20px rgba(103, 232, 249, 0.7); 
}
.row.rank-2 .points-unit {
  color: #a5f3fc;
  text-shadow: 0 0 12px rgba(165, 243, 252, 0.6);
}

.row.rank-3 {
  border-color: rgba(249, 115, 22, 0.7);
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.18) 0%, rgba(10, 32, 82, 0.85) 100%);
}
.row.rank-3 .rank { 
  color: #fdba74; 
  text-shadow: 0 0 14px rgba(253, 186, 116, 0.7); 
}
.row.rank-3 .points { 
  color: #fed7aa; 
  text-shadow: 0 0 20px rgba(254, 215, 170, 0.7); 
}
.row.rank-3 .points-unit {
  color: #fdba74;
  text-shadow: 0 0 12px rgba(253, 186, 116, 0.6);
}

.row.empty {
  display: block;
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

/* ── Footer ───────────────────────────────────────────────── */
.board-footer {
  margin-top: 2.75rem;
  text-align: center;
}

.admin-portal-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.admin-portal-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Admin Dashboard & Login ──────────────────────────────── */
.admin-page {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  background: rgba(6, 20, 52, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.admin-header-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-header h1 {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff;
}

.admin-badge {
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.4);
  color: var(--electric-cyan);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.admin-header nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-header nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.admin-header nav a.nav-btn-outline {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.admin-header nav a.nav-btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

.admin-header nav a.nav-btn-danger {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.admin-header nav a.nav-btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}

.admin-main {
  max-width: 1050px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 6px 20px rgba(0, 10, 35, 0.3);
}

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.35rem;
}

.stat-value.highlight {
  color: var(--electric-cyan);
}

.card {
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 6px 20px rgba(0, 10, 35, 0.3);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
}

.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type=text], input[type=password], input[type=number] {
  background: rgba(4, 15, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  padding: 0.6rem 0.8rem;
  font-family: var(--font);
  font-size: 0.92rem;
  transition: border-color 0.2s ease;
}

input[type=text]:focus, input[type=password]:focus, input[type=number]:focus {
  outline: none;
  border-color: var(--electric-cyan);
  background: rgba(8, 26, 70, 0.95);
}

input[type=color] {
  padding: 0.2rem;
  height: 2.4rem;
  width: 3rem;
  border-radius: 8px;
  background: rgba(4, 15, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

button, .btn-primary {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.15rem;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:hover, .btn-primary:hover {
  background: #0060df;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger:hover {
  background: #ef4444;
}

.table-responsive {
  overflow-x: auto;
}

.team-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.45rem;
  font-size: 0.9rem;
}

.team-table th {
  padding: 0.65rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.team-table tbody tr {
  background: rgba(6, 20, 52, 0.65);
}

.team-table tbody tr:hover {
  background: rgba(12, 36, 90, 0.8);
}

.team-table td {
  padding: 0.75rem 0.85rem;
  vertical-align: middle;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.team-table td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.team-table td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-pill {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.color-swatch {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
}

.team-name-cell {
  font-weight: 700;
  color: #ffffff;
}

.points-cell {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--electric-cyan);
  font-variant-numeric: tabular-nums;
}

.team-table input[type=number] { width: 5.5rem; }
.team-table input[type=text] { width: 8.5rem; }

/* ── Admin Login ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 10, 35, 0.5);
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  color: #ffffff;
}

.subtitle {
  color: var(--text-secondary);
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

.login-card label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.login-card button {
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-size: 0.95rem;
}

.back-link {
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.back-link a {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 600;
}

.back-link a:hover {
  color: #ffffff;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fecaca;
}

.alert-success {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .header-status {
    align-items: flex-start;
  }
  
  .row {
    grid-template-columns: 3.4rem 1.2rem 1fr auto;
    padding: 1rem 1.15rem;
    gap: 0.85rem;
  }
  
  .row .rank {
    font-size: 1.35rem;
  }
  
  .row .name {
    font-size: 1.2rem;
  }
  
  .row .points {
    font-size: 1.85rem;
  }
  
  .row .points-unit {
    font-size: 0.9rem;
  }
  
  .admin-header {
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
  }
}
