/* Container tabella desktop */
.st-match-table-desktop {
    display: block;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 18px;
    padding: 0;
    max-width: 1200px;
    margin: 20px auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

/* Header della tabella */
.st-match-header {
    display: grid;
    grid-template-columns: 1fr 60px 30px 60px 1fr;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(207, 174, 112, 0.15), rgba(207, 174, 112, 0.05));
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-color);
    align-items: center;
}

/* Celle header */
.st-match-head-logo1,
.st-match-head-logo2 {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-match-head-gr-coachteam1,
.st-match-head-gr-coachteam2 {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-match-head-result {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Righe dati */
.st-match-grid-row {
    display: grid;
    grid-template-columns: 1fr 60px 30px 60px 1fr;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    align-items: center;
    transition: all 0.3s ease;
}

.st-match-grid-row:hover {
    background: rgba(207, 174, 112, 0.08);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.st-match-grid-row:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

/* Colonne Logo */
.st-match-col-logo1,
.st-match-col-logo2 {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-match-col-logo1 img,
.st-match-col-logo2 img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    padding: 3px;
    transition: all 0.3s ease;
}

/* Colonne Coach/Team */
.st-match-col-gr-coachteam1,
.st-match-col-gr-coachteam2 {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    min-width: 150px;
}

.st-match-col-team1,
.st-match-col-team2 {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    letter-spacing: 0.3px;
}

.st-match-col-coach1,
.st-match-col-coach2 {
    font-size: 0.85rem;
    color: var(--primary-color);
}

.st-match-col-points1,
.st-match-col-points2 {
    font-size: 1.25rem;
    color: var(--primary-color);
}

/* Colonna VS */
.st-match-col-vs {
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* Colonna Risultato */
.st-match-col-result {
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    background: rgba(207, 174, 112, 0.1);
    padding: 8px;
    border-radius: 6px;
}

/* Righe extra (per future statistiche aggiuntive) */
.st-match-extra-row {
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.9rem;
    padding: 10px 16px;
}

.st-match-col-extra-label {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.st-match-col-stat {
    color: #fff;
    padding: 6px;
    text-align: center;
}

.st-match-col-stat-value {
    color: #fff;
    padding: 6px;
    grid-column: span 3;
    text-align: center;
    overflow: visible;
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-match-col-stat-match {
    color: #fff;
    padding: 6px;
    text-align: right;
    grid-column: span 2;
}

.st-match-col-stat-match-value {
    color: #fff;
    padding: 6px;
    grid-column: span 2;
    text-align: left;
}

.st-match-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(207, 174, 112, 0.4);
}

/* Prima sezione (prima tabella) non ha margine superiore */
.st-match-section-title:first-of-type {
    margin-top: 10px;
}

.st-match-head-subtitle {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    grid-column: span 5;
}

/* Contenitore principale dei navigatori in stats.php */
.stats-nav {
    display: flex;
    gap: 10px;
    padding: 10px 5px;
    margin-bottom: 1rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    justify-content: safe center;
    align-content: center;
}

.stats-nav.stats-second-level {
    background: transparent;
    border-radius: 0;
    padding: 10px 5px;
    margin-top: -10px;
}

/* Stile specifico per i bottoni dei navigatori stats */
.stats-tab-btn {
    flex: 0 0 auto;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Montserrat Alternates', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.stats-tab-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.stats-tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
}

/* Nasconde la scrollbar per un look più pulito */
.stats-nav::-webkit-scrollbar {
    height: 4px;
}

.stats-nav::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#legendPopupTitle {
    margin-bottom: 12px;
}

/* Colore primario per i punteggi tra parentesi */
.stat-points-value {
    color: var(--primary-color);
}

/* Stile per le label delle statistiche con tooltip */
.stat-label {
    cursor: help;
    position: relative;
}

/* Tooltip desktop */
.stat-label::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
    z-index: 1000;
    border: 1px solid var(--primary-color);
}

.stat-label::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--primary-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 2px;
    z-index: 1000;
}

.stat-label:hover::after,
.stat-label:hover::before {
    opacity: 1;
}

/* Tooltip mobile */
.stat-tooltip-mobile {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 10000;
    max-width: 80%;
    text-align: center;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Stili per le sezioni speciali Dynasty e Season */
.special-section-container {
    text-align: center;
    padding: 40px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 18px;
    margin: 20px auto;
    max-width: 1200px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.special-section-title {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(207, 174, 112, 0.4);
}

.special-section-message {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.special-section-submessage {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
    font-size: 1rem;
}

/* ============================================
   STILI PER SEASON STATISTICS
   ============================================ */

/* Griglia per i box delle statistiche */
.season-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Singolo box statistiche */
.season-stat-box {
    background: rgba(0, 0, 0, 0.65);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(207, 174, 112, 0.2);
    transition: all 0.3s ease;
}

.season-stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 50px rgba(207, 174, 112, 0.3);
    border-color: var(--primary-color);
}

/* Titolo del box */
.season-stat-box-title {
    background: linear-gradient(135deg, rgba(207, 174, 112, 0.2), rgba(207, 174, 112, 0.1));
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
}

/* Contenuto del box */
.season-stat-box-content {
    padding: 16px;
}

/* Singolo item di statistica */
.season-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.season-stat-item:last-child {
    margin-bottom: 0;
}

.season-stat-item:hover {
    background: rgba(207, 174, 112, 0.08);
    transform: translateX(4px);
    border-color: rgba(207, 174, 112, 0.3);
}

/* Stili per righe cliccabili */
.season-stat-item[style*="cursor: pointer"]:hover {
    background: rgba(207, 174, 112, 0.15);
    box-shadow: 0 2px 8px rgba(207, 174, 112, 0.4);
}

.season-stat-item[style*="cursor: pointer"]:active {
    transform: translateX(6px) scale(0.98);
}

/* Ranking badge */
.season-stat-rank {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), rgba(207, 174, 112, 0.7));
    color: #000;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(207, 174, 112, 0.4);
}

/* Logo della squadra - nascosto su mobile, visibile su desktop */
.season-stat-logo {
    display: none;
}

@media screen and (min-width: 769px) {
    .season-stat-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 50px;
        height: 50px;
    }
    
    .season-stat-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}

/* Dettagli della statistica */
.season-stat-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Layout verticale su mobile (default) */
.season-stat-team-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.season-stat-team {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.season-stat-opp {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-style: italic;
}

/* Layout orizzontale su desktop */
@media screen and (min-width: 769px) {
    .season-stat-team-container {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }
}

/* Nome della franchigia (tra parentesi) */
.franchise-name {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.franchise-opp-name {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Valore principale */
.season-stat-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.05rem;
}

/* Risultato tra parentesi */
.season-stat-result {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.9rem;
    margin-left: 6px;
}

/* Week */
.season-stat-week {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Messaggio nessun dato */
.season-stat-no-data {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* ============================================
   MEDIA QUERIES PER MOBILE - HEAD TO HEAD
   ============================================ */

/* Tablet e smartphone (max-width: 768px) */
@media screen and (max-width: 768px) {
    
    /* Header tabella - Layout senza loghi (4 colonne invece di 6) */
    .st-match-header {
        grid-template-columns: 1fr 30px 1fr;
        gap: 8px;
        padding: 10px 12px;
        font-size: 0.75rem;
    }
    
    /* Righe tabella - Layout senza loghi (4 colonne invece di 6) */
    .st-match-grid-row {
        grid-template-columns: 1fr 30px 1fr;
        gap: 8px;
        padding: 12px;
    }
    
    /* NASCONDI le colonne logo su mobile */
    .st-match-head-logo1,
    .st-match-head-logo2,
    .st-match-col-logo1,
    .st-match-col-logo2 {
        display: none !important;
    }
    
    /* Ottimizzazione generale per mobile */
    .st-match-table-desktop {
        max-width: 100%;
        padding: 0;
        margin: 10px auto;
        border-radius: 12px;
    }
    
    /* Colonne Coach/Team più compatte */
    .st-match-col-gr-coachteam1,
    .st-match-col-gr-coachteam2 {
        min-width: auto;
        gap: 2px;
    }
    
    .st-match-col-team1,
    .st-match-col-team2 {
        font-size: 0.9rem;
    }
    
    .st-match-col-coach1,
    .st-match-col-coach2 {
        font-size: 0.75rem;
    }
    
    /* Colonna Risultato su mobile */
    .st-match-col-result {
        font-size: 0.95rem;
        padding: 6px;
    }
  
    /* Titoli sezioni */
    .st-match-section-title {
        font-size: 1.2rem;
        margin-top: 20px;
        margin-bottom: 15px;
        letter-spacing: 1.5px;
    }

    .st-match-col-stat-value {
        color: #fff;
        text-align: center;
        grid-column: span 1;
        overflow: visible;
        white-space: nowrap;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Nascondi tooltip desktop su mobile */
    .stat-label::after,
    .stat-label::before {
        display: none;
    }

    .stat-label {
        cursor: pointer;
        display: inline-block;
        white-space: nowrap;
    }

    .st-match-head-subtitle {
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
        grid-column: span 3;
    }
    
    .st-match-col-stat-match {
        color: #fff;
        padding: 6px;
        text-align: right;
        grid-column: span 1;
    }

    .st-match-col-stat-match-value {
        color: #fff;
        padding: 6px;
        grid-column: span 1;
        text-align: left;
    }

    /* Sezioni speciali responsive */
    .special-section-container {
        padding: 30px 20px;
        margin: 15px 10px;
    }

    .special-section-title {
        font-size: 1.5rem;
    }

    .special-section-message {
        font-size: 1rem;
    }

    .special-section-submessage {
        font-size: 0.9rem;
    }

    /* Season Stats Grid - Mobile */
    .season-stats-grid {
        gap: 15px;
        padding: 0 10px;
    }

    .season-stat-box-title {
        font-size: 1rem;
        padding: 14px;
    }

    .season-stat-item {
        gap: 10px;
        padding: 10px;
    }

    .season-stat-rank {
        width: 35px;
        height: 35px;
        font-size: 0.85rem;
    }

    .season-stat-team {
        font-size: 0.9rem;
    }

    .season-stat-value {
        font-size: 0.95rem;
    }
}

/* Smartphone piccoli (max-width: 480px) */
@media screen and (max-width: 480px) {
    
    /* Header ancora più compatto - senza loghi */
    .st-match-header {
        grid-template-columns: 1fr 25px 1fr;
        gap: 6px;
        padding: 8px 10px;
        font-size: 0.7rem;
    }
    
    /* Righe ancora più compatte - senza loghi */
    .st-match-grid-row {
        grid-template-columns: 1fr 25px 1fr;
        gap: 6px;
        padding: 10px;
    }
    
    /* Colonne Coach/Team */
    .st-match-col-team1,
    .st-match-col-team2 {
        font-size: 0.85rem;
    }
    
    .st-match-col-coach1,
    .st-match-col-coach2 {
        font-size: 0.7rem;
    }
    
    /* Colonna Risultato su mobile piccolo */
    .st-match-col-result {
        font-size: 0.85rem;
        padding: 5px;
    }

    /* Titoli sezioni */
    .st-match-section-title {
        font-size: 1.05rem;
        margin-top: 15px;
        margin-bottom: 10px;
        letter-spacing: 1px;
    }

    .st-match-col-stat-value {
        color: #fff;
        text-align: center;
        grid-column: span 1;
        overflow: visible;
        white-space: nowrap;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .st-match-head-subtitle {
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
        grid-column: span 3;
    }

    .st-match-col-stat-match {
        color: #fff;
        padding: 6px;
        text-align: right;
        grid-column: span 1;
    }

    .st-match-col-stat-match-value {
        color: #fff;
        padding: 6px;
        grid-column: span 1;
        text-align: left;
    }

    /* Sezioni speciali responsive per smartphone piccoli */
    .special-section-container {
        padding: 25px 15px;
        margin: 10px 5px;
    }

    .special-section-title {
        font-size: 1.3rem;
        letter-spacing: 1px;
    }

    .special-section-message {
        font-size: 0.95rem;
    }

    .special-section-submessage {
        font-size: 0.85rem;
    }

    /* Season Stats - Smartphone piccoli */
    .season-stat-box-title {
        font-size: 0.95rem;
        padding: 12px;
        letter-spacing: 1px;
    }

    .season-stat-box-content {
        padding: 12px;
    }

    .season-stat-item {
        gap: 8px;
        padding: 8px;
    }

    .season-stat-rank {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .season-stat-team {
        font-size: 0.85rem;
    }

    .franchise-name {
        font-size: 0.8rem;
    }

    .season-stat-opp {
        font-size: 0.8rem;
    }

    .season-stat-value {
        font-size: 0.9rem;
    }

    .season-stat-result {
        font-size: 0.85rem;
    }

    .season-stat-week {
        font-size: 0.75rem;
    }
}
