/* =====================================================
   MUNDIAL 2026 — style.css
   ===================================================== */

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

:root {
  --grad: linear-gradient(135deg, #bf5af2 0%, #ff375f 100%);
  --grad-hover: linear-gradient(135deg, #ca6ef5 0%, #ff5272 100%);
  --green: #30d158; --green-bg: rgba(48,209,88,.13);
  --red:   #ff453a; --red-bg:   rgba(255,69,58,.13);
  --gold:  #f5a623; --gold-bg:  rgba(245,166,35,.13);
  --silver:#9ba3af; --silver-bg:rgba(155,163,175,.13);
  --bronze:#cd7f32; --bronze-bg:rgba(205,127,50,.13);
  --purple:#bf5af2; --purple-bg:rgba(191,90,242,.13);
  --radius: 12px; --radius-lg: 18px; --radius-xl: 24px;
  --ease: .18s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:      #000000;
  --surface: #1c1c1e;
  --surface2:#2c2c2e;
  --surface3:#3a3a3c;
  --border:  rgba(255,255,255,.08);
  --border2: rgba(255,255,255,.15);
  --text:    #f5f5f7;
  --text2:   rgba(245,245,247,.75);
  --text3:   rgba(245,245,247,.50);
  --text4:   rgba(245,245,247,.30);
  --nav-bg:  rgba(0,0,0,.75);
  --accent:  #bf5af2;
}
[data-theme="light"] {
  --bg:      #f5f5f7;
  --surface: #ffffff;
  --surface2:#f5f5f7;
  --surface3:#e8e8ed;
  --border:  rgba(0,0,0,.08);
  --border2: rgba(0,0,0,.15);
  --text:    #1d1d1f;
  --text2:   rgba(29,29,31,.75);
  --text3:   rgba(29,29,31,.50);
  --text4:   rgba(29,29,31,.30);
  --nav-bg:  rgba(245,245,247,.82);
  --accent:  #9b35d4;
  --grad: linear-gradient(135deg,#9b35d4 0%,#e0245e 100%);
  --grad-hover: linear-gradient(135deg,#ab45e4 0%,#f0345e 100%);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1020px; margin: 0 auto;
  padding: 0 20px; height: 54px;
  display: flex; align-items: center; gap: 4px;
}
.nav-logo {
  font-weight: 700; font-size: 17px; letter-spacing: -.4px;
  color: var(--text); margin-right: 12px; flex-shrink: 0;
}
.nav-logo span {
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link {
  padding: 6px 11px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text3);
  transition: color var(--ease), background var(--ease);
  cursor: pointer; user-select: none;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--text); background: var(--surface2); }
.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-username { font-size: 13px; color: var(--text3); font-weight: 500; }
.theme-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); transition: all var(--ease);
}
.theme-btn:hover { background: var(--surface2); color: var(--text); }
.logout-btn {
  padding: 5px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  color: var(--text3); border: 1px solid var(--border2);
  transition: all var(--ease);
}
.logout-btn:hover { color: var(--text); background: var(--surface2); }

/* ── PAGE WRAPPER ── */
.page { max-width: 1020px; margin: 0 auto; padding: 36px 20px 80px; }
.page-title {
  font-size: 28px; font-weight: 700; letter-spacing: -.5px;
  margin-bottom: 4px;
}
.page-sub { font-size: 14px; color: var(--text3); margin-bottom: 28px; }

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
}
.stat-num { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat-lbl { font-size: 11px; color: var(--text3); margin-top: 3px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; }

/* ── BUTTONS ── */
.btn { padding: 9px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; transition: all var(--ease); }
.btn-grad { background: var(--grad); color: #fff; border: none; }
.btn-grad:hover { background: var(--grad-hover); }
.btn-grad:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--surface3); }
.btn-full { width: 100%; padding: 12px; border-radius: 10px; font-size: 15px;
  font-weight: 600; background: var(--grad); color: #fff; border: none;
  transition: all var(--ease); margin-top: 4px; }
.btn-full:hover { background: var(--grad-hover); }
.btn-full:disabled { opacity: .45; cursor: not-allowed; }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text3); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color var(--ease);
}
.form-input:focus { border-color: var(--accent); }

/* ── ALERTS ── */
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,69,58,.25); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(48,209,88,.25); }
.alert-info { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(191,90,242,.25); }

