/* ============================================================
   TABELA.CSS — estilos compartilhados entre home (tw-*) e
   página de tabelas (tp-*)
   ============================================================ */

/* ── WIDGET HOME (tw-*) ───────────────────────────────────── */
.tw {
  background: var(--card);
  border-radius: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-texto);
}

.tw-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  flex-shrink: 0;
}

.tw-titulo {
  color: var(--texto);
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
}

.tw-titulo span { color: var(--amarelo); }

.tw-filtros { display: flex; gap: 8px; }

.tw-filtro {
  background: none;
  border: 1px solid var(--borda-forte);
  color: var(--texto-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: var(--font-texto);
}

.tw-filtro.ativo {
  background: var(--verde-profundo);
  color: var(--verde-neon);
  border-color: var(--verde-neon);
}

.tw-abas {
  display: flex;
  gap: 2px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--borda-forte);
  flex-shrink: 0;
}

.tw-aba {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--texto-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.3s ease;
  outline: none;
  -webkit-appearance: none;
  font-family: var(--font-texto);
}

.tw-aba.ativa { color: var(--verde-neon); border-bottom-color: var(--verde-neon); }
.tw-aba:hover { color: var(--texto); background: none; }

.tw-scroll {
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
}

.tw-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.tw-scroll::-webkit-scrollbar-track { background: var(--bg); }
.tw-scroll::-webkit-scrollbar-thumb { background: var(--verde-profundo); border-radius: 2px; }
.tw-scroll::-webkit-scrollbar-thumb:hover { background: var(--verde-neon); }

.tw table { width: 100%; border-collapse: collapse; min-width: 520px; }

