/* =========================================================
   STANDINGS.CSS — standings.html e admin-standings.html
   (usa base.css, navbar.css, footer.css, components.css)
   ========================================================= */

body { display: flex; flex-direction: column; min-height: 100vh; }

.page { max-width: 900px; margin: 0 auto; padding: 32px 24px 80px; flex: 1; width: 100%; }

.page-header { margin-bottom: 24px; }
.page-tag {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--red); margin-bottom: 8px;
}
.page-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 36px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.03em; line-height: 1; margin-bottom: 8px;
}
.page-sub { font-size: 14px; color: var(--muted); font-weight: 500; }

/* ---------- SELETORES ---------- */
.st-controls { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.st-field { display: flex; flex-direction: column; gap: 7px; flex: 1 1 280px; min-width: 0; }
.st-field-season { flex: 0 0 160px; }
.st-field[hidden] { display: none; }

.st-label {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted);
}

.st-select {
  width: 100%; background: var(--card); border: 1px solid var(--border); color: var(--white);
  padding: 12px 38px 12px 14px; border-radius: 6px;
  font-family: 'Barlow', sans-serif; font-size: 14px; font-weight: 600;
  outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23AAAAAA' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
  transition: border-color .2s;
}
.st-select:hover, .st-select:focus { border-color: var(--red); }
.st-select option, .st-select optgroup { background: var(--card2); color: var(--white); }
input.st-select { background-image: none; padding-right: 14px; cursor: text; }

/* ---------- CARTÃO ---------- */
.st-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; position: relative;
}
.st-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--red); z-index: 1;
}

.st-head { display: flex; align-items: center; gap: 18px; padding: 24px 24px 20px; border-bottom: 1px solid var(--border); }
.st-logo {
  width: 64px; height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.st-logo img { width: 100%; height: 100%; object-fit: contain; }
.st-logo-abbr { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 900; color: var(--red); text-align: center; line-height: 1.1; }
.st-head-text { min-width: 0; }
.st-head-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 26px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.05;
}
.st-head-meta { font-size: 13px; color: var(--muted); margin-top: 5px; font-weight: 500; }

