:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #059669;
  --accent-hover: #047857;
  --danger: #dc2626;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Hero ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: white;
  padding: 4rem 1rem 3rem;
  text-align: center;
}

.hero-inner { max-width: 900px; margin: 0 auto; }

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Sections ────────────────────────────────────────── */
.section {
  max-width: 1100px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

/* ── KPI Grid ────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.kpi-card:hover { transform: translateY(-2px); }

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
}

.kpi-card.win .kpi-value { color: var(--accent); }
.kpi-card.loss .kpi-value { color: var(--danger); }

.note {
  font-size: 0.875rem;
  color: var(--text-light);
  font-style: italic;
}

/* ── Matches ─────────────────────────────────────────── */
.matches-list {
  display: grid;
  gap: 1rem;
}

.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.match-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.team {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.flag { font-size: 1.5rem; }

.vs {
  font-weight: 700;
  color: var(--text-light);
  font-size: 0.9rem;
}

.match-pick {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.pick-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.pick-badge.dummy {
  background: #fef3c7;
  color: #92400e;
}

.pick-result {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ── Footer ──────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

footer a { color: var(--text-light); }

/* ── Login ────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.2);
  text-align: center;
}

.login-box .logo {
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.login-box h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.login-box .subtitle {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

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

.login-box label {
  font-size: 0.875rem;
  font-weight: 500;
}

.login-box input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
}

.login-box input:focus { border-color: var(--accent); }

.login-box button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.875rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:hover { background: var(--accent-hover); }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert.error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.back-link { margin-top: 1.5rem; font-size: 0.875rem; }
.back-link a { color: var(--text-light); }

/* ── Admin Nav ───────────────────────────────────────── */
.admin-nav {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-brand { font-size: 1rem; opacity: 0.9; }

.nav-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: white;
  border-bottom-color: var(--accent);
}

.nav-links a.logout {
  color: #fca5a5;
}

/* ── Admin Container ─────────────────────────────────── */
.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.admin-container h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.admin-container h2 {
  font-size: 1.25rem;
  margin: 2rem 0 1rem;
  font-weight: 600;
}

/* ── Table Grid (Dashboard) ──────────────────────────── */
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
}

.table-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.table-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.table-icon { font-size: 2rem; opacity: 0.6; }

/* ── Toolbar ───────────────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-form input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  min-width: 220px;
}

.search-form button,
.btn-clear {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
}

.per-page {
  display: flex;
  gap: 0.35rem;
  font-size: 0.875rem;
}

.per-page a {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-light);
  border: 1px solid var(--border);
}

.per-page a.active,
.per-page a:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ── Data Table ──────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--card);
}

.data-table thead {
  background: var(--primary);
  color: white;
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.data-table th a {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.data-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #f1f5f9;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Pagination ──────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-info {
  font-size: 0.875rem;
  color: var(--text-light);
}

.page-links {
  display: flex;
  gap: 0.5rem;
}

.page-links a {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  font-size: 0.875rem;
}

.page-links a:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.admin-footer {
  margin-top: 2rem;
  font-size: 0.875rem;
}

.admin-footer a {
  color: var(--text-light);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.75rem; }
  .hero-stats { gap: 1rem; }
  .stat-num { font-size: 1.5rem; }
  .match-teams { flex-direction: column; gap: 0.5rem; }
  .vs { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-form input { min-width: auto; width: 100%; }
  .admin-nav { padding: 0.75rem 1rem; }
  .nav-links { gap: 0.75rem; }
}