.tw thead th {
  color: var(--texto-muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  padding: 8px;
  text-align: center;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.tw thead th.tw-left { text-align: left; padding-left: 12px; }

.tw tbody tr { border-top: 1px solid var(--borda-sutil); transition: background 0.15s; position: relative; }
.tw tbody tr:hover { background: rgba(34, 197, 94, 0.08); }

.tw tbody td {
  padding: 9px 8px;
  color: var(--texto);
  vertical-align: middle;
  text-align: center;
  font-size: 12px;
}

.tw tbody td.tw-left { text-align: left; }

.tw-pos-cell { position: relative; padding-left: 16px !important; text-align: left !important; }
.tw-barra { width: 4px; position: absolute; left: 0; top: 0; bottom: 0; }
.tw-pos { font-weight: 900; font-size: 14px; color: var(--texto); }
.tw-pos-g  { color: var(--verde-neon); }
.tw-pos-p  { color: var(--amarelo); }
.tw-pos-sa { color: var(--texto-muted); }
.tw-pos-z  { color: var(--gol); }

.tw-esc {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800; color: #fff; flex-shrink: 0;
}

.tw-time-cell { display: flex; align-items: center; gap: 10px; padding-left: 4px; }
.tw-time-nome { font-weight: 700; font-size: 13px; }
.tw-pts { font-weight: 900; font-size: 14px; color: var(--verde-neon); }

.tw-forma { display: flex; gap: 3px; justify-content: center; }
.tw-f { width: 20px; height: 20px; border-radius: 4px; font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tw-f-v { background: var(--vitoria); color: var(--bg); }
.tw-f-e { background: var(--empate); color: var(--bg); }
.tw-f-d { background: var(--derrota); color: #fff; }

.tw-legenda {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 20px;
  border-top: 1px solid var(--borda-sutil);
  flex-shrink: 0;
}

.tw-legenda span { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--texto-muted); }
.tw-legenda i { width: 4px; height: 14px; border-radius: 2px; display: inline-block; flex-shrink: 0; }


/* ── PÁGINA TABELAS (tp-*) ────────────────────────────────── */
.tp-abas-wrap { background: var(--bg); border-bottom: 1px solid var(--borda-forte); }

.tp-abas-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
}

.tp-aba {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--texto-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.2s ease;
  outline: none;
  white-space: nowrap;
  font-family: var(--font-texto);
}

.tp-aba.ativa { color: var(--verde-neon); border-bottom-color: var(--verde-neon); }
.tp-aba:hover { color: var(--texto); }

.tp-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.tp-tabela-wrap { background: var(--card); border-radius: 12px; overflow: hidden; }

.tp-tabela-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.tp-titulo { font-family: var(--font-titulo); font-size: 26px; color: var(--texto); text-transform: uppercase; letter-spacing: 0.03em; }
.tp-titulo span { color: var(--amarelo); }

.tp-filtros { display: flex; gap: 8px; flex-wrap: wrap; }

.tp-filtro {
  background: none;
  border: 1px solid var(--borda-forte);
  color: var(--texto-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: var(--font-texto);
}

.tp-filtro.ativo { background: var(--verde-profundo); color: var(--verde-neon); border-color: var(--verde-neon); }

.tp-scroll { overflow-x: auto; }
.tp-scroll::-webkit-scrollbar { height: 4px; }
.tp-scroll::-webkit-scrollbar-track { background: var(--bg); }
.tp-scroll::-webkit-scrollbar-thumb { background: var(--verde-profundo); border-radius: 2px; }

.tp-tabela-wrap table { width: 100%; border-collapse: collapse; min-width: 600px; }

.tp-tabela-wrap thead th {
  color: var(--texto-muted);
  font-weight: 700; font-size: 10px; text-transform: uppercase;
  padding: 10px 8px; text-align: center; letter-spacing: 0.06em;
  background: var(--surface);
  border-top: 1px solid var(--borda-sutil);
  border-bottom: 1px solid var(--borda-sutil);
}

.tp-tabela-wrap thead th.tp-left { text-align: left; padding-left: 16px; }

.tp-tabela-wrap tbody tr { border-bottom: 1px solid var(--borda-sutil); transition: background 0.15s; position: relative; }
.tp-tabela-wrap tbody tr:hover { background: rgba(34, 197, 94, 0.06); }

.tp-tabela-wrap tbody td { padding: 10px 8px; color: var(--texto); vertical-align: middle; text-align: center; font-size: 12px; }
.tp-tabela-wrap tbody td.tp-left { text-align: left; }

.tp-pos-cell { position: relative; padding-left: 20px !important; text-align: left !important; }
.tp-barra { width: 3px; position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 2px 2px 0; }
.tp-pos { font-weight: 900; font-size: 15px; color: var(--texto); }
.tp-pos-g  { color: var(--verde-neon); }
.tp-pos-p  { color: var(--amarelo); }
.tp-pos-sa { color: var(--verde); }
.tp-pos-z  { color: var(--gol); }

.tp-esc { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 800; color: #fff; flex-shrink: 0; }
.tp-time-cell { display: flex; align-items: center; gap: 12px; padding-left: 8px; }
.tp-time-nome { font-weight: 700; font-size: 13px; }
.tp-pts { font-weight: 900; font-size: 15px; color: var(--verde-neon); }

.tp-forma { display: flex; gap: 4px; justify-content: center; }
.tp-f { width: 22px; height: 22px; border-radius: 4px; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tp-f-v { background: var(--vitoria); color: var(--bg); }
.tp-f-e { background: var(--empate); color: var(--bg); }
.tp-f-d { background: var(--derrota); color: #fff; }

.tp-legenda { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--borda-sutil); }
.tp-legenda span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--texto-muted); }
.tp-legenda i { width: 3px; height: 16px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* SIDEBAR */
.tp-sidebar { display: flex; flex-direction: column; gap: 16px; }

.tp-rodada-card { background: var(--card); border-radius: 12px; padding: 20px; }
.tp-rodada-titulo { font-family: var(--font-titulo); font-size: 18px; color: var(--texto); text-transform: uppercase; margin-bottom: 16px; }
.tp-rodada-titulo span { color: var(--verde-neon); }

.tp-jogo { padding: 12px 0; border-bottom: 1px solid var(--borda-sutil); }
.tp-jogo:last-child { border-bottom: none; }
.tp-jogo-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.tp-jogo-hora { font-size: 11px; color: var(--texto-muted); font-weight: 600; }
.tp-jogo-comp { font-size: 10px; font-weight: 700; color: var(--texto-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.tp-jogo-times { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tp-jogo-time { display: flex; align-items: center; gap: 8px; }
.tp-jogo-time-right { flex-direction: row-reverse; }
.tp-jogo-esc { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 900; color: #fff; flex-shrink: 0; }
.tp-jogo-time span { font-size: 13px; font-weight: 700; color: var(--texto); }
.tp-jogo-vs { font-size: 11px; color: var(--texto-faint); font-weight: 600; }
.tp-jogo-canais { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tp-canal { font-size: 10px; font-weight: 700; color: var(--texto-muted); background: var(--surface); border: 1px solid var(--borda-sutil); border-radius: 4px; padding: 2px 8px; text-transform: uppercase; letter-spacing: 0.06em; }

.tp-sim-card { background: var(--amarelo); border-radius: 12px; padding: 20px; }
.tp-sim-label { font-size: 10px; font-weight: 700; color: var(--bg); text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; margin-bottom: 6px; }
.tp-sim-titulo { font-family: var(--font-titulo); font-size: 20px; color: var(--bg); text-transform: uppercase; margin-bottom: 16px; line-height: 1.1; }
.tp-sim-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tp-sim-time { display: flex; align-items: center; gap: 6px; min-width: 100px; }
.tp-sim-esc { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.tp-sim-time span { font-size: 12px; font-weight: 700; color: var(--bg); }
.tp-sim-barra-wrap { flex: 1; height: 6px; background: rgba(0,0,0,0.15); border-radius: 3px; overflow: hidden; }
.tp-sim-barra { height: 100%; background: var(--bg); border-radius: 3px; transition: width 0.6s ease; }
.tp-sim-pct { font-size: 12px; font-weight: 800; color: var(--bg); min-width: 32px; text-align: right; }
.tp-sim-nota { font-size: 10px; color: rgba(10,20,16,0.6); margin-top: 8px; font-style: italic; }


/* ── RESPONSIVO ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .tp-main { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  /* HOME — tw-* */
  .tw-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 16px 0;
  }

  .tw-filtros { width: 100%; flex-wrap: wrap; gap: 6px; }
  .tw-filtro  { font-size: 9px; padding: 4px 8px; }

  .tw-abas {
    padding: 10px 16px 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tw-abas::-webkit-scrollbar { display: none; }
  .tw-aba { white-space: nowrap; flex-shrink: 0; font-size: 9px; padding: 8px 10px; }

  /* Sticky colunas # e TIME na home */
  .tw table { min-width: unset; width: 100%; }

  .tw thead th:nth-child(1),
  .tw tbody td:nth-child(1) {
    position: sticky; left: 0; z-index: 2;
    background: var(--surface);
    min-width: 40px; max-width: 40px;
  }

  .tw thead th:nth-child(2),
  .tw tbody td:nth-child(2) {
    position: sticky; left: 40px; z-index: 2;
    background: var(--surface);
    min-width: 130px; max-width: 130px;
    border-right: 1px solid var(--borda-forte);
  }

  .tw tbody tr:nth-child(even) td:nth-child(1),
  .tw tbody tr:nth-child(even) td:nth-child(2) { background: var(--card); }

  .tw tbody tr:hover td:nth-child(1),
  .tw tbody tr:hover td:nth-child(2) { background: rgba(34, 197, 94, 0.08); }

  .tw-time-nome { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
  .tw-esc       { width: 22px; height: 22px; font-size: 7px; }
  .tw-legenda   { padding: 10px 16px; gap: 8px; }

  /* PÁGINA — tp-* */
  .tp-abas-inner {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding: 0 16px;
  }
  .tp-abas-inner::-webkit-scrollbar { display: none; }
  .tp-aba { white-space: nowrap; flex-shrink: 0; font-size: 11px; padding: 12px 12px; }

  .tp-tabela-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 16px 12px;
  }

  .tp-filtros { width: 100%; }
  .tp-filtro  { font-size: 9px; padding: 4px 8px; }

  /* Sticky colunas # e TIME na página */
  .tp-tabela-wrap table { min-width: unset; width: 100%; }

  .tp-tabela-wrap thead th:nth-child(1),
  .tp-tabela-wrap tbody td:nth-child(1) {
    position: sticky; left: 0; z-index: 2;
    background: var(--surface);
    min-width: 44px; max-width: 44px;
  }

  .tp-tabela-wrap thead th:nth-child(2),
  .tp-tabela-wrap tbody td:nth-child(2) {
    position: sticky; left: 44px; z-index: 2;
    background: var(--surface);
    min-width: 140px; max-width: 140px;
    border-right: 1px solid var(--borda-forte);
  }

  .tp-tabela-wrap tbody tr:hover td:nth-child(1),
  .tp-tabela-wrap tbody tr:hover td:nth-child(2) { background: rgba(34, 197, 94, 0.06); }

  .tp-time-nome { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
  .tp-esc       { width: 24px; height: 24px; font-size: 7px; }
  .tp-main      { padding: 16px; gap: 16px; }
}