/* ============================================================
   AT CUP 2026 — Shared Stylesheet
   Palette: deep forest night · trophy gold · stadium green
   ============================================================ */

:root {
  --bg:          #0A1F15;
  --surface:     #142E1F;
  --surface2:    #1A3A27;
  --border:      rgba(255,255,255,0.08);
  --green:       #00A862;
  --green-soft:  rgba(0,168,98,0.15);
  --gold:        #CBA258;
  --gold-bright: #FFD700;
  --gold-soft:   rgba(203,162,88,0.15);
  --silver:      #B8BFC9;
  --bronze:      #CD7F32;
  --red:         #E05252;
  --text:        #F0EFE9;
  --text-dim:    rgba(240,239,233,0.55);
  --text-muted:  rgba(240,239,233,0.3);
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --radius:      12px;
  --radius-sm:   6px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p  { line-height: 1.6; }

/* ── Layout ────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--gold);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; gap: 1rem;
}
.logo-area { display: flex; align-items: center; gap: 0.75rem; }
.logo-cup { font-size: 1.8rem; }
.logo-text { line-height: 1.15; }
.logo-text .main { font-size: 1.1rem; font-weight: 800; color: var(--gold); }
.logo-text .sub  { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }

.header-right { display: flex; align-items: center; gap: 0.75rem; }

/* Language toggle */
.lang-toggle {
  display: flex; background: var(--bg); border-radius: 20px;
  border: 1px solid var(--border); overflow: hidden;
}
.lang-toggle button {
  background: none; border: none; color: var(--text-dim);
  padding: 0.3rem 0.7rem; cursor: pointer; font-size: 0.78rem;
  font-weight: 600; transition: all .15s; font-family: var(--font);
}
.lang-toggle button.active {
  background: var(--gold); color: #0A1F15;
}

/* ── Navigation tabs ───────────────────────────────────────── */
.nav-tabs {
  display: flex; gap: 0.25rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  background: none; border: none;
  color: var(--text-dim); padding: 0.75rem 1.1rem;
  cursor: pointer; font-size: 0.88rem; font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap; transition: all .15s;
  font-family: var(--font);
}
.nav-tab:hover  { color: var(--text); }
.nav-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.nav-tab .dot   {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--green);
  margin-left: 5px; vertical-align: middle;
}