/* ---------- SEPARADORES ---------- */
.st-tabs { display: flex; border-bottom: 1px solid var(--border); }
.st-tabs[hidden] { display: none; }
.st-tab {
  flex: 1; background: transparent; border: none; border-bottom: 2px solid transparent; padding: 14px 10px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 800;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.st-tab:hover { color: var(--light); }
.st-tab.active { color: var(--white); border-bottom-color: var(--red); }
.st-count { margin-left: 6px; color: var(--muted); font-weight: 700; }

/* ---------- TABELA ---------- */
.st-scroll { overflow-x: auto; }
.st-table { width: 100%; border-collapse: collapse; }
.st-table thead th {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); padding: 14px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.st-table th.st-wins, .st-table th.st-gap, .st-table th.st-pts { text-align: right; }

.st-row { border-bottom: 1px solid var(--border); transition: background .15s; }
.st-row:last-child { border-bottom: none; }
.st-row:hover { background: var(--card2); }
.st-row td { padding: 14px 16px; vertical-align: middle; }
.st-row.is-fav { background: rgba(224,4,27,0.07); }
.st-row.is-fav:hover { background: rgba(224,4,27,0.11); }

/* barra lateral do pódio */
.st-row.p1 td:first-child { box-shadow: inset 3px 0 0 #f5c518; }
.st-row.p2 td:first-child { box-shadow: inset 3px 0 0 #b8bcc4; }
.st-row.p3 td:first-child { box-shadow: inset 3px 0 0 #cd7f32; }

.st-pos {
  width: 64px; font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 900;
  color: var(--red); letter-spacing: 0.04em;
}
.st-who-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.st-name {
  font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.15;
}
.st-num {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 900; color: var(--light);
  border: 1px solid var(--border); background: var(--black); padding: 1px 6px; border-radius: 4px;
}
.st-flag { font-size: 14px; border-radius: 2px; box-shadow: 0 0 2px rgba(0,0,0,0.5); }
.st-fav-star { color: #f59e0b; font-size: 14px; line-height: 1; }
.st-sub { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; }

.st-wins { text-align: right; color: var(--light); font-weight: 600; }
.st-gap  { text-align: right; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.st-pts  { text-align: right; font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 900; white-space: nowrap; }

/* ---------- ESTADOS ---------- */
.st-skel {
  height: 52px; margin: 10px 16px; border-radius: 6px;
  background: linear-gradient(90deg, #171717 25%, #202020 37%, #171717 63%);
  background-size: 400% 100%; animation: stShimmer 1.4s ease infinite;
}
@keyframes stShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.st-empty { padding: 56px 24px; text-align: center; }
.st-empty-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--light); margin-bottom: 8px;
}
.st-empty-text { font-size: 14px; color: var(--muted); line-height: 1.5; max-width: 420px; margin: 0 auto; }
.st-empty a { color: var(--red); text-decoration: none; font-weight: 600; }
.st-error .st-empty-title { color: var(--red); }

.empty-state {
  text-align: center; padding: 60px 0; font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; display: none;
}

/* ---------- ADMIN ---------- */
.adm-card { padding: 28px; }
.adm-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.adm-textarea {
  width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--white);
  border-radius: 6px; padding: 12px 14px; margin-top: 7px; resize: vertical; outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55;
  white-space: pre; overflow: auto;
}
.adm-textarea:focus { border-color: var(--red); }
.adm-hint { font-size: 12px; color: var(--muted); margin: 8px 0 18px; line-height: 1.55; }
.adm-hint code { color: var(--light); background: var(--card2); padding: 1px 5px; border-radius: 3px; }
.adm-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.adm-btn {
  background: transparent; border: 1px solid var(--border); color: var(--white); padding: 11px 22px; border-radius: 6px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; cursor: pointer; transition: border-color .2s, background .2s, opacity .2s;
}
.adm-btn:hover:not(:disabled) { border-color: var(--red); }
.adm-btn-primary { background: var(--red); border-color: var(--red); }
.adm-btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.adm-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.adm-msg { display: none; margin-top: 18px; padding: 12px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; line-height: 1.5; white-space: pre-line; }
.adm-msg.ok  { display: block; background: rgba(34,197,94,0.1); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.adm-msg.err { display: block; background: rgba(224,4,27,0.1); color: var(--red); border: 1px solid rgba(224,4,27,0.3); }
.adm-preview { margin-top: 18px; overflow-x: auto; }
.adm-preview .st-table { border: 1px solid var(--border); }

/* ---------- TELEMÓVEL ---------- */
@media (max-width: 640px) {
  .page { padding: 20px 12px 60px; }
  .st-field-season { flex: 1 1 100%; }
  .st-head { padding: 18px 16px 16px; gap: 14px; }
  .st-logo { width: 48px; height: 48px; }
  .st-head-title { font-size: 20px; }
  .st-table thead th { padding: 12px 10px; }
  .st-row td { padding: 12px 10px; }
  .st-pos { width: 44px; font-size: 18px; }
  .st-name { font-size: 16px; }
  .st-pts { font-size: 19px; }
  .hide-sm { display: none; }
  .adm-card { padding: 18px 14px; }
  .adm-grid { grid-template-columns: 1fr; }
}

/* ---------- FOTOGRAFIAS / LOGÓTIPOS NAS CLASSIFICAÇÕES ---------- */
.st-person { display: flex; align-items: center; gap: 16px; min-width: 0; }
.st-person-text { min-width: 0; }
.st-avatar {
  width: 62px; height: 62px; flex: 0 0 62px;
  position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 2px solid var(--red); border-radius: 12px;
  background: var(--card2);
}
.st-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-avatar-team img { object-fit: contain; padding: 7px; }
.st-avatar-fallback {
  font-family: 'Barlow Condensed', sans-serif; font-size: 17px;
  font-weight: 900; color: var(--light); letter-spacing: .03em;
}
.st-avatar-number {
  position: absolute; bottom: 0; right: 0; z-index: 1;
  padding: 2px 5px; border-radius: 6px 0 0 0;
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  background: var(--black); color: var(--light);
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 900;
}
.st-person .st-who-main { gap: 8px; }
.st-person .st-sub { margin-top: 5px; }
@media (max-width: 640px) {
  .st-person { gap: 10px; }
  .st-avatar { width: 46px; height: 46px; flex-basis: 46px; border-radius: 9px; }
  .st-avatar-fallback { font-size: 13px; }
  .st-avatar-number { font-size: 9px; }
}


/* =========================================================
   STANDINGS — MELHORAR LEGIBILIDADE
   ========================================================= */


/* Breadcrumb ligeiramente maior */
.page > .breadcrumb {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .07em;
}

.page > .breadcrumb a,
.page > .breadcrumb span {
    font-size: inherit;
}

.page > .breadcrumb svg {
    width: 14px;
    height: 14px;
}
/* Cabeçalhos: POS, DRIVER, WINS, GAP, PTS */
.st-table thead th {
    color: #b8b8b8 !important;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Nome das equipas por baixo dos pilotos */
.st-table .st-sub {
    color: #a8a8a8 !important;
    font-size: 13px;
    font-weight: 500;
    margin-top: 5px;
    line-height: 1.4;
}

/* Nomes dos pilotos e equipas */
.st-table .st-name {
    color: #f5f5f5 !important;
    font-weight: 700;
}

/* Coluna das vitórias */
.st-table tbody .st-wins {
    color: #dedede !important;
    font-weight: 600;
}

/* Coluna da diferença de pontos */
.st-table tbody .st-gap {
    color: #b5b5b5 !important;
    font-weight: 500;
}

/* Pontos dos pilotos e equipas */
.st-table tbody .st-pts {
    color: #ffffff !important;
    font-weight: 800;
}

/* Texto da época e última atualização */
.st-head-meta {
    color: #a0a0a0 !important;
}

/* Texto de apoio por baixo do título STANDINGS */
.standings-page .st-intro,
.standings-page .st-description {
    color: #a8a8a8;
}

/* Descrição alinhada à direita */
.st-page-heading {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.st-page-heading .page-sub {
    text-align: right;
    max-width: 100%;
    color: #a8a8a8;
    font-size: 14px;
    line-height: 1.5;
}



/* Breadcrumb e descrição na mesma linha */
.st-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 30px;
}

/* Remover margens que possam desalinhá-los */
.st-top-row .breadcrumb {
    margin: 0;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
}

.st-top-row .page-sub {
    margin: 0;
    text-align: right;
    color: #a8a8a8;
    font-size: 14px;
    line-height: 1.5;
}

/* Telemóveis */
@media (max-width: 640px) {
    .st-top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 24px;
    }

    .st-top-row .page-sub {
        text-align: left;
    }
}



/* Manter a largura e o alinhamento originais */
.page {
    width: 100%;
    max-width: 1050px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* Breadcrumb e descrição alinhados */
.st-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 30px;
}

.st-top-row .breadcrumb {
    margin: 0;
    flex-shrink: 0;
}

.st-top-row .page-sub {
    margin: 0;
    text-align: right;
    font-size: 14px;
    color: #a8a8a8;
}

/* Adaptação para telemóveis */
@media (max-width: 640px) {
    .page {
        padding: 20px 12px 60px;
    }

    .st-top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .st-top-row .page-sub {
        text-align: left;
    }
}


.st-avatar.st-avatar-team {
    border: none !important;
    box-shadow: none !important;
        background: transparent;

}