/* ── TABS ── */
.tabs {
  display: flex; gap: 2px; background: var(--surface2);
  border-radius: 10px; padding: 3px; margin-bottom: 24px; width: fit-content;
}
.tab {
  padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text3); transition: all var(--ease); cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.tab:hover:not(.active) { color: var(--text2); }

/* ── FILTERS ── */
.filters { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  color: var(--text3); border: 1px solid var(--border2); transition: all var(--ease); cursor: pointer;
}
.filter-btn:hover { color: var(--text); background: var(--surface2); }
.filter-btn.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ── MATCH CARD ── */
.match-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  transition: border-color var(--ease); margin-bottom: 10px;
}
.match-card:hover { border-color: var(--border2); }
.match-card.open { border-left: 2px solid var(--green); }
.match-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.match-stage-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text4); }
.match-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.match-badge.open    { background: var(--green-bg);   color: var(--green); }
.match-badge.closed  { background: var(--red-bg);     color: var(--red); }
.match-badge.finished{ background: var(--surface2);   color: var(--text3); }
.match-badge.live    { background: var(--gold-bg);    color: var(--gold); }
.match-teams { display: flex; align-items: center; gap: 10px; }
.team-flag { font-size: 26px; line-height: 1; }
.team-name { flex: 1; font-size: 15px; font-weight: 600; }
.team-name.home { text-align: right; }
.score-box { min-width: 72px; text-align: center; }
.score-val { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.score-vs  { font-size: 13px; font-weight: 600; color: var(--text4); }
.match-time { font-size: 12px; color: var(--text4); margin-top: 10px; text-align: center; }
.bet-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.bet-input {
  width: 52px; padding: 7px 8px; border-radius: 8px; text-align: center;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); font-size: 15px; font-weight: 700; outline: none;
  transition: border-color var(--ease);
}
.bet-input:focus { border-color: var(--accent); }
.bet-sep { font-size: 14px; font-weight: 700; color: var(--text4); }
.bet-save-btn {
  padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--grad); color: #fff; border: none; transition: all var(--ease); margin-left: 6px;
}
.bet-save-btn:hover { background: var(--grad-hover); }
.bet-edit-btn {
  margin-left: auto; padding: 6px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 600; background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border2); transition: all var(--ease);
}
.bet-edit-btn:hover { background: var(--surface3); }
.bet-current { font-size: 13px; color: var(--text3); }
.bet-current strong { color: var(--text); font-weight: 700; }
.pts-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.pts-3 { background: var(--gold-bg);   color: var(--gold); }
.pts-1 { background: var(--purple-bg); color: var(--purple); }
.pts-0 { background: var(--surface2);  color: var(--text4); }

/* ── GROUP LABEL ── */
.group-lbl {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--text4); margin-bottom: 10px; padding-left: 2px;
}

/* ── GROUP TABLE ── */
.group-table { width: 100%; border-collapse: collapse; }
.group-table th {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text4); padding: 10px 14px;
  text-align: left; border-bottom: 1px solid var(--border);
}
.group-table th:not(:first-child):not(:nth-child(2)) { text-align: center; }
.group-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.group-table tr:last-child td { border-bottom: none; }
.group-table td:not(:first-child):not(:nth-child(2)) { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.group-table tr.qualified td:first-child { border-left: 2px solid var(--green); }
.group-table tr.playoff  td:first-child { border-left: 2px solid var(--gold); }
.team-cell { display: flex; align-items: center; gap: 8px; }
.flag-sm { font-size: 17px; }

/* ── RANKING ── */
.rank-row {
  display: flex; align-items: center; padding: 13px 20px;
  border-bottom: 1px solid var(--border); transition: background var(--ease);
  cursor: default;
}
.rank-row:last-child { border-bottom: none; }
.rank-row:hover { background: var(--surface2); }
.rank-medal { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.rank-medal.gold   { background: var(--gold-bg); }
.rank-medal.silver { background: var(--silver-bg); }
.rank-medal.bronze { background: var(--bronze-bg); }
.rank-pos { width: 30px; font-size: 13px; font-weight: 700; color: var(--text4); flex-shrink: 0; }
.rank-name { flex: 1; font-weight: 600; font-size: 14px; padding: 0 12px; }
.rank-you { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--purple-bg); color: var(--purple); margin-left: 8px; }
.rank-pts-col { text-align: right; }
.rank-pts { font-size: 15px; font-weight: 700; }
.rank-meta { font-size: 11px; color: var(--text4); margin-top: 1px; }
.rank-me-highlight { background: rgba(191,90,242,.06); border-radius: var(--radius-lg); margin-bottom: 14px; overflow: hidden; }

/* ── BRACKET ── */
.bracket-wrap { overflow-x: auto; padding-bottom: 16px; }
.bracket { display: flex; gap: 14px; align-items: center; min-width: 920px; padding: 20px 0; }
.bracket-col { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.bracket-col-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--text4); text-align: center; margin-bottom: 6px; }
.bracket-match {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; width: 148px; overflow: hidden; transition: border-color var(--ease);
}
.bracket-match:hover { border-color: var(--border2); }
.bracket-match.is-final { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(245,166,35,.2); }
.bracket-match.is-third { border-color: var(--bronze); }
.bracket-team {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px;
  font-size: 12px; font-weight: 500;
}
.bracket-team + .bracket-team { border-top: 1px solid var(--border); }
.bracket-team .b-flag { font-size: 14px; flex-shrink: 0; }
.bracket-team .b-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.bracket-team .b-score { font-size: 13px; font-weight: 700; color: var(--text); min-width: 16px; text-align: right; }
.bracket-team.winner .b-name { color: var(--text); font-weight: 700; }
.bracket-date { font-size: 10px; color: var(--text4); text-align: center; padding: 3px 0 5px; border-top: 1px solid var(--border); background: var(--surface2); }
.bracket-trophy { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; width: 120px; gap: 6px; }
.bracket-trophy-icon { font-size: 32px; }
.bracket-trophy-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text4); }