/* ── Country / period sub-tabs ─────────────────────────────── */
.sub-tabs {
  display: flex; gap: 0.5rem; padding: 0.85rem 1.25rem 0;
  flex-wrap: wrap;
}
.sub-tab {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-dim); padding: 0.4rem 1rem;
  border-radius: 20px; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; transition: all .15s;
  font-family: var(--font);
}
.sub-tab:hover  { border-color: var(--gold); color: var(--text); }
.sub-tab.active { background: var(--gold); color: #0A1F15; border-color: var(--gold); }

/* ── Status / challenge banner ──────────────────────────────── */
.status-banner {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
}
.status-banner .pill {
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid var(--gold); border-radius: 20px;
  padding: 0.2rem 0.7rem; font-size: 0.75rem; font-weight: 700;
  white-space: nowrap;
}
.status-banner .pill.live { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.status-banner .challenge { font-weight: 600; font-size: 0.9rem; }
.status-banner .muted { color: var(--text-dim); font-size: 0.82rem; }

/* ── Leaderboard table ─────────────────────────────────────── */
.board-wrap { overflow-x: auto; margin: 0.5rem 0 1.5rem; }

.board {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 0.88rem;
}
.board thead th {
  background: var(--surface2); color: var(--text-dim);
  padding: 0.6rem 0.75rem; text-align: left;
  font-weight: 600; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.06em; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.board thead th:first-child { border-radius: var(--radius-sm) 0 0 0; padding-left: 1rem; }
.board thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.board tbody tr {
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.board tbody tr:hover { background: rgba(255,255,255,0.03); }

.board tbody td {
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}
.board tbody td:first-child { padding-left: 1rem; }

/* Rank cells */
.rank-cell { font-weight: 800; font-size: 1rem; min-width: 40px; }
.rank-1 { color: var(--gold-bright); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }

/* Store / team cell */
.store-cell { min-width: 160px; }
.store-name { font-weight: 600; white-space: nowrap; }
.team-name  { font-size: 0.78rem; color: var(--gold); font-weight: 500; }
.store-tag  {
  display: inline-block; font-size: 0.65rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 3px; vertical-align: middle;
  margin-left: 4px; color: #0A1F15; background: var(--text-muted);
}

/* AT cells */
.at-cell { font-weight: 700; font-size: 0.92rem; min-width: 70px; }
.at-inc  { font-weight: 700; min-width: 70px; }
.at-inc.pos { color: var(--green); }
.at-inc.neg { color: var(--red); }

/* Goals / wins */
.goals-cell { min-width: 90px; }
.goals-bar-wrap { display: flex; align-items: center; gap: 6px; }
.goals-bar {
  flex: 1; max-width: 60px; height: 5px;
  background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden;
}
.goals-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width .6s ease;
}
.wins-cell { font-weight: 800; font-size: 1rem; min-width: 55px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem;
  border-radius: 20px; white-space: nowrap;
}
.badge-mvp  { background: var(--gold); color: #0A1F15; }
.badge-ok   { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); }
.badge-fail { background: rgba(224,82,82,0.12); color: var(--red); border: 1px solid rgba(224,82,82,0.3); }
.badge-new  { background: rgba(203,162,88,0.2); color: var(--gold); border: 1px solid var(--gold); }

/* ── Monthly podium ─────────────────────────────────────────── */
.podium {
  display: flex; gap: 1rem; margin: 1rem 0;
  flex-wrap: wrap;
}
.podium-card {
  flex: 1; min-width: 200px;
  background: var(--surface2); border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1rem; text-align: center;
}
.podium-card.gold-card   { border-color: var(--gold-bright); }
.podium-card.silver-card { border-color: var(--silver); }
.podium-card.bronze-card { border-color: var(--bronze); }
.podium-medal { font-size: 2rem; margin-bottom: 0.4rem; }
.podium-place { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 0.25rem; }
.podium-team  { font-size: 1rem; font-weight: 700; }
.podium-store { font-size: 0.8rem; color: var(--text-dim); }
.podium-score { font-size: 0.82rem; color: var(--gold); margin-top: 0.4rem; }

/* ── No data state ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-dim);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.95rem; }

/* ── Goal animation overlay ─────────────────────────────────── */
#goal-overlay {
  position: fixed; inset: 0; pointer-events: none;
  z-index: 9999; overflow: hidden;
}
.goal-ball {
  position: absolute; font-size: 1.8rem;
  animation: goalFly 1.4s cubic-bezier(.17,.67,.38,.99) forwards;
}
@keyframes goalFly {
  0%   { transform: translateY(0) scale(0.4); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(-120vh) scale(1.2) rotate(360deg); opacity: 0; }
}
.goal-flash {
  position: fixed; inset: 0;
  background: radial-gradient(circle at center, rgba(255,215,0,.18) 0%, transparent 70%);
  animation: flashFade 1.2s ease-out forwards;
  pointer-events: none; z-index: 9998;
}
@keyframes flashFade { 0%{opacity:1} 100%{opacity:0} }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  border: none; cursor: pointer; transition: all .15s; text-decoration: none;
}
.btn-gold    { background: var(--gold); color: #0A1F15; }
.btn-gold:hover { background: var(--gold-bright); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-green   { background: var(--green); color: #fff; }
.btn-green:hover { background: #00c070; }
.btn-danger  { background: rgba(224,82,82,0.15); color: var(--red); border: 1px solid rgba(224,82,82,0.3); }
.btn-danger:hover { background: rgba(224,82,82,0.25); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-field { margin-bottom: 1rem; }
.form-field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-dim); margin-bottom: 0.35rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.form-field input, .form-field select, .form-field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.88rem;
  transition: border-color .15s;
}
.form-field input:focus, .form-field select:focus {
  outline: none; border-color: var(--gold);
}
.form-field input::placeholder { color: var(--text-muted); }

/* ── Admin layout ───────────────────────────────────────────── */
.admin-layout {
  display: flex; min-height: calc(100vh - 60px); gap: 0;
}
.admin-sidebar {
  width: 220px; min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky; top: 60px; height: calc(100vh - 60px);
  overflow-y: auto;
}
.admin-sidebar .section-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 0.75rem 1rem 0.25rem;
}
.sidebar-link {
  display: block; padding: 0.6rem 1rem;
  color: var(--text-dim); text-decoration: none; font-size: 0.88rem;
  font-weight: 500; cursor: pointer; transition: all .1s;
  border-left: 3px solid transparent;
}
.sidebar-link:hover  { color: var(--text); background: rgba(255,255,255,0.03); }
.sidebar-link.active { color: var(--gold); border-left-color: var(--gold); background: var(--gold-soft); }
.sidebar-link .badge-mini {
  float: right; font-size: 0.65rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 10px;
  background: var(--green-soft); color: var(--green);
}
.sidebar-link .badge-mini.pub { background: var(--gold-soft); color: var(--gold); }

.admin-main { flex: 1; padding: 1.5rem; overflow-x: auto; }

/* ── Admin data table ───────────────────────────────────────── */
.data-table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
  white-space: nowrap;
}
.data-table th, .data-table td {
  border: 1px solid var(--border); padding: 0.4rem 0.5rem;
}
.data-table th {
  background: var(--surface2); color: var(--text-dim);
  font-weight: 600; font-size: 0.72rem;
  text-align: center; text-transform: uppercase; letter-spacing: 0.05em;
}
.data-table th.store-col { text-align: left; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table td.store-col {
  background: var(--surface); font-weight: 600;
  position: sticky; left: 0; z-index: 1;
}
.data-table input[type=number], .data-table input[type=text] {
  width: 72px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 0.25rem 0.4rem; border-radius: 3px;
  font-family: var(--font); font-size: 0.78rem; text-align: right;
}
.data-table input[type=number]:focus,
.data-table input[type=text]:focus { outline:none; border-color: var(--gold); }
.data-table input.wide { width: 90px; }

/* Row colours: non-comp, new */
.data-table tr.non-comp td.store-col { color: var(--text-muted); }
.data-table tr.is-new td.store-col   { color: var(--gold); }

/* Group header rows in table */
.data-table tr.group-header td {
  background: rgba(203,162,88,0.08); color: var(--gold);
  font-weight: 700; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.1em; border-top: 2px solid rgba(203,162,88,0.3);
}

/* ── Admin controls bar ─────────────────────────────────────── */
.controls-bar {
  display: flex; align-items: center; gap: 0.75rem;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.controls-bar h2 { flex: 1; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
}
.card-title { font-weight: 700; margin-bottom: 0.75rem; color: var(--gold); }

/* ── Login screen ───────────────────────────────────────────── */
.login-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 80vh; gap: 1rem; text-align: center;
}
.login-card { background: var(--surface); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 380px; }
.login-card h2 { margin-bottom: 1.25rem; }

/* ── Toast notifications ────────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  font-size: 0.88rem; z-index: 999;
  transform: translateY(100px); opacity: 0;
  transition: all .25s; max-width: 320px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); color: var(--green); }
#toast.error   { border-color: var(--red); color: var(--red); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  .admin-sidebar { display: none; }
  .board thead th:nth-child(n+6) { display: none; }
  .board tbody td:nth-child(n+6) { display: none; }
  .podium { flex-direction: column; }
  h1 { font-size: 1.3rem; }
}
