/* =========================================================
   INDEX PAGE (index.html) — index.css (MODO CLARO PREMIUM)
   Escopo: somente INDEX
   Objetivo: estética “premium” (tipo login), sem mexer em lógica,
            mantendo responsividade e larguras de colunas.
   ========================================================= */

/* =========================================================
   TOKENS (Light Premium)
   ========================================================= */
:root {
  --bg: #f6f8fc;
  --bg2: #eef2fb;

  --card: #ffffff;
  --grid: rgba(15, 23, 42, 0.1);
  --grid2: rgba(15, 23, 42, 0.08);

  --text: #0f172a;
  --muted: rgba(71, 85, 105, 0.92);
  --muted2: rgba(71, 85, 105, 0.7);

  --accent: #fb5904;

  --shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
  --shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-sm: 12px;

  --table-head: #f3f6fb;
  --table-row-even: rgba(15, 23, 42, 0.018);

  --ring: 0 0 0 4px rgba(251, 89, 4, 0.14);

  /* sticky tokens (CLARO) */
  --sticky-bg: #ffffff;
  --sticky-bg-head: var(--table-head);
  --sticky-sep: rgba(15, 23, 42, 0.08);
}

/* =========================================================
   BASE
   ========================================================= */
html,
body {
  height: 100%;
}

body {
  background:
    radial-gradient(
      1200px 700px at 18% 0%,
      rgba(251, 89, 4, 0.1),
      transparent 60%
    ),
    radial-gradient(
      900px 650px at 90% 10%,
      rgba(0, 140, 255, 0.08),
      transparent 62%
    ),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
}

.card,
.panel,
.box,
.sheet-card {
  border-radius: var(--radius);
}

/* =========================================================
   CONTAINER (mais largura no desktop / menos espaço morto)
   ========================================================= */
@media (min-width: 1100px) {
  .wrap {
    max-width: 1520px;
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* =========================================================
   TOPBAR (premium, opaca, sem “vazar” tabela)
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #f6f8fc; /* opaco (premium limpo) */
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.topbar .wrap {
  padding-top: 10px;
  padding-bottom: 10px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.brand-title {
  font-weight: 950;
  letter-spacing: -0.25px;
  color: var(--text);
  line-height: 1.1;
  font-size: 18px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 2px;
  font-weight: 750;
}

.top-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Botões topo */
.btn,
.actions a,
.card__actions a,
.actions button,
.card__actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: linear-gradient(#ffffff, #fbfbff);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
}

.btn:hover,
.actions a:hover,
.card__actions a:hover,
.actions button:hover,
.card__actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.1);
  border-color: rgba(15, 23, 42, 0.18);
}

.btn--danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
  color: #991b1b;
}
.btn--danger:hover {
  border-color: rgba(239, 68, 68, 0.55);
}

/* =========================================================
   NAVS (clubes e views) — desktop com scroll horizontal
   ========================================================= */
.nav-section {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.nav-label {
  font-size: 12px;
  font-weight: 950;
  color: var(--muted2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

@media (min-width: 521px) {
  #navClubs,
  #navViews {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 10px;
    scrollbar-gutter: stable both-edges;
  }

  #navClubs::-webkit-scrollbar,
  #navViews::-webkit-scrollbar {
    height: 8px;
  }

  #navClubs::-webkit-scrollbar-thumb,
  #navViews::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.16);
    border-radius: 999px;
  }

  #navClubs::-webkit-scrollbar-track,
  #navViews::-webkit-scrollbar-track {
    background: transparent;
  }

  #navClubs .tab,
  #navViews .tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* Pills premium */
#navClubs .tab,
#navViews .tab {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: linear-gradient(#ffffff, #fbfbff);
  color: var(--text);
  padding: 7px 10px;
  font-weight: 950;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

#navClubs .tab:hover,
#navViews .tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.1);
  border-color: rgba(15, 23, 42, 0.2);
}

#navClubs .tab.active,
#navViews .tab.active {
  border-color: rgba(251, 89, 4, 0.55);
  background: rgba(251, 89, 4, 0.1);
  box-shadow:
    inset 0 -2px 0 rgba(251, 89, 4, 0.45),
    0 14px 24px rgba(251, 89, 4, 0.1);
}

/* =========================================================
   FILTROS (se existirem no index)
   ========================================================= */
.filters.card {
  background: linear-gradient(#ffffff, #fbfbff);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  border-radius: var(--radius);
}

.label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 950;
  margin: 0 0 8px 2px;
}

.hint {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 800;
}

