/* ═══════════════════════════════════════════════════════════════
   CDM 2026 — Design "Tableau d'affichage de stade"
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────── */
:root {
  --bg:        #040408;
  --surface:   #09091a;
  --surface2:  #0f0f26;
  --surface3:  #161638;
  --border:    #222248;
  --border-hi: #383870;
  --text:      #e2e4f6;
  --muted:     #50508a;
  --lime:      #b4ff00;
  --lime-dim:  rgba(180,255,0,0.10);
  --lime-glow: rgba(180,255,0,0.25);
  --magenta:   #ff00cc;
  --mag-dim:   rgba(255,0,204,0.10);
  --mag-glow:  rgba(255,0,204,0.25);
  --gold:      #ffc107;
  --silver:    #9e9eb8;
  --bronze:    #c87941;
  --red:       #ff2d55;
  --green:     #00e676;
  --radius:    10px;
  --font:      'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --shadow:    0 8px 40px rgba(0,0,0,0.7);
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 1.05rem;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 40% at 20% 0%,   rgba(10,40,0,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 85% 100%,  rgba(40,0,40,0.45) 0%, transparent 70%),
    var(--bg);
}

/* Grille fine "tableau de bord" */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(0deg,   transparent, transparent 59px, rgba(180,255,0,0.018) 60px),
    repeating-linear-gradient(90deg,  transparent, transparent 59px, rgba(180,255,0,0.018) 60px);
  z-index: -1;
  pointer-events: none;
}

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--lime); filter: brightness(1.2); }

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

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(4,4,10,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
/* Barre lumineuse en bas du header */
.site-header::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--lime) 25%,
    var(--magenta) 75%,
    transparent 100%);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: .65rem;
  padding-bottom: .65rem;
  flex-wrap: wrap;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; filter: none; }
.logo-ball { font-size: 1.4rem; }
.logo-cdm  { color: var(--text); }
.logo-year {
  background: linear-gradient(135deg, var(--lime) 0%, var(--magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Verrou badge */
.lock-badge {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid rgba(255,193,7,0.4);
  border-radius: 20px;
  padding: .15rem .65rem;
  background: rgba(255,193,7,0.08);
  letter-spacing: .04em;
}

/* Nav */
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .1rem;
  flex-wrap: wrap;
}
.nav-link {
  color: var(--muted);
  padding: .35rem .8rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
  filter: none;
}
.nav-link.active { color: var(--lime); }
.nav-admin  { color: var(--magenta) !important; }
.nav-admin:hover, .nav-admin.active { color: var(--magenta) !important; background: var(--mag-dim); }
.nav-logout { color: var(--red) !important; }
.nav-logout:hover { color: #fff !important; background: var(--red); }

/* ── Main ─────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 2rem 1.25rem 4rem; }

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: .9rem 0;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: .03em;
}
.footer-sep { margin: 0 .6rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--lime); }

/* ── Flash messages ───────────────────────────────────────────── */
.flash {
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-weight: 700;
  font-size: .95rem;
  border-left: 4px solid;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.flash-success { background: rgba(0,230,118,0.08);  border-color: var(--green);   color: var(--green); }
.flash-error   { background: rgba(255,45,85,0.08);   border-color: var(--red);     color: var(--red); }
.flash-info    { background: var(--lime-dim);          border-color: var(--lime);    color: var(--lime); }
.flash-warning { background: rgba(255,193,7,0.08);   border-color: var(--gold);    color: var(--gold); }

/* ── Page title ───────────────────────────────────────────────── */
.page-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
/* Subtle lime glow en haut du card */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lime-glow), transparent);
}
.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .85rem;
}
.card-subtitle {
  font-size: .95rem;
  color: var(--muted);
  margin-bottom: .85rem;
  line-height: 1.4;
}

