/* =============================================
   RESULTADOS & CLASSIFICAÇÃO — STYLES
   ============================================= */

/* ---- HERO ---- */
.res-hero {
  position: relative;
  padding: 140px 0 60px;
  background: linear-gradient(135deg, var(--blue-bg) 0%, var(--blue-dark) 50%, var(--blue) 100%);
  overflow: hidden;
}
.res-hero::after {
  content: 'SC';
  position: absolute; bottom: -40px; right: -20px;
  font-family: var(--font-display); font-size: 280px;
  color: rgba(255,255,255,0.03); pointer-events: none; line-height: 1;
}
.res-hero__overlay { position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0,27,77,0.5) 100%); }
.res-hero__content { position: relative; z-index: 2; }
.res-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  color: var(--white); letter-spacing: 2px; margin: 16px 0 0;
}
.res-hero__title span { color: var(--yellow); }

/* ---- TABS ---- */
.tabs-bar {
  background: var(--white);
  border-bottom: 2px solid var(--gray-border, #e2e8f0);
  position: sticky; top: 72px; z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.tabs-inner {
  display: flex; gap: 0; overflow-x: auto;
  scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }

.tab {
  padding: 16px 28px;
  background: none; border: none;
  font-family: var(--font-body); font-size: var(--t-4); font-weight: 700;
  color: var(--gray-mid); cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--yellow); }

/* ---- TEAM SELECTOR ---- */
.teams-bar {
  background: #f0f4ff;
  border-bottom: 2px solid var(--blue-light, #e8eef8);
}
.teams-inner {
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
}
.teams-inner::-webkit-scrollbar { display: none; }
.team-tab {
  padding: 11px 24px;
  background: none; border: none; border-bottom: 3px solid transparent;
  font-family: var(--font-body); font-size: var(--t-4); font-weight: 700;
  color: var(--gray-mid); cursor: pointer; white-space: nowrap;
  transition: all var(--transition); letter-spacing: 0.4px;
}
.team-tab:hover { color: var(--blue); }
.team-tab.active { color: var(--blue); border-bottom-color: var(--blue); background: rgba(0,59,142,0.05); }

/* ---- SECTION ---- */
.res-section { padding: 40px 0 80px; background: var(--gray-light); }

.res-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* min-width:0 lets the 1fr track shrink below the standings table's
   min-content width, so .table-wrap scrolls the table instead of the page. */
.res-col--main { display: flex; flex-direction: column; min-width: 0; }

/* ---- CARD ---- */
.res-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.res-card__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 2px solid var(--yellow);
  background: var(--blue);
}

.res-card__title {
  font-family: var(--font-display); font-size: var(--t-8);
  letter-spacing: 1px; color: var(--white);
}

.res-competicao {
  font-size: var(--t-2); color: rgba(255,255,255,0.6);
  font-weight: 500; letter-spacing: 1px;
}

/* ---- CLASSIFICAÇÃO TABLE ---- */
.table-wrap { overflow-x: auto; }

.class-table {
  width: 100%; border-collapse: collapse; font-size: var(--t-4);
}
.class-table thead { background: var(--blue-light, #e8eef8); }
.class-table th {
  padding: 10px 12px; text-align: center;
  font-size: var(--t-2); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--blue); white-space: nowrap;
}
.class-table th.pos-col  { width: 40px; }
.class-table th.team-col { text-align: left; min-width: 160px; }
.class-table th.pts-col  { background: var(--blue); color: var(--yellow); border-radius: 0; }
.class-table th.forma-col{ width: 100px; }

.class-table td {
  padding: 11px 12px; text-align: center;
  border-bottom: 1px solid var(--gray-border, #e2e8f0);
  color: var(--black); vertical-align: middle;
}
.class-table tr:last-child td { border-bottom: none; }
.class-table tr:hover td { background: var(--gray-light); }

/* Highlight SC row */
.class-table tr.sc-row td { background: rgba(255,209,0,0.08); font-weight: 700; }
.class-table tr.sc-row td.pos-cell { color: var(--blue); }

.team-cell { display: flex; align-items: center; gap: 10px; text-align: left; }
.team-badge {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-1); font-weight: 700; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.1);
}
.team-badge--sc { background: var(--yellow); color: var(--blue); border-color: var(--blue); }
.team-badge--other { background: var(--blue-light, #e8eef8); color: var(--blue); }

.team-logo {
  width: 28px; height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.pts-cell { font-weight: 700; color: var(--blue); font-size: var(--t-5); }

/* Pos badge */
.pos-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: var(--t-3); font-weight: 700;
}
.pos-badge--1 { background: var(--yellow); color: var(--blue); }
.pos-badge--2 { background: #c0c0c0; color: #333; }
.pos-badge--3 { background: #a35a1f; color: #fff; }

/* Forma dots */
.forma { display: flex; gap: 3px; justify-content: center; }
.forma-dot {
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.55rem; font-weight: 700; color: var(--white);
}
/* Letra branca de 9px: o verde e o laranja de origem davam 3,2:1. */
.forma-dot--v { background: #15803d; }
.forma-dot--e { background: #a16207; }
.forma-dot--d { background: var(--red, #dc2626); }

/* ---- JOGOS LIST ---- */
.jogos-list { padding: 8px 0; }

.jogo-item {
  display: flex; align-items: flex-start; padding: 14px 20px;
  border-bottom: 1px solid var(--gray-border, #e2e8f0);
  gap: 12px; transition: background 0.2s;
}
.jogo-item:last-child { border-bottom: none; }
.jogo-item:hover { background: var(--gray-light); }

.jogo-data {
  min-width: 46px; text-align: center;
  flex-shrink: 0; padding-top: 2px;
}
.jogo-data__day { font-family: var(--font-display); font-size: var(--t-8);
  color: var(--blue); line-height: 1; }
.jogo-data__mes { font-size: var(--t-1); text-transform: uppercase;
  letter-spacing: 1px; color: var(--gray-mid); font-weight: 700; }

.jogo-divider { width: 1px; background: var(--gray-border, #e2e8f0); flex-shrink: 0; align-self: stretch; }

.jogo-info { flex: 1; min-width: 0; }

.jogo-equipas { display: flex; flex-direction: column; gap: 4px; }

.jogo-equipa-row { display: flex; align-items: center; gap: 6px; }

.jogo-equipa {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--t-4); font-weight: 700; color: var(--black);
  line-height: 1.25; min-width: 0;
}
.jogo-equipa > .jogo-team-logo { flex-shrink: 0; margin-right: 0; }
.jogo-equipa--sc { color: var(--blue); }

.jogo-equipas .vs {
  font-size: var(--t-1); color: var(--gray-mid); font-weight: 600;
  flex-shrink: 0; letter-spacing: 0.5px; text-transform: uppercase;
}

/* Coluna lateral (Próximos Jogos): mais compacta, nomes não partem tanto */
#proximosJogos .jogo-item { padding: 12px 14px; gap: 10px; }
#proximosJogos .jogo-equipa { font-size: var(--t-2); line-height: 1.2; }
#proximosJogos .jogo-team-logo { width: 17px; height: 17px; }
#proximosJogos .jogo-data__day { font-size: var(--t-6); }
#proximosJogos .jogo-data__mes { font-size: var(--t-1); }
#proximosJogos .jogo-hora { font-size: var(--t-3); }
#proximosJogos .jogo-lado { font-size: var(--t-1); padding: 2px 8px; }

/* Etiqueta Casa/Fora (jogos do Campinense mostram só o adversário) */
.jogo-lado {
  align-self: flex-start;
  font-size: var(--t-1); font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; padding: 2px 10px; border-radius: 10px;
}
.jogo-lado--casa { background: var(--blue); color: #fff; }
.jogo-lado--fora { background: transparent; color: var(--gray-mid); border: 1px solid var(--gray-mid); }
html[data-theme="dark"] .jogo-lado--casa { background: #FFD100; color: #001f4d; }

.jogo-meta { font-size: var(--t-2); color: var(--gray-mid); margin-top: 5px; line-height: 1.3; }

.jogo-resultado {
  min-width: 58px; text-align: center; flex-shrink: 0; padding-top: 2px;
}
.resultado-placar {
  font-family: var(--font-display); font-size: var(--t-8); color: var(--blue);
  letter-spacing: 2px; line-height: 1;
}
.resultado-badge {
  display: inline-block; padding: 2px 7px; border-radius: 10px;
  font-size: var(--t-1); font-weight: 700; margin-top: 4px; white-space: nowrap;
}
/* O tom do texto passa a ser mais escuro do que o da caixa: as cores de
   origem davam 2,9:1 a 3,9:1 num texto de 10px. A cor de fundo, que é o
   que se vê de longe, não muda. */
.resultado-badge--v { background: var(--green-bg, #dcfce7); color: #166534; }
.resultado-badge--e { background: var(--orange-bg, #fef3c7); color: #854d0e; }
.resultado-badge--d { background: var(--red-bg, #fee2e2);   color: #991b1b; }

.jogo-agendado {
  min-width: 58px; text-align: center; flex-shrink: 0; padding-top: 2px;
}
.jogo-hora {
  font-family: var(--font-display); font-size: var(--t-6); color: var(--blue); line-height: 1;
}
.jogo-badge-prox {
  display: inline-block; padding: 2px 7px; border-radius: 10px;
  font-size: var(--t-1); font-weight: 700; margin-top: 4px;
  background: var(--blue-light, #e8eef8); color: var(--blue); white-space: nowrap;
}

.jogo-empty { padding: 24px; text-align: center; color: var(--gray-mid); font-size: var(--t-4); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .res-container { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .jogo-item { padding: 12px 16px; }
  .tab { padding: 14px 18px; font-size: var(--t-3); }
}

/* =============================================
   FPF BANNER — LINKS DIRETOS
   ============================================= */
.fpf-intro {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
  font-size: var(--t-5);
  color: #444;
  line-height: 1.6;
}

.fpf-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.fpf-card {
  display: flex;
  flex-direction: column;
  background: var(--blue);
  color: #fff;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0,59,142,0.18);
}

.fpf-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 32px rgba(0,59,142,0.28);
}

.fpf-card--secondary {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--blue);
}

.fpf-card__badge {
  background: var(--yellow);
  color: var(--blue);
  font-family: var(--font-display);
  font-size: var(--t-6);
  letter-spacing: 1px;
  padding: 8px 20px;
  display: inline-block;
  width: fit-content;
  border-radius: 0 0 10px 0;
}

.fpf-card__badge--gray {
  background: #f0f0f0;
  color: #555;
}

.fpf-card--secondary .fpf-card__badge--gray {
  background: #e8eef8;
  color: var(--blue);
}

.fpf-card__body {
  padding: 24px 24px 16px;
  flex: 1;
}

.fpf-card__title {
  font-family: var(--font-display);
  font-size: var(--t-8);
  letter-spacing: 1px;
  margin: 0 0 10px;
  line-height: 1.2;
}

.fpf-card--secondary .fpf-card__title { color: var(--blue); }

.fpf-card__desc {
  font-size: var(--t-4);
  opacity: 0.85;
  line-height: 1.5;
  margin: 0;
}

.fpf-card--secondary .fpf-card__desc { color: #555; opacity: 1; }

.fpf-card__action {
  padding: 14px 24px;
  background: rgba(0,0,0,0.15);
  font-size: var(--t-4);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.fpf-card--secondary .fpf-card__action {
  background: var(--blue);
  color: #fff;
}

/* CTA box */
.fpf-cta-box {
  display: flex;
  align-items: center;
  gap: 32px;
  background: linear-gradient(135deg, var(--blue-bg, #001f4d), var(--blue));
  border-radius: 16px;
  padding: 40px 48px;
  color: #fff;
}

.fpf-cta-logo {
  width: 120px;
  height: auto;
  border-radius: 8px;
  flex-shrink: 0;
}

.fpf-cta-text h4 {
  font-family: var(--font-display);
  font-size: var(--t-9);
  letter-spacing: 1px;
  margin: 0 0 8px;
  color: var(--yellow);
}

.fpf-cta-text p {
  margin: 0 0 20px;
  opacity: 0.85;
  font-size: var(--t-5);
  line-height: 1.6;
}

.btn--lg {
  padding: 14px 32px;
  font-size: var(--t-5);
}

/* Responsive */
@media (max-width: 700px) {
  .fpf-cards { grid-template-columns: 1fr; }
  .fpf-cta-box { flex-direction: column; text-align: center; padding: 32px 24px; }
  .fpf-cta-logo { width: 80px; }
}

/* ---- SHARE BUTTON on result cards ---- */
.jogo-share-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: var(--blue);
  font-size: var(--t-5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  align-self: center;
}
.jogo-share-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  transform: scale(1.1);
}

/* ---- SHARE MODAL ---- */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.share-modal__panel {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}
.share-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.share-modal__title {
  font-size: var(--t-5);
  font-weight: 700;
  color: #111;
}
.share-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  font-size: var(--t-7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: background 0.15s;
}
.share-modal__close:hover { background: #e2e8f0; }
.share-modal__body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.share-canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.share-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.share-btn {
  padding: 11px 16px;
  border-radius: 8px;
  border: none;
  font-size: var(--t-4);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.share-btn--wa  { background: #25D366; color: #fff; }
.share-btn--wa:hover  { background: #1db954; }
.share-btn--tw  { background: #000; color: #fff; }
.share-btn--tw:hover  { background: #222; }
.share-btn--fb  { background: #166fe5; color: #fff; }
.share-btn--fb:hover  { background: #166fe5; }
.share-btn--dl  { background: var(--blue, #003B8E); color: #fff; }
.share-btn--dl:hover  { background: #002A6B; }
.share-btn--cp  { background: #f1f5f9; color: #333; border: 1.5px solid #e2e8f0; }
.share-btn--cp:hover  { background: #e2e8f0; }
.share-btn--web { background: var(--yellow, #FFD100); color: #001133; grid-column: 1 / -1; }
.share-btn--web:hover { background: #e6b800; }
.share-hint {
  text-align: center;
  font-size: var(--t-3);
  color: #22c55e;
  font-weight: 700;
  margin: 0;
}
@media (max-width: 480px) {
  .share-btns { grid-template-columns: 1fr; }
}

/* =============================================
   TABELA DE CLASSIFICAÇÃO EM ECRÃS PEQUENOS
   =============================================
   Medido num ecrã de 320px: a moldura tem 272px e a tabela 560px — fica
   escondida mais de metade dela, e nada na página diz que se pode
   arrastar. A 390px escondem-se 218px.

   Duas correcções, e uma recusa.

   1. As células apertam. Tinham 11px em cima e em baixo e 12px de cada
      lado; abaixo dos 600px passam a 9px e 6px, o que devolve cerca de
      120px de largura à tabela sem tocar no tamanho da letra.

   2. Uma sombra na borda direita diz que há mais tabela para o lado, e
      desaparece sozinha quando se chega ao fim. É feita com fundos em
      background-attachment: local, sem uma linha de JavaScript.

   E a recusa: NÃO se fixa a coluna da equipa. A 320px ela tem 160px de
   largura mínima numa moldura de 272px — fixá-la congelava 59% do ecrã e
   deixava 112px para as nove colunas de números, que é pior do que o
   problema que resolve. Também não se fixa o cabeçalho: um contentor com
   overflow-x cria contexto de rolagem nos dois eixos, e um thead sticky
   lá dentro não teria nada a que se colar. */

.table-wrap {
  background:
    linear-gradient(to right, var(--white) 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left,  var(--white) 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(0,31,77,0.18), rgba(0,0,0,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(0,31,77,0.18), rgba(0,0,0,0)) right center;
  background-repeat: no-repeat;
  background-size: 28px 100%, 28px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* No tema escuro o cartão é #1e293b, e as duas faixas que escondem a
   sombra têm de ser dessa cor — a branco apareciam duas manchas claras
   nas bordas da tabela. */
html[data-theme="dark"] .table-wrap {
  background:
    linear-gradient(to right, #1e293b 30%, rgba(30,41,59,0)) left center,
    linear-gradient(to left,  #1e293b 30%, rgba(30,41,59,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.45), rgba(0,0,0,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.45), rgba(0,0,0,0)) right center;
  background-repeat: no-repeat;
  background-size: 28px 100%, 28px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

@media (max-width: 600px) {
  .class-table th { padding: 9px 6px; }
  .class-table td { padding: 9px 6px; }
  .class-table th.team-col { min-width: 120px; }
}

/* A coluna dos pontos é a que se procura primeiro. Já tinha o fundo azul
   no cabeçalho; passa a ter também peso na própria célula, em todas as
   larguras. */
.class-table td.pts-cell { font-size: var(--t-6); }

/* =============================================
   EQUIPA PRINCIPAL — só a secção #seniorCompeticoes
   ============================================= */
/* A página da Equipa Principal reutiliza os cartões, a lista de jogos e a
   tabela desta folha. Falta-lhe uma coisa: o nome da competição dos
   seniores é comprido — "AF Algarve 2.ª Divisão Série 1 · 2026/2027" —, e o
   .res-card__header é um flex sem quebra, pelo que num telemóvel o nome
   ficava encostado ao título, sem um espaço entre os dois. Medido a 390px:
   o título acabava em x=189 e o nome começava exactamente em x=189.

   O seletor é a secção, que só existe na equipa-principal.html: no
   resultados.html não há nenhum #seniorCompeticoes, e a Formação fica
   exactamente como estava — medido, cabeçalhos e colunas iguais ao byte nas
   quatro larguras. */
#seniorCompeticoes .res-card__header { flex-wrap: wrap; gap: 2px 14px; }
#seniorCompeticoes .res-competicao { line-height: 1.35; }
