/* =====================================================================
   SUMED 2026 — Design System (fiel aos protótipos: bottom nav, grafite
   escuro, acentos dourados). Tokens baseados no DESIGN.md.
   ===================================================================== */
:root {
  --bg: #111415;
  --surface: #191c1d;
  --surface-high: #282a2b;
  --surface-highest: #323536;
  --border: #43474e;
  --border-soft: rgba(255,255,255,0.06);
  --gold: #e9c349;
  --gold-bright: #ffd700;
  --gold-glow: rgba(233, 195, 73, 0.18);
  --silver: #c6c6c6;
  --silver-glow: rgba(198, 198, 198, 0.15);
  --danger: #ffb4ab;
  --danger-strong: #ef4444;
  --text: #e1e3e4;
  --text-muted: #94a3b8;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif; }
html, body { background: var(--bg); }
body {
  color: var(--text); min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  padding-top: env(safe-area-inset-top);
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 14px);
}

h1, h2, h3, h4, .headline { font-family: 'Montserrat', 'Segoe UI', sans-serif; font-weight: 800; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------------
   TOP BAR
--------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; background: rgba(17,20,21,0.9); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--border-soft);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--bg); font-weight: 800; font-size: 0.65rem; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.topbar-logo img { width: 100%; height: 100%; object-fit: cover; }
.topbar-title { font-size: 1.1rem; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.01em; }
.topbar-icon { background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.topbar-back { background: none; border: none; color: var(--text); font-size: 1.3rem; cursor: pointer; }

/* ---------------------------------------------------------------------
   BOTTOM NAV
--------------------------------------------------------------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(17,20,21,0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-soft);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav-item {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 0.65rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm);
  flex: 1; max-width: 90px;
}
.bottom-nav-item .icon { font-size: 1.25rem; line-height: 1; }
.bottom-nav-item.active { color: var(--gold); }

/* ---------------------------------------------------------------------
   CONTAINER & CARDS
--------------------------------------------------------------------- */
.container { max-width: 480px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px;
}
.card-accent { border-left: 3px solid var(--gold); }
.card-title { color: var(--text); font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.section-label { font-size: 1.3rem; font-weight: 800; margin: 4px 0 4px; }
.section-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 16px; }

/* ---------------------------------------------------------------------
   PILL TOGGLE (Masculino/Feminino, Ouro/Prata)
--------------------------------------------------------------------- */
.pill-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.pill-btn {
  flex: 1; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-weight: 700; font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 0.02em; cursor: pointer; text-align: center;
}
.pill-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.pill-btn .badge-icon { margin-right: 4px; }

/* ---------------------------------------------------------------------
   HOME — Próxima Rodada (hero)
--------------------------------------------------------------------- */
.hero-card { text-align: center; padding: 24px 18px; }
.hero-vs { display: flex; align-items: center; justify-content: space-around; margin: 14px 0; }
.hero-team { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hero-shield { width: 64px; height: 64px; border-radius: var(--radius-md); background: var(--surface-high); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; overflow: hidden; }
.hero-shield img { width: 100%; height: 100%; object-fit: cover; }
.hero-team-name { font-weight: 700; font-size: 0.95rem; }
.hero-meta { color: var(--gold); font-weight: 800; font-size: 0.85rem; text-transform: uppercase; margin: 10px 0 6px; letter-spacing: 0.03em; }
.hero-tag { display: inline-block; border: 1px solid var(--gold); color: var(--gold); padding: 4px 12px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; margin-bottom: 8px; }
.hero-location { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 16px; }

.quick-card { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.quick-icon { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--surface-high); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--gold); }
.quick-body { flex: 1; }
.quick-title { font-weight: 700; font-size: 0.95rem; }
.quick-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.quick-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* ---------------------------------------------------------------------
   PATROCINADORES
--------------------------------------------------------------------- */
.sponsors-block { margin-top: 8px; }
.sponsors-block .section-label { font-size: 1rem; margin-bottom: 10px; }
.sponsors-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.sponsor-card {
  flex: 0 0 auto; width: 150px; height: 64px; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; padding: 10px;
}
.sponsor-card img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------------------------------------------------------------------
   TABELA (classificação)
--------------------------------------------------------------------- */
.standings-wrap { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow: hidden; }
table.standings { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.standings th {
  background: var(--surface-high); color: var(--text-muted); text-transform: uppercase;
  font-size: 0.68rem; letter-spacing: 0.05em; padding: 10px 6px; font-weight: 700;
}
table.standings td { padding: 12px 6px; text-align: center; border-top: 1px solid var(--border-soft); }
table.standings td:nth-child(2) { text-align: left; font-weight: 700; }
table.standings .pos-cell { font-weight: 800; }
tr.zone-ouro td:first-child { border-left: 3px solid var(--gold); }
tr.zone-ouro .pos-cell { color: var(--gold); }
tr.zone-prata td:first-child { border-left: 3px solid var(--silver); }
tr.zone-elim td:first-child { border-left: 3px solid var(--danger-strong); }
tr.zone-elim { opacity: 0.75; }
tr.zone-elim td:nth-child(2) { text-decoration: line-through; }
.pts-cell { color: var(--gold); font-weight: 800; }

/* ---------------------------------------------------------------------
   RODADAS / JOGOS
--------------------------------------------------------------------- */
.round-selector { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; background: var(--surface); padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-soft); }
.round-btn { background: var(--surface-high); border: none; color: var(--text); font-weight: 700; padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem; }
.match-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px; }
.match-meta { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); border-bottom: 1px solid var(--border-soft); padding-bottom: 8px; margin-bottom: 8px; }
.match-teams { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.team-box { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
.team-box.away { justify-content: flex-end; }
.score { font-size: 1.15rem; font-weight: 800; color: var(--gold-bright); background: var(--surface-high); padding: 4px 12px; border-radius: var(--radius-sm); }
.bye-card { background: var(--surface); border: 1px dashed var(--border); text-align: center; padding: 10px; color: var(--text-muted); font-size: 0.85rem; margin-top: 8px; border-radius: var(--radius-md); }

/* ---------------------------------------------------------------------
   CHAVES (mata-mata)
--------------------------------------------------------------------- */
.bracket-stage-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; margin: 18px 0 10px; }
.bracket-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; position: relative; overflow: hidden; }
.bracket-card.winner-a::before, .bracket-card.winner-b::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.bracket-card-id { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.bracket-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.bracket-row .team-name { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
.bracket-row.winner .team-name { color: var(--text); font-weight: 700; }
.bracket-row .team-score { font-weight: 800; color: var(--text-muted); font-size: 0.95rem; }
.bracket-row.winner .team-score { color: var(--gold-bright); }
.bracket-trophy { text-align: center; font-size: 2rem; margin: 18px 0 4px; filter: drop-shadow(0 0 8px var(--gold-glow)); }

/* ---------------------------------------------------------------------
   EQUIPES (grid + perfil)
--------------------------------------------------------------------- */
.teams-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.team-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 16px 10px; text-align: center; cursor: pointer; }
.team-tile-shield { width: 52px; height: 52px; border-radius: var(--radius-sm); background: var(--surface-high); margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; overflow: hidden; }
.team-tile-shield img { width: 100%; height: 100%; object-fit: cover; }
.team-tile-name { font-weight: 700; font-size: 0.85rem; }

.team-header { text-align: center; padding: 28px 18px; border: 1px solid var(--gold); border-radius: var(--radius-lg); background: var(--surface); position: relative; }
.team-header-shield { width: 84px; height: 84px; border-radius: var(--radius-md); margin: 0 auto 14px; overflow: hidden; box-shadow: 0 0 20px var(--gold-glow); }
.team-header-shield img { width: 100%; height: 100%; object-fit: cover; }
.team-header-name { color: var(--gold); font-size: 1.5rem; font-weight: 800; text-transform: uppercase; line-height: 1.15; }
.team-header-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }
.team-header-tags { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.team-tag { background: var(--surface-high); color: var(--text); padding: 6px 12px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 14px; }
.stat-label { color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--gold); }
.stat-value small { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }

