/* A2 Metrics — tema condiviso, versione consolidata 2026-10-14 */

:root {
    --a2-red: #B3262E;
    --a2-red-dark: #971F26;
    --a2-orange: #F07A24;
    --a2-orange-dark: #D96317;
    --a2-orange-soft: #FCE8D8;
    --a2-sand: #F2E3C6;
    --a2-sand-soft: #FAF7F1;
    --a2-surface: #FFFFFF;
    --a2-text: #202124;
    --a2-muted: #6B665F;
    --a2-border: #E5D8C3;
    --a2-shadow: 0 3px 12px rgba(32, 33, 36, .07);
    --a2-scroll-shade: rgba(179, 38, 46, .18);
}

/* BASE */

html {
    background: var(--a2-sand-soft);
}

body {
    background: var(--a2-sand-soft) !important;
    color: var(--a2-text) !important;
}

a {
    color: var(--a2-red);
}

a:hover {
    color: var(--a2-orange-dark);
}

h1, h2, h3, h4 {
    color: var(--a2-text);
}

.subtitle,
.player-team,
.team-season,
.results-count {
    color: var(--a2-muted) !important;
}

/* HEADER CONDIVISO */

header.a2-site-header {
    background: var(--a2-red) !important;
    color: #fff;
    padding: 18px 28px;
    box-shadow: 0 2px 10px rgba(179, 38, 46, .14);
}

.a2-header-inner {
    max-width: 1500px;
    margin: 0 auto;
}

.a2-brand {
    margin: 0;
    color: #fff !important;
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
}

.a2-brand a {
    color: #fff;
    text-decoration: none;
}

.a2-header-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    margin-top: 10px;
}

.a2-season {
    color: rgba(255, 255, 255, .82);
    font-size: 13px;
    font-weight: 600;
}

.a2-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.a2-nav a {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 7px;
    color: rgba(255, 255, 255, .9);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.a2-nav a:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.a2-nav a.active {
    background: var(--a2-orange);
    color: #fff;
}

/* LINK E CONTROLLI */

.back-link {
    color: var(--a2-red) !important;
    text-decoration: none;
}

.back-link:hover {
    color: var(--a2-orange-dark) !important;
    text-decoration: underline;
}

.team-link,
.player-link {
    color: var(--a2-red) !important;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.team-link:hover,
.player-link:hover {
    color: var(--a2-red-dark) !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.team-link:focus-visible,
.player-link:focus-visible,
.a2-nav a:focus-visible {
    outline: 2px solid var(--a2-orange);
    outline-offset: 3px;
}

.filters {
    background: var(--a2-surface) !important;
    border: 1px solid var(--a2-border);
    box-shadow: var(--a2-shadow) !important;
}

.filter-group label {
    color: var(--a2-muted) !important;
}

.filter-group input,
.filter-group select,
input,
select {
    border-color: var(--a2-border) !important;
    background: var(--a2-surface);
    color: var(--a2-text);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--a2-orange) !important;
    box-shadow: 0 0 0 3px rgba(240, 122, 36, .14);
}

.filter-reset,
.glossary-toggle {
    border-color: var(--a2-border) !important;
    background: #fff !important;
    color: var(--a2-text) !important;
}

.filter-reset:hover,
.glossary-toggle:hover {
    background: var(--a2-orange-soft) !important;
    border-color: var(--a2-orange) !important;
}

.stats-tab,
.profile-tab,
.team-tab {
    background: #fff !important;
    border-color: var(--a2-border) !important;
    color: var(--a2-text) !important;
}

.stats-tab:hover,
.profile-tab:hover,
.team-tab:hover {
    background: var(--a2-orange-soft) !important;
    border-color: var(--a2-orange) !important;
}

.stats-tab.active,
.profile-tab.active,
.team-tab.active {
    background: var(--a2-orange) !important;
    border-color: var(--a2-orange) !important;
    color: #fff !important;
}

/* Pulsanti Leader */

.leader-tab {
    border-color: var(--a2-border) !important;
    background: #fff !important;
    color: var(--a2-text) !important;
}

.leader-tab:hover {
    background: var(--a2-orange-soft) !important;
    border-color: var(--a2-orange) !important;
}

.leader-tab.active {
    background: var(--a2-red) !important;
    border-color: var(--a2-red) !important;
    color: #fff !important;
}

.leader-tab::after {
    background: var(--a2-text) !important;
}

.leader-tab::before {
    border-top-color: var(--a2-text) !important;
}

/* GLOSSARIO, DIALOG, PAGINAZIONE */

.glossary-toggle.open {
    background: var(--a2-orange) !important;
    border-color: var(--a2-orange) !important;
    color: #fff !important;
}

.quick-glossary {
    background: #FFFDF9 !important;
    border-color: var(--a2-border) !important;
    box-shadow: var(--a2-shadow);
}

.qualified-info-button {
    border-color: var(--a2-orange) !important;
    color: var(--a2-red) !important;
    background: #fff !important;
}

.qualified-info-button:hover {
    background: var(--a2-orange-soft) !important;
}

.qualified-dialog {
    border: 1px solid var(--a2-border) !important;
}

.qualified-dialog::backdrop {
    background: rgba(32, 33, 36, .5);
}

.qualified-dialog-note {
    border-top-color: var(--a2-border) !important;
}

.page-button,
.page-size-control select {
    border-color: var(--a2-border) !important;
    background: #fff !important;
    color: var(--a2-text);
}

.page-button:hover:not(:disabled) {
    background: var(--a2-orange-soft) !important;
    border-color: var(--a2-orange) !important;
}

.player-header,
.team-header {
    border-color: var(--a2-border) !important;
}

/* TABELLE */

.table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;

    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;

    background: var(--a2-surface) !important;
    border: 1px solid var(--a2-border);
    box-shadow: var(--a2-shadow) !important;

    scrollbar-color: #D6AA79 #FAF7F1;
    scrollbar-width: thin;
}

.table-wrapper:focus-visible {
    outline: 2px solid var(--a2-orange);
    outline-offset: 2px;
}

.table-wrapper::-webkit-scrollbar {
    height: 7px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--a2-sand-soft);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #D6AA79;
    border-radius: 999px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--a2-orange);
}