/* Segmented */
.seg {
  display: inline-flex;
  background: linear-gradient(#ffffff, #fbfbff);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  padding: 5px;
  gap: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 22px rgba(15, 23, 42, 0.05);
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  border-radius: 12px;
  font-weight: 950;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    box-shadow 0.12s ease;
}

.seg-btn:hover {
  transform: translateY(-1px);
  background: rgba(15, 23, 42, 0.04);
}

.seg-btn.is-active {
  background: rgba(251, 89, 4, 0.14);
  color: var(--text);
  box-shadow: 0 12px 24px rgba(251, 89, 4, 0.16);
}

/* Chips */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: linear-gradient(#ffffff, #fbfbff);
  cursor: pointer;
  font-weight: 950;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.1);
  border-color: rgba(15, 23, 42, 0.18);
}

.chip.is-on {
  border-color: rgba(251, 89, 4, 0.55);
  background: rgba(251, 89, 4, 0.1);
  color: var(--text);
  box-shadow:
    inset 0 -2px 0 rgba(251, 89, 4, 0.45),
    0 14px 24px rgba(251, 89, 4, 0.1);
}

/* =========================================================
   CARD PRINCIPAL (o “quadro” da tabela)
   ========================================================= */
.card,
.sheet-card {
  background: linear-gradient(#ffffff, #fbfbff);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* header do card */
.card__head,
.sheet-card__head,
.panel__head,
.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(#ffffff, #fbfbff);
}

.card__title,
.sheet-card__title,
#title {
  font-weight: 1000;
  letter-spacing: -0.3px;
}

/* =========================================================
   TABLE WRAP (scroll bonito + altura boa)
   ========================================================= */
#tableWrap,
.table-wrap {
  width: 100%;
  overflow: auto;
  max-height: 72vh;
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
}

/* scrollbar (webKit) */
#tableWrap::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
#tableWrap::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.16);
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.75);
}
#tableWrap::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 999px;
}

/* =========================================================
   TABELA (premium)
   ========================================================= */
table.sheet {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: max-content;
}

table.sheet th,
table.sheet td {
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
  background: #fff;
}

/* Header sticky */
table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--sticky-bg-head);
  text-align: center;
  font-weight: 950;
  font-size: 11px;
  letter-spacing: 0.22px;
  line-height: 1.1;
  padding: 7px 8px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

/* Header ativo de ordenação */
table.sheet thead th.th-active,
.sheet th.sortable.is-sorted {
  background: rgba(251, 89, 4, 0.1) !important;
  box-shadow:
    inset 0 -2px 0 rgba(251, 89, 4, 0.55),
    0 1px 0 rgba(0, 0, 0, 0.06);
}

/* Zebra suave */
table.sheet tbody tr:nth-child(even) td {
  background: var(--table-row-even);
}

/* Hover por linha */
table.sheet tbody tr:hover td {
  background: rgba(251, 89, 4, 0.06);
}

/* =========================================================
   COLUNAS (mantém larguras do seu padrão)
   ========================================================= */
td.rank {
  font-weight: 1000;
  text-align: center;
  font-variant-numeric: tabular-nums;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

td.rank.top1 {
  background: rgba(46, 213, 115, 0.18);
}
td.rank.top2 {
  background: rgba(255, 193, 7, 0.22);
}
td.rank.top3 {
  background: rgba(251, 89, 4, 0.18);
}

/* Célula de equipe */
.team-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-crest {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.18));
}

/* Numéricas (DESKTOP) — mantém seu range */
table.sheet th.num,
table.sheet td.num {
  width: 100px;
  min-width: 70px;
  max-width: 120px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Texto (EQUIPE) confortável */
table.sheet th.text,
table.sheet td.text {
  min-width: 110px;
}

/* Badge do valor (seu heatmap) — mais premium */
td.num .val {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.12),
    0 8px 18px rgba(15, 23, 42, 0.06);
}

td.num .val.is-good {
  color: #065f46;
  box-shadow:
    inset 0 0 0 1px rgba(34, 197, 94, 0.35),
    0 8px 18px rgba(34, 197, 94, 0.08);
}
td.num .val.is-bad {
  color: #7f1d1d;
  box-shadow:
    inset 0 0 0 1px rgba(239, 68, 68, 0.35),
    0 8px 18px rgba(239, 68, 68, 0.08);
}
td.num .val.is-mid {
  color: #1f2937;
}

/* =========================================================
   STICKY (P + E) — CLARO (opaco, premium)
   Mantém offsets e não “vaza” fundo.
   ========================================================= */
table.sheet th:nth-child(1),
table.sheet td:nth-child(1),
table.sheet th:nth-child(2),
table.sheet td:nth-child(2) {
  position: sticky;
  z-index: 20;
  background: var(--sticky-bg) !important;
  background-clip: padding-box;
}

table.sheet th:nth-child(1),
table.sheet td:nth-child(1) {
  left: 0;
}

table.sheet th:nth-child(2),
table.sheet td:nth-child(2) {
  left: 46px; /* mantém seu padrão base */
  box-shadow: 8px 0 0 var(--sticky-sep);
}