.discipline-card { display: flex; align-items: center; gap: 22px; margin-top: 14px; }
.discipline-item { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; }
.chip { width: 16px; height: 22px; border-radius: 3px; display: inline-block; }
.chip-yellow { background: var(--gold); }
.chip-red { background: var(--danger-strong); }

.form-strip { display: flex; gap: 8px; margin-top: 12px; }
.form-dot { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; }
.form-dot.V { background: rgba(233,195,73,0.18); color: var(--gold); }
.form-dot.E { background: var(--surface-high); color: var(--text-muted); }
.form-dot.D { background: rgba(239,68,68,0.18); color: var(--danger-strong); }

.roster-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 8px; }
.roster-item.captain { border-left: 3px solid var(--gold); }
.roster-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-high); display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.roster-avatar img { width: 100%; height: 100%; object-fit: cover; }
.roster-name { font-weight: 700; font-size: 0.9rem; }
.roster-role { color: var(--text-muted); font-size: 0.78rem; }
.roster-cards { margin-left: auto; font-size: 0.8rem; }

/* ---------------------------------------------------------------------
   FORM ELEMENTS (compartilhado admin + público)
--------------------------------------------------------------------- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.form-control { width: 100%; padding: 11px; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); font-size: 0.9rem; }
.form-control:focus { outline: none; border-color: var(--gold); }
.btn-action { background: var(--gold); color: var(--bg); border: none; padding: 12px 18px; font-weight: 800; border-radius: var(--radius-sm); cursor: pointer; text-transform: uppercase; font-size: 0.82rem; letter-spacing: 0.02em; }
.btn-action:hover { background: var(--gold-bright); }
.btn-action:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: transparent; border: 1px solid var(--gold); color: var(--gold); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; }
.btn-secondary:hover { background: rgba(233,195,73,0.08); }
.btn-remove { background: none; border: none; color: var(--danger-strong); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }

/* Uploads / elenco dinâmico (admin) */
.upload-field { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.upload-preview { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--bg); }
.jogador-row { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; }
.jogador-row .form-control { flex: 1; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); align-items: flex-end; justify-content: center; z-index: 200; }
.modal.active { display: flex; }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; max-width: 480px; padding: 20px; max-height: 85vh; overflow-y: auto; }

@media (min-width: 540px) {
  .modal { align-items: center; }
  .modal-content { border-radius: var(--radius-lg); }
}

/* =====================================================================
   ADMIN — extras específicos (reaproveita topbar/.bottom-nav/.screen
   já definidos acima para o app público)
   ===================================================================== */
.menu-list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  margin-bottom: 10px;
}
.menu-list-item .quick-icon { width: 40px; height: 40px; font-size: 1.1rem; }
.menu-list-item .quick-title { font-size: 0.9rem; }
.round-accordion-header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  cursor: pointer; margin-bottom: 8px; font-weight: 700;
}
.round-accordion-header.open { border-color: var(--gold); }
.round-accordion-body { display: none; padding: 4px 0 12px; }
.round-accordion-body.open { display: block; }
.badge-role {
  display: inline-block; background: var(--surface-high); color: var(--gold);
  padding: 3px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
}