table {
    background: var(--a2-surface);
}

th {
    background: var(--a2-sand) !important;
    color: var(--a2-text) !important;
    border-bottom-color: var(--a2-border) !important;
}

td {
    border-bottom-color: var(--a2-border) !important;
}

th:first-child {
    background: var(--a2-sand) !important;
}

td:first-child {
    background: #fff;
}

tbody tr:hover,
tbody tr:hover td {
    background: #FFF9F2 !important;
}

th.sort-active,
th:first-child.sort-active {
    background: var(--a2-orange-soft) !important;
    color: var(--a2-red) !important;
}

.stats-table td {
    background: #fff;
}

/* LARGHEZZE TABELLE */

.responsive-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.stats-table {
    min-width: 680px;
}

.roster-table {
    min-width: 980px;
}

.games-table {
    min-width: 900px;
}

.game-log-table {
    min-width: 1500px;
}

.standings-table th:nth-child(2),
.standings-table td:nth-child(2),
.leaders-table th:nth-child(2),
.leaders-table td:nth-child(2),
.leaders-table th:nth-child(3),
.leaders-table td:nth-child(3),
.roster-table th:first-child,
.roster-table td:first-child,
.games-table th:nth-child(3),
.games-table td:nth-child(3),
.game-log-table th:nth-child(2),
.game-log-table td:nth-child(2) {
    white-space: nowrap;
}

/* MOBILE */