/* =========================================================
   HEATMAP (quantis) — CLARO
   ========================================================= */
.sheet td.hm1 {
  background: rgba(239, 68, 68, 0.28);
}
.sheet td.hm2 {
  background: rgba(239, 68, 68, 0.16);
}
.sheet td.hm3 {
  background: transparent;
}
.sheet td.hm4 {
  background: rgba(34, 197, 94, 0.16);
}
.sheet td.hm5 {
  background: rgba(34, 197, 94, 0.28);
}

/* =========================================================
   MOBILE (mantém compactação e larguras estáveis)
   ========================================================= */
@media (max-width: 720px) {
  /* topo */
  .topbar-inner {
    margin-bottom: 6px;
  }
  .brand-sub {
    display: none;
  }
  .btn {
    padding: 8px 10px;
  }

  /* table wrap */
  #tableWrap,
  .table-wrap {
    max-height: 74vh;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* tabela previsível (sem “invadir” coluna) */
  table.sheet {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
  }

  table.sheet th,
  table.sheet td {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    padding: 4px 6px !important;
  }

  table.sheet thead th {
    font-size: 9px !important;
    padding: 4px 6px !important;
    line-height: 1.05 !important;
  }

  /* LARGURAS (mantém o seu conceito de colunas enxutas) */
  table.sheet thead th:nth-child(1),
  table.sheet tbody td:nth-child(1) {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    text-align: center !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  table.sheet thead th:nth-child(2),
  table.sheet tbody td:nth-child(2) {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    text-align: center !important;
  }

  /* numéricas estáveis no mobile */
  table.sheet th.num,
  table.sheet td.num {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    text-align: center !important;
  }

  /* sticky offsets no mobile */
  table.sheet thead th:nth-child(1),
  table.sheet tbody td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 25;
    background: var(--sticky-bg) !important;
  }

  table.sheet thead th:nth-child(2),
  table.sheet tbody td:nth-child(2) {
    position: sticky;
    left: 34px;
    z-index: 25;
    background: var(--sticky-bg) !important;
    box-shadow: 8px 0 0 var(--sticky-sep);
  }

  /* equipe: só escudo (compacto) */
  .team-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
  }

  .team-crest {
    width: 18px !important;
    height: 18px !important;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.16));
  }

  /* badge numérico menor (não empurra coluna) */
  td.num .val {
    min-width: 26px !important;
    padding: 3px 5px !important;
    border-radius: 8px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
  }
}

/* =========================================================
   THEME TECH (DARK) — mantém seu dark, só ajusta sticky tokens
   ========================================================= */
.theme-tech {
  background: radial-gradient(circle at top, #0f172a 0%, #020617 60%);
  --sticky-bg: rgba(10, 16, 32, 0.96);
  --sticky-bg-head: rgba(10, 16, 32, 0.98);
  --sticky-sep: rgba(0, 0, 0, 0.35);
}

/* cards no tech */
.theme-tech .card,
.theme-tech .filters.card {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.15);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.08),
    0 10px 40px rgba(0, 0, 0, 0.6);
}

/* tabela base no tech */
.theme-tech .sheet {
  background: transparent;
}
.theme-tech .sheet thead th {
  color: rgba(255, 255, 255, 0.92);
  border: none;
  background: var(--sticky-bg-head) !important;
}
.theme-tech .sheet tbody td {
  background: rgba(11, 18, 32, 0.88);
  color: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

/* heatmap no tech (mais forte) */
.theme-tech .sheet td.hm1 {
  background: rgba(239, 68, 68, 0.48) !important;
}
.theme-tech .sheet td.hm2 {
  background: rgba(239, 68, 68, 0.28) !important;
}
.theme-tech .sheet td.hm3 {
  background: rgba(11, 18, 32, 0.85) !important;
}
.theme-tech .sheet td.hm4 {
  background: rgba(34, 197, 94, 0.28) !important;
}
.theme-tech .sheet td.hm5 {
  background: rgba(34, 197, 94, 0.48) !important;
}

/* filtros no tech */
.theme-tech .filters .label {
  color: rgba(255, 255, 255, 0.82) !important;
}
.theme-tech .filters .hint {
  color: rgba(255, 255, 255, 0.68) !important;
}
.theme-tech .chip {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: none;
}
.theme-tech .chip.is-on {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  color: #0f172a;
  border: none;
}
.theme-tech .seg-btn {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.theme-tech .seg-btn.is-active {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  color: #0f172a;
  border: none;
}

/* Remove o “buraco” que a seção EQUIPES ocupava */
#navClubs,
.nav-section:has(#navClubs) {
  display: none !important;
}

/* Garante que os botões do topo fiquem bem alinhados */
.top-actions {
  gap: 8px;
}

/* Mobile: se quebrar linha, mantém organizado */
@media (max-width: 720px) {
  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
