/* =============================================
   BOLÃO COPA DO MUNDO 2026 — styles.css
   Mobile-first, dark theme, CSS variables
   ============================================= */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --accent: #238636;
  --accent-hover: #2ea043;
  --gold: #f0c040;
  --red: #da3633;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--accent); color: #56d364; }
.toast.error   { border-color: var(--red);    color: #ff7b72; }

/* ---- LOADING ---- */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(13,17,23,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
}
.loading-overlay.hidden { display: none; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- HELPERS ---- */
.hidden { display: none !important; }
.muted  { color: var(--text-muted); font-size: .9rem; }
.error-msg { color: #ff7b72; font-size: .85rem; margin-top: 6px; }

/* ---- SCREENS ---- */
.screen { min-height: 100vh; }

/* =============================================
   AUTH SCREEN
   ============================================= */
#auth-screen {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 60px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo { font-size: 3rem; margin-bottom: 8px; }
.auth-header h1 { font-size: 1.75rem; font-weight: 700; }
.auth-header p  { color: var(--text-muted); margin-top: 4px; }

.auth-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.auth-tab.active {
  background: var(--surface2);
  color: var(--text);
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-hover);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.btn-full { width: 100%; }
.btn-sm  { padding: 7px 13px; font-size: .85rem; }

/* ---- PUBLIC RANKING ---- */
.public-ranking-box {
  margin-top: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.public-ranking-box h2 { font-size: 1rem; margin-bottom: 12px; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.rank-row:last-child { border-bottom: none; }
.rank-pos {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}
.rank-pos.gold   { background: var(--gold); color: #000; }
.rank-pos.silver { background: #9e9e9e; color: #000; }
.rank-pos.bronze { background: #cd7f32; color: #000; }
.rank-name  { flex: 1; font-weight: 500; font-size: .9rem; }
.rank-pts   { font-weight: 700; color: var(--gold); font-size: .9rem; }

/* =============================================
   DASHBOARD
   ============================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 8px;
}
.header-title { font-size: 1.1rem; font-weight: 700; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 8px; }
.user-info { display: flex; align-items: center; gap: 6px; }
.hdr-username { font-size: .85rem; color: var(--text-muted); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

/* NAV TABS */
.nav-tabs {
  display: flex;
  padding: 0 8px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.nav-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* CONTENT SECTIONS */
.content-section { padding: 0 0 80px; }
.section-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.section-header h2 { font-size: 1.2rem; font-weight: 700; }
.section-header p  { color: var(--text-muted); font-size: .85rem; margin-top: 3px; }

/* SAVE BAR */
.save-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  z-index: 50;
  display: flex;
  gap: 8px;
}
.save-bar .btn { flex: 1; }

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* =============================================
   GRUPO — lista compacta (coluna única)
   ============================================= */
.group-panel {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Card de cada grupo */
.group-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-section-header {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}

.group-label {
  font-size: .88rem;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
}

.group-teams-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.team-badge {
  font-size: .73rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

/* ---- GAME ROW — linha compacta única ---- */
.game-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}
.game-row:last-child { border-bottom: none; }

.team-cell {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 600;
  overflow: hidden;
}
.team-cell.away {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

/* Bandeira via flag-icons */
.team-flag-icon {
  width: 18px !important;
  height: 13px !important;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
  background-size: cover !important;
}

.team-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .8rem;
  letter-spacing: .01em;
}

/* ---- SCORE STEPPER horizontal: [−][val][+] ---- */
.score-stepper {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  height: 34px;
}

.step-btn {
  width: 30px;
  height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}
.step-btn.step-down {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.step-btn.step-up {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.step-btn:active { background: var(--accent); color: #fff; border-color: var(--accent); }

.score-val {
  width: 30px;
  height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: none;
  border-right: none;
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}
.score-val.filled {
  background: rgba(35,134,54,.12);
  color: var(--text);
  border-color: var(--accent);
}
/* Faz as bordas dos botões ao lado do filled também ficarem verdes */
.score-val.filled + .step-btn { border-color: var(--accent); }

.score-sep {
  color: var(--text-muted);
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}

/* =============================================
   DIVISOR GRUPOS → MATA-MATA
   ============================================= */
.section-divider {
  margin: 8px 0 0;
  background: linear-gradient(135deg, #1a1f2e 0%, #0d1117 100%);
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--border);
}
.section-divider-inner {
  padding: 18px 16px 14px;
}
.section-divider-inner h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-divider-inner p {
  color: var(--text-muted);
  font-size: .82rem;
  margin-top: 3px;
}

/* =============================================
   KNOCKOUT BRACKET — responsivo, ocupa toda a largura
   ============================================= */
.ko-status-bar {
  padding: 6px 14px;
  min-height: 24px;
}
.ko-status { font-size: .82rem; color: var(--accent); }

.knockout-bracket {
  width: 100%;
  padding: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.bracket-rounds {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
}

/* Cada coluna ocupa 1/5 da tela mínimo — responsivo */
.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 100px;
  scroll-snap-align: start;
}

.round-title {
  font-size: .62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  padding: 3px 2px 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.bracket-team {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 500;
  min-height: 32px;
  overflow: hidden;
}
.bt-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bracket-team:last-child { border-bottom: none; }
.bracket-team:hover:not(.tbd):not(.selected) { background: var(--surface2); }
.bracket-team.selected {
  background: rgba(35,134,54,.2);
  border-left: 3px solid var(--accent);
  color: #56d364;
  font-weight: 700;
}
.bracket-team.tbd {
  color: var(--text-muted);
  cursor: default;
  font-style: italic;
}
.bracket-team .tf { font-size: .88rem; flex-shrink: 0; }

/* WhatsApp button no header */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-whatsapp:hover { opacity: .85; transform: scale(1.08); }
.btn-whatsapp svg { width: 17px; height: 17px; }
.btn-whatsapp.hidden { display: none; }

/* Admin: unlock toggle rápido */
.admin-unlock-quick {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-unlock-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-unlock-row select {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .88rem;
}
.admin-unlock-status {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =============================================
   CLASSIFICAÇÃO OFICIAL (API-Football)
   ============================================= */
#standings-content {
  padding-bottom: 20px;
}

.standings-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}

.standings-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  margin: 12px 16px;
  background: rgba(240,192,64,.07);
  border: 1px solid rgba(240,192,64,.2);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.standings-notice-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.standings-notice strong { color: var(--gold); }

.standings-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
}

.standings-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.standings-group-header {
  background: var(--surface2);
  padding: 10px 14px;
  font-weight: 800;
  font-size: .95rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
}

.standings-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tabela estilo FIFA */
.fifa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 380px;
}
.fifa-table thead tr {
  background: var(--surface2);
}
.fifa-table th {
  padding: 7px 8px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: .75rem;
  white-space: nowrap;
}
.fifa-table .col-pos { width: 32px; }
.fifa-table .col-team { text-align: left; min-width: 140px; }
.fifa-table .col-pts { font-size: .85rem; }

.fifa-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-size: .82rem;
}
.fifa-table td.col-pos { color: var(--text-muted); font-size: .8rem; }
.fifa-table td.col-pts strong { color: var(--text); font-weight: 700; }
.fifa-table tbody tr:last-child td { border-bottom: none; }

/* Linhas qualificadas */
.fifa-table .q-1 { background: rgba(35,134,54,.14); }
.fifa-table .q-2 { background: rgba(35,134,54,.07); }
.fifa-table .q-3 { background: rgba(240,192,64,.06); }

.team-cell-st {
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
}
.team-logo-sm {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}
.team-flag-lg { font-size: 1.1rem; flex-shrink: 0; }
.team-name-st {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Legenda qualificação */
.qual-legend {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: .72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface2);
  gap: 4px;
}
.ql {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ql.q1 { background: rgba(35,134,54,.6); }
.ql.q3 { background: rgba(240,192,64,.6); }

.standings-source {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  padding: 8px 16px 4px;
}

/* =============================================
   RANKING
   ============================================= */
#ranking-content { padding: 16px; }

.ranking-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.ranking-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.ranking-row:last-child { border-bottom: none; }
.ranking-row.me { background: rgba(35,134,54,.08); }
.ranking-row .pos { font-weight: 700; font-size: .95rem; }
.ranking-row .name { font-weight: 500; }
.ranking-row .pts { font-weight: 700; color: var(--gold); font-size: 1rem; }

.ranking-breakdown {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.breakdown-item {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.scoring-legend h3 { font-size: .95rem; margin-bottom: 10px; }
.scoring-legend ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.scoring-legend li { font-size: .88rem; color: var(--text-muted); }
.scoring-legend strong { color: var(--gold); }

/* =============================================
   RESPONSIVE — Mobile
   ============================================= */

/* Por padrão (desktop): nome completo visível, abreviado oculto */
.team-name-full  { display: inline; }
.team-name-short { display: none; }

/* Badge no header do grupo: nome completo visível por padrão */
.team-badge-full  { display: inline; }
.team-badge-short { display: none; }

@media (max-width: 540px) {
  /* Em mobile: mostra abreviado, oculta nome completo */
  .team-name-full  { display: none; }
  .team-name-short { display: inline; white-space: nowrap; }

  .team-badge-full  { display: none; }
  .team-badge-short { display: inline; }

  .game-row { padding: 6px 8px; gap: 4px; }

  /* Steppers maiores para toque fácil */
  .step-btn  { width: 36px; height: 38px; font-size: 1rem; }
  .score-val { width: 34px; height: 38px; font-size: 1rem; }

  .header-title  { font-size: 1rem; }
  .hdr-username  { max-width: 70px; }
  .bracket-round { min-width: 140px; }
  .bracket-team  { font-size: .78rem; padding: 7px 5px; }

  .team-name-st  { max-width: 90px; }

  /* Modal apostas — empilha em mobile */
  .bh-game-card  { flex-wrap: wrap; }
  .bh-teams-row  { flex-wrap: wrap; gap: 4px; }
  .bh-team-name  { font-size: .8rem; }

  .bh-ko-card    { flex-wrap: wrap; }
}

/* =============================================
   RESPONSIVE — Desktop
   ============================================= */
@media (min-width: 768px) {
  #auth-screen { padding-top: 60px; }
  .content-section   { max-width: 900px; margin: 0 auto; }
  .header-inner      { max-width: 900px; margin: 0 auto; }
  .nav-tabs          { max-width: 900px; margin: 0 auto; }
  .group-panel       { display: flex; flex-direction: column; gap: 10px; padding: 10px 14px; }
  .save-bar          { padding: 12px calc(50% - 450px + 16px); }
  .ko-toolbar        { max-width: 900px; margin: 0 auto; padding-left: 0; }
  .knockout-bracket  { max-width: 900px; margin: 0 auto; padding: 20px 0; }
  .standings-container { grid-template-columns: 1fr 1fr; display: grid; gap: 16px; }
  .section-divider-inner { max-width: 900px; margin: 0 auto; }
}

/* =============================================
   RANKING — botão de histórico de apostas
   ============================================= */
.ranking-row {
  grid-template-columns: 44px 1fr auto;
}
.ranking-info { min-width: 0; }
.ranking-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.btn-bh {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.btn-bh:hover { background: var(--border); border-color: var(--text-muted); }

/* =============================================
   BLOQUEIO DE APOSTAS — banner
   ============================================= */
.bets-lock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 14px 0;
  padding: 11px 16px;
  background: rgba(240,192,64,.08);
  border: 1px solid rgba(240,192,64,.3);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  color: var(--gold);
  font-weight: 500;
}
.bets-lock-banner span:first-child { font-size: 1rem; flex-shrink: 0; }

/* =============================================
   MODAL — Histórico de Apostas
   ============================================= */
.bh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.bh-modal-overlay.hidden { display: none !important; }

.bh-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  margin: auto;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

.bh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bh-modal-header h2 { font-size: 1rem; font-weight: 700; }
.bh-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  width: 30px; height: 30px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.bh-close:hover { background: var(--surface2); color: var(--text); }

.bh-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
}

.bh-loading {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  padding: 40px;
  color: var(--text-muted); font-size: .9rem;
}

/* Seções do histórico */
.bh-section-title {
  font-weight: 700; font-size: .9rem;
  color: var(--gold);
  margin: 8px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.bh-group-hdr {
  font-size: .78rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 8px 0 2px;
}

/* Linha de jogo */
.bh-game-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  flex-wrap: nowrap;
  min-height: 30px;
}
.bh-exact   { background: rgba(35,134,54,.12);  border-left-color: var(--accent); }
.bh-correct { background: rgba(56,139,253,.1);  border-left-color: #388bfd; }
.bh-wrong   { background: rgba(218,54,51,.08);  border-left-color: var(--red); }
.bh-placed  { background: var(--surface2); }
.bh-pending { opacity: .6; }
.bh-bonus   { background: rgba(240,192,64,.12); border-left-color: var(--gold); }

.bh-si   { width: 18px; flex-shrink: 0; font-size: .85rem; }
.bh-flag { width: 16px !important; height: 12px !important; border-radius: 2px; flex-shrink: 0; }
.bh-tn   { font-weight: 600; white-space: nowrap; }
.bh-bet  { font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.bh-real { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; font-size: .73rem; }
.bh-div  { color: var(--border); flex-shrink: 0; }
.bh-pts  {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}
.bh-round-lbl {
  font-size: .7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.bh-empty { color: var(--text-muted); font-size: .85rem; padding: 10px 0; }

/* Resumo */
.bh-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 10px;
  margin-top: 14px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.bh-total-pts {
  margin-left: auto;
  font-weight: 700;
  font-size: .9rem;
  color: var(--gold);
}

/* =============================================
   ADMIN — painel e tabela de usuários
   ============================================= */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 16px 16px;
  overflow: hidden;
}
.admin-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--gold);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.admin-card-desc {
  font-size: .84rem;
  color: var(--text-muted);
  padding: 12px 16px 6px;
}
.admin-card > .btn { margin: 10px 16px 14px; }

/* Tabela de usuários */
.admin-table { display: flex; flex-direction: column; }

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.admin-user-row:last-child { border-bottom: none; }

.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name  { font-weight: 600; font-size: .88rem; }
.admin-user-email { font-size: .75rem; color: var(--text-muted); }

.admin-user-status {
  font-size: .75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  flex-shrink: 0;
}
.status-locked { background: rgba(240,192,64,.12); color: var(--gold);   border: 1px solid rgba(240,192,64,.3); }
.status-open   { background: rgba(35,134,54,.12);  color: #56d364;       border: 1px solid rgba(35,134,54,.3); }

.admin-user-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--border); }

.btn-adm {
  border: none;
  border-radius: var(--radius-sm);
  font-size: .76rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  transition: opacity var(--transition);
  height: 32px;
}
.btn-adm:disabled { opacity: .4; cursor: not-allowed; }
.btn-adm-unlock { background: rgba(35,134,54,.2);  color: #56d364;  border: 1px solid rgba(35,134,54,.4); }
.btn-adm-lock   { background: rgba(240,192,64,.15); color: var(--gold); border: 1px solid rgba(240,192,64,.3); }
.btn-adm-unlock:hover:not(:disabled) { background: rgba(35,134,54,.35); }
.btn-adm-lock:hover:not(:disabled)   { background: rgba(240,192,64,.28); }

/* =============================================
   PAINEL DE RESULTADOS OFICIAIS (admin)
   ============================================= */

/* Barra de estatísticas */
.res-stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.res-stat {
  font-size: .82rem;
  color: var(--text-muted);
}
.res-stat strong { color: var(--text); }

/* Abas do painel */
.res-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.res-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.res-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.res-tab:hover:not(.active) { color: var(--text); }

/* ---- GRUPOS ---- */
.res-groups-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.res-group {
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.res-group-title {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: var(--surface2);
}

.res-game-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  flex-wrap: nowrap;
  position: relative;
}
.res-game-row.res-has-result {
  background: rgba(35,134,54,.05);
}

/* time (nome + bandeira) */
.res-team {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
  flex-shrink: 0;
  min-width: 0;
}
.res-team.res-home { justify-content: flex-end; flex: 1; }
.res-team.res-away { flex: 1; }
.res-tname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52px;
  font-weight: 500;
}

/* inputs de placar */
.res-score-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.res-score-inp {
  width: 44px;
  height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
  padding: 0 4px;
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-color var(--transition);
}
.res-score-inp::-webkit-inner-spin-button,
.res-score-inp::-webkit-outer-spin-button { -webkit-appearance: none; }
.res-score-inp:focus {
  outline: none;
  border-color: var(--accent);
}
.res-sep {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 700;
}

/* botões de ação por linha */
.res-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.res-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.res-btn:hover:not(:disabled) { background: var(--border); }
.res-btn:disabled { opacity: .4; cursor: not-allowed; }
.res-btn-save:hover:not(:disabled) { border-color: var(--accent); }
.res-btn-clear:hover:not(:disabled) { border-color: var(--red); }

/* badge de confirmação */
.res-badge-saved {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: #56d364;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---- MATA-MATA ---- */
.res-ko-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.res-ko-round {
  border-bottom: 1px solid var(--border);
}
.res-ko-round-title {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: var(--surface2);
  color: var(--gold);
}
.res-ko-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: .82rem;
}
.res-ko-row.res-has-result {
  background: rgba(35,134,54,.05);
}
.res-ko-id {
  font-size: .72rem;
  color: var(--text-muted);
  font-family: monospace;
  min-width: 54px;
  flex-shrink: 0;
}
.res-ko-select {
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .82rem;
  padding: 5px 8px;
  height: 32px;
  cursor: pointer;
}
.res-ko-select:focus { outline: none; border-color: var(--accent); }

/* Loading message */
.res-loading {
  padding: 20px;
  text-align: center;
}

/* =============================================
   GRUPOS — divisor de rodada
   ============================================= */
.round-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.round-label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.round-date {
  font-size: .68rem;
  color: var(--text-muted);
  opacity: .7;
}

/* Resultado oficial inline no game-row */
.official-result-badge {
  font-size: .72rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(35,134,54,.12);
  border: 1px solid rgba(35,134,54,.3);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================
   APOSTAS — modal redesenhado (bh-game-card)
   ============================================= */

/* Bloco de grupo com cor na borda */
.bh-group-block {
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Card de jogo (nova estrutura) */
.bh-game-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  min-height: 44px;
  position: relative;
  transition: background var(--transition);
}
.bh-exact   .bh-game-card,
.bh-game-card.bh-exact   { background: rgba(35,134,54,.10); border-left: 3px solid var(--accent); }
.bh-game-card.bh-correct { background: rgba(56,139,253,.08); border-left: 3px solid #388bfd; }
.bh-game-card.bh-wrong   { background: rgba(218,54,51,.07); border-left: 3px solid var(--red); }
.bh-game-card.bh-placed  { background: var(--surface2); }
.bh-game-card.bh-pending { opacity: .65; }
.bh-game-card.bh-bonus   { background: rgba(240,192,64,.10); border-left: 3px solid var(--gold); }

/* Linha de times */
.bh-teams-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.bh-team {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.bh-team-home { flex: 1; justify-content: flex-end; }
.bh-team-away { flex: 1; justify-content: flex-start; }

.bh-team-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .82rem;
}

/* Bloco central: aposta + resultado */
.bh-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  min-width: 80px;
}

.bh-bet-score {
  font-weight: 800;
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
}

.bh-real-score {
  font-size: .7rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.bh-waiting {
  font-size: .68rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-style: italic;
}

/* Pontuação */
.bh-pts {
  margin-left: 2px;
  font-weight: 800;
  color: var(--accent);
  font-size: .85rem;
  white-space: nowrap;
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}
.bh-pts-empty { min-width: 32px; }

/* =============================================
   APOSTAS MATA-MATA — cards KO
   ============================================= */
.bh-ko-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.bh-ko-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .82rem;
  min-height: 40px;
}
.bh-ko-card.bh-exact   { background: rgba(35,134,54,.10); border-color: rgba(35,134,54,.3); }
.bh-ko-card.bh-correct { background: rgba(56,139,253,.08); border-color: rgba(56,139,253,.3); }
.bh-ko-card.bh-wrong   { background: rgba(218,54,51,.07); border-color: rgba(218,54,51,.3); }
.bh-ko-card.bh-placed  { background: var(--surface2); }
.bh-ko-card.bh-bonus   { background: rgba(240,192,64,.10); border-color: rgba(240,192,64,.3); }

.bh-ko-pick {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.bh-ko-real {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================
   APOSTAS — resumo redesenhado
   ============================================= */
.bh-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  margin-top: 16px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.bh-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .84rem;
  color: var(--text-muted);
}
.bh-summary-item strong { color: var(--text); font-weight: 700; }
.bh-summary-item em { color: var(--accent); font-style: normal; font-size: .78rem; }
.bh-sum-lbl { font-weight: 500; }

.bh-summary-total {
  display: flex;
  justify-content: flex-end;
  font-size: .95rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.bh-summary-total strong {
  color: var(--gold);
  font-size: 1.1rem;
  margin-left: 6px;
}

/* =============================================
   RANKING — erro com retry
   ============================================= */
.ranking-error, .rank-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  text-align: center;
}