/* ── Formulaires ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: .4rem;
  color: var(--muted);
  text-transform: uppercase;
  font-size: .82rem;
  letter-spacing: .06em;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: .55rem .9rem;
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-dim);
}
.form-control option { background: var(--surface2); }

/* ── Boutons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.35rem;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.15); transform: translateY(-1px); }
.btn:active { transform: translateY(0); filter: brightness(.95); }

.btn-primary { background: var(--lime);    color: #000; box-shadow: 0 0 20px rgba(180,255,0,0.3); }
.btn-magenta { background: var(--magenta); color: #fff; box-shadow: 0 0 20px rgba(255,0,204,0.3); }
.btn-danger  { background: var(--red);     color: #fff; }
.btn-ghost   { background: transparent; color: var(--lime); border: 1.5px solid var(--lime); }
.btn-ghost:hover { background: var(--lime-dim); }
.btn-sm      { padding: .35rem .9rem; font-size: .88rem; }
.btn-full    { width: 100%; justify-content: center; }

/* ── Hero Leaderboard ─────────────────────────────────────────── */
.lb-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  margin-bottom: 2rem;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(180,255,0,0.12) 0%, transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.lb-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--lime), var(--magenta), transparent);
}
.lb-trophy {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: .5rem;
  filter: drop-shadow(0 0 20px rgba(255,193,7,0.6));
  animation: trophy-pulse 3s ease-in-out infinite;
}
@keyframes trophy-pulse {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(255,193,7,0.5)); transform: scale(1); }
  50%       { filter: drop-shadow(0 0 30px rgba(255,193,7,0.9)); transform: scale(1.05); }
}
.lb-event {
  font-size: 2.2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  background: linear-gradient(135deg, var(--lime) 0%, var(--magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .2rem;
}
.lb-subtitle {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* ── Scoreboard table ─────────────────────────────────────────── */
.scoreboard { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.scoreboard thead th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .1em;
  padding: .7rem .9rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.scoreboard thead th.pts { color: var(--lime); border-bottom-color: var(--lime); }
.scoreboard td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.scoreboard tbody tr { transition: background .12s; }
.scoreboard tbody tr:hover { background: var(--surface2); }

/* Podium */
.scoreboard tbody tr.rank-1 td { background: rgba(255,193,7,0.06); }
.scoreboard tbody tr.rank-2 td { background: rgba(158,158,184,0.04); }
.scoreboard tbody tr.rank-3 td { background: rgba(200,121,65,0.04); }
.scoreboard tbody tr.rank-1:hover td { background: rgba(255,193,7,0.12); }
.scoreboard tbody tr.rank-2:hover td { background: rgba(158,158,184,0.08); }
.scoreboard tbody tr.rank-3:hover td { background: rgba(200,121,65,0.08); }

.rank-medal { font-size: 1.3rem; line-height: 1; }
.scoreboard .rank { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.scoreboard .pts  {
  font-weight: 900;
  color: var(--lime);
  font-size: 1.3rem;
  text-align: right;
  white-space: nowrap;
}
.scoreboard .pts-detail { color: var(--muted); font-size: .88rem; text-align: right; }
.pts-unit { font-size: .75rem; color: var(--muted); font-weight: 400; margin-left: .15rem; }

/* Nom joueur dans le tableau */
.player-cell { display: flex; align-items: center; gap: .5rem; }
.player-name { font-weight: 700; }
.player-me   { font-size: .78rem; color: var(--lime); background: var(--lime-dim); padding: .1rem .4rem; border-radius: 10px; }

/* ── Onglets ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .15rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: .6rem 1.2rem;
  color: var(--muted);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--lime); border-bottom-color: var(--lime); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Groupe header ────────────────────────────────────────────── */
.group-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}
.group-letter-badge {
  width: 2.8rem;
  height: 2.8rem;
  background: linear-gradient(135deg, var(--lime), var(--magenta));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 0 15px var(--lime-glow);
}
.group-info { flex: 1; }
.group-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.group-teams-list {
  font-size: .95rem;
  color: var(--text);
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .2rem;
}
.group-team-pill {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-weight: 600;
}
.group-team-pill .flag { font-size: 1.1rem; }

/* ── Match row ────────────────────────────────────────────────── */
.matches-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: .5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: var(--surface2); }

.match-team {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.05rem;
}
.match-team.home { justify-content: flex-end; text-align: right; }
.match-team.away { justify-content: flex-start; }
.team-flag { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }

.match-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  min-width: 140px;
  padding: 0 .75rem;
}
.match-inputs {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.score-input {
  width: 3rem;
  height: 2.6rem;
  text-align: center;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 900;
  padding: 0;
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-input:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-dim); }
.score-input:disabled { opacity: .4; cursor: not-allowed; }
.score-sep { color: var(--muted); font-size: 1.3rem; font-weight: 900; }

.actual-score { font-size: .78rem; color: var(--muted); letter-spacing: .04em; }

/* Badge de points par match */
.match-pts-badge {
  font-size: .75rem;
  font-weight: 800;
  padding: .15rem .45rem;
  border-radius: 10px;
  display: inline-block;
  letter-spacing: .05em;
}
.pts-badge-5 { background: rgba(180,255,0,0.2);  color: var(--lime);    border: 1px solid rgba(180,255,0,0.4); }
.pts-badge-3 { background: rgba(0,230,118,0.15); color: var(--green);   border: 1px solid rgba(0,230,118,0.3); }
.pts-badge-2 { background: rgba(100,160,255,0.12); color: #8ab4ff;      border: 1px solid rgba(100,160,255,0.25); }
.pts-badge-0 { background: transparent;            color: var(--muted);  border: 1px solid var(--border); }

/* ── Mini classement de groupe ─────────────────────────────────── */
.standings-mini {
  margin: .5rem 0 1rem;
  background: var(--surface2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.standings-mini-row {
  display: grid;
  grid-template-columns: 1.8rem 1.6rem 1fr 2.2rem 2.2rem 2.8rem;
  align-items: center;
  gap: .25rem .5rem;
  padding: .4rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.standings-mini-row:last-child { border-bottom: none; }
.standings-mini-row.header {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--surface3);
}
.sm-pos  { color: var(--muted); }
.sm-qual { color: var(--lime); font-weight: 700; }
.sm-flag { font-size: 1.1rem; }
.sm-name { font-weight: 600; }
.sm-num  { text-align: right; color: var(--muted); }
.sm-pts  { text-align: right; font-weight: 900; color: var(--lime); }

/* ── Sélecteur équipes knockout ─────────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .4rem;
}
.team-check { display: none; }
.team-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .8rem;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  transition: all .12s;
}
.team-label:hover { border-color: var(--border-hi); background: var(--surface3); }
.team-label .flag-lg { font-size: 1.4rem; flex-shrink: 0; }
.team-check:checked + .team-label {
  border-color: var(--lime);
  background: rgba(180,255,0,0.08);
  color: var(--lime);
  box-shadow: 0 0 0 1px rgba(180,255,0,0.2);
}
.team-check.is-radio:checked + .team-label {
  border-color: var(--magenta);
  background: var(--mag-dim);
  color: var(--magenta);
  box-shadow: 0 0 0 1px rgba(255,0,204,0.2);
}
.seeded-star { font-size: .7rem; color: var(--gold); }
.team-group-header {
  grid-column: 1 / -1;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .6rem 0 .2rem;
  border-bottom: 1px solid var(--border);
  margin-top: .5rem;
}

/* Titre de stade (phase finale) */
.stage-section { margin-bottom: 2.5rem; }
.stage-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--magenta);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.stage-count {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface2);
  padding: .1rem .6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.stage-count.over { color: var(--red); border-color: rgba(255,45,85,0.4); background: rgba(255,45,85,0.08); }

/* ── Admin ────────────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num   { font-size: 2.8rem; font-weight: 900; color: var(--lime); line-height: 1; }
.stat-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; margin-top: .3rem; }

/* ── Filtres ligue ────────────────────────────────────────────── */
.league-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }

/* ── Barre de sauvegarde sticky ─────────────────────────────────── */
.save-bar {
  position: sticky;
  bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(4,4,10,0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
  z-index: 10;
}
.autosave-status { font-size: .85rem; color: var(--muted); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 700px) {
  .site-logo { font-size: 1.35rem; }
  .nav-link  { font-size: .82rem; padding: .28rem .55rem; }
  .lb-event  { font-size: 1.5rem; }
  .lb-trophy { font-size: 3rem; }
  .page-title { font-size: 1.7rem; }

  .match-row {
    grid-template-columns: 1fr auto 1fr;
    padding: .6rem .6rem;
    gap: .25rem;
  }
  .match-team { font-size: .88rem; }
  .team-flag  { font-size: 1.2rem; }
  .score-input { width: 2.5rem; height: 2.2rem; font-size: 1.2rem; }

  .scoreboard th, .scoreboard td { padding: .5rem .5rem; font-size: .9rem; }
  .group-letter-badge { width: 2.2rem; height: 2.2rem; font-size: 1.1rem; }

  .team-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