@media (max-width: 700px) {

    header.a2-site-header {
        padding: 16px;
    }

    .a2-brand {
        font-size: 27px;
    }

    .a2-header-bottom {
        gap: 8px;
    }

    .a2-season,
    .a2-nav {
        width: 100%;
    }

    .a2-nav a {
        padding: 6px 8px;
    }

    .card {
        padding: 14px;
    }

    .table-wrapper {
        margin-left: 0;
        margin-right: 0;
    }

    .responsive-table {
        min-width: 720px;
    }

    .stats-table {
        min-width: 650px;
    }

    .roster-table {
        min-width: 900px;
    }

    /*
     * HOME - LEADER GIOCATORI
     * Nascondiamo # e rendiamo sticky Giocatore.
     */

    .leaders-table th:first-child,
    .leaders-table td:first-child {
        display: none;
    }

    .leaders-table th:nth-child(2),
    .leaders-table td:nth-child(2) {
        position: sticky;
        left: 0;
        z-index: 3;

        min-width: 158px;
        max-width: 158px;
        box-sizing: border-box;

        background: #FFFDF9 !important;
        white-space: nowrap;
        border-right: 1px solid var(--a2-border);
    }

    .leaders-table thead th:nth-child(2) {
        z-index: 5;
        background: var(--a2-sand) !important;
    }

    .leaders-table th:nth-child(2)::after,
    .leaders-table td:nth-child(2)::after {
        content: "";
        position: absolute;
        top: 0;
        right: -16px;
        width: 16px;
        height: 100%;
        pointer-events: none;

        background: linear-gradient(
            to right,
            var(--a2-scroll-shade),
            rgba(179, 38, 46, 0)
        );
    }

    .leaders-table tbody tr:hover td:nth-child(2) {
        background: #FFF9F2 !important;
    }

    /*
     * SQUADRA - PARTITE
     * Mobile: Data | Avversario | Punteggio
     */

    .games-table th:nth-child(2),
    .games-table td:nth-child(2) {
        display: none;
    }

    .games-table th:nth-child(1),
    .games-table td:nth-child(1) {
        min-width: 115px;
        white-space: nowrap;
    }

    .games-table th:nth-child(3),
    .games-table td:nth-child(3) {
        min-width: 135px;
        white-space: nowrap;
    }

    .games-table th:nth-child(4),
    .games-table td:nth-child(4) {
        min-width: 85px;
        white-space: nowrap;
        text-align: right;
    }

    /*
     * GIOCATORE - GAME LOG
     * Solo Data sticky.
     */

    .game-log-table {
        min-width: 1450px;
    }

    .game-log-table th:nth-child(1),
    .game-log-table td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 4;

        min-width: 95px;
        background: #FFFDF9 !important;
        white-space: nowrap;
        border-right: 1px solid var(--a2-border);
    }

    .game-log-table thead th:nth-child(1) {
        z-index: 5;
        background: var(--a2-sand) !important;
    }

    .game-log-table th:nth-child(1)::after,
    .game-log-table td:nth-child(1)::after {
        content: "";
        position: absolute;
        top: 0;
        right: -16px;
        width: 16px;
        height: 100%;
        pointer-events: none;

        background: linear-gradient(
            to right,
            var(--a2-scroll-shade),
            rgba(179, 38, 46, 0)
        );
    }

    .game-log-table th:nth-child(2),
    .game-log-table td:nth-child(2) {
        min-width: 200px;
        white-space: nowrap;
    }

    /*
     * SQUADRA - ROSTER
     * Nome giocatore sticky.
     */

    .roster-table th:first-child,
    .roster-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 3;

        background: #FFFDF9 !important;
        white-space: nowrap;
        border-right: 1px solid var(--a2-border);
    }

    .roster-table thead th:first-child {
        z-index: 5;
        background: var(--a2-sand) !important;
    }

    .roster-table th:first-child::after,
    .roster-table td:first-child::after {
        content: "";
        position: absolute;
        top: 0;
        right: -16px;
        width: 16px;
        height: 100%;
        pointer-events: none;

        background: linear-gradient(
            to right,
            var(--a2-scroll-shade),
            rgba(179, 38, 46, 0)
        );
    }
}

@media (prefers-reduced-motion: reduce) {
    .a2-nav a {
        transition: none;
    }
}

/* =====================================================
   A2 METRICS - STICKY UNIFORME
   Gradiente leggero sulle colonne di riferimento
===================================================== */

@media (max-width: 700px) {

    /*
     * HOME - CLASSIFICA
     * Nasconde il numero e blocca Squadra.
     */

    .standings-table th:first-child,
    .standings-table td:first-child {
        display: none;
    }

    .standings-table th:nth-child(2),
    .standings-table td:nth-child(2) {
        position: sticky;
        left: 0;
        z-index: 3;
        min-width: 220px;
        background: #FFFDF9 !important;
        border-right: 1px solid var(--a2-border);
        white-space: nowrap;
    }

    .standings-table thead th:nth-child(2) {
        z-index: 5;
        background: var(--a2-sand) !important;
    }

    .standings-table th:nth-child(2)::after,
    .standings-table td:nth-child(2)::after {
        content: "";
        position: absolute;
        top: 0;
        right: -16px;
        width: 16px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(
            to right,
            var(--a2-scroll-shade),
            transparent
        );
    }

    .standings-table tbody tr:hover td:nth-child(2) {
        background: #FFF9F2 !important;
    }

    /*
     * STATS.HTML
     * La prima colonna è già sticky.
     * Aggiungiamo il gradiente.
     */

    #players-head th:first-child,
    #players-table td:first-child {
        background: #FFFDF9 !important;
        border-right: 1px solid var(--a2-border);
    }

    #players-head th:first-child {
        background: var(--a2-sand) !important;
    }

    #players-head th:first-child::after,
    #players-table td:first-child::after {
        content: "";
        position: absolute;
        top: 0;
        right: -16px;
        width: 16px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(
            to right,
            var(--a2-scroll-shade),
            transparent
        );
    }

    /*
     * TEAM - PARTITE
     * Data sticky.
     */

    .games-table th:nth-child(1),
    .games-table td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 3;
        background: #FFFDF9 !important;
        border-right: 1px solid var(--a2-border);
    }

    .games-table thead th:nth-child(1) {
        z-index: 5;
        background: var(--a2-sand) !important;
    }

    .games-table th:nth-child(1)::after,
    .games-table td:nth-child(1)::after {
        content: "";
        position: absolute;
        top: 0;
        right: -16px;
        width: 16px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(
            to right,
            var(--a2-scroll-shade),
            transparent
        );
    }
}