/* ── ADMIN ── */
.admin-match-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 8px;
}
.admin-match-row.open { border-left: 2px solid var(--green); }
.admin-teams { font-weight: 600; font-size: 14px; flex: 1; min-width: 180px; }
.admin-meta { font-size: 12px; color: var(--text3); }
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: var(--surface3); border-radius: 12px; transition: background var(--ease); cursor: pointer; }
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform var(--ease); pointer-events: none; }
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }
.score-wrap { display: flex; align-items: center; gap: 6px; }
.score-inp {
  width: 44px; padding: 5px; border-radius: 6px; text-align: center;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); font-size: 14px; font-weight: 700; outline: none;
}
.score-inp:focus { border-color: var(--accent); }
.score-colon { font-weight: 700; color: var(--text3); }
.score-save-btn {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--grad); color: #fff; border: none; transition: all var(--ease);
}
.score-save-btn:hover { background: var(--grad-hover); }
.user-row { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.user-row:last-child { border-bottom: none; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--text3); flex-shrink: 0; }
.user-info { flex: 1; }
.user-name-row { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.user-email-row { font-size: 12px; color: var(--text3); }
.user-badge { font-size: 10px; padding: 2px 7px; border-radius: 20px; font-weight: 700; }
.user-badge.admin   { background: var(--purple-bg); color: var(--purple); }
.user-badge.active  { background: var(--green-bg);  color: var(--green); }
.user-badge.pending { background: var(--gold-bg);   color: var(--gold); }
.delete-btn { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text4); transition: all var(--ease); flex-shrink: 0; }
.delete-btn:hover { background: var(--red-bg); color: var(--red); }
.invite-box { font-size: 12px; font-family: monospace; background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px; padding: 10px 14px; word-break: break-all; color: var(--text3); margin-top: 8px; }
.copy-btn { padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface3); color: var(--text2); border: none; transition: all var(--ease); flex-shrink: 0; cursor: pointer; }
.copy-btn:hover { background: var(--grad); color: #fff; }

/* ── SPINNER ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 28px; height: 28px; border: 2.5px solid var(--surface3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 48px auto; }
.spinner-sm { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle; margin-right: 6px; }

/* ── EMPTY ── */
.empty { text-align: center; padding: 60px 20px; color: var(--text4); }
.empty-icon { font-size: 38px; margin-bottom: 12px; }
.empty-txt  { font-size: 14px; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 36px 32px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ── SECTION TITLE ── */
.section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text4); margin-bottom: 12px; }

/* ── BROADCAST ── */
.broadcast-textarea { width: 100%; padding: 10px 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border2); color: var(--text); font-size: 14px; outline: none; resize: vertical; min-height: 120px; transition: border-color var(--ease); }
.broadcast-textarea:focus { border-color: var(--accent); }

/* ── FADE IN ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .28s ease forwards; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { overflow-x: auto; }
  .nav-link { font-size: 12px; padding: 5px 8px; white-space: nowrap; }
  .match-teams { gap: 6px; }
  .team-flag { font-size: 20px; }
  .bracket { min-width: 700px; }
}
