/* ============================================
   COACHES EFFICIENCY - Tabella efficienza coach
   ============================================ */

/* Container principale */
.st-coaches-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header della tabella */
.st-coaches-header {
    display: grid;
    grid-template-columns: 60px 1fr 60px 140px 60px 60px 140px 60px;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(var(--primary-color), 0.15), rgba(var(--primary-color), 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;
}

/* Layout modificato quando hideWeekData = 1 (senza colonne week) */
.st-coaches-header.hide-week-columns {
    grid-template-columns: 60px 1fr 60px 140px 60px;
}

.st-coaches-grid-row.hide-week-columns {
    grid-template-columns: 60px 1fr 60px 140px 60px;
}

/* Celle header - Allineamento identico alle colonne dati */
.st-coaches-head-logo {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-coaches-head-coachteam {
    text-align: left;
    display: flex;
    align-items: center;
    min-width: 150px;
    /* Larghezza minima per evitare compressione eccessiva */
}

.st-coaches-head-rank,
.st-coaches-head-prank {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
}

.st-coaches-head-rank::before,
.st-coaches-head-prank::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -12px;
    bottom: -12px;
    width: 2px;
    background: rgba(var(--primary-color), 0.4);
}

.st-coaches-head-rank::after,
.st-coaches-head-prank::after {
    content: '⇅';
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.9em;
}

.st-coaches-head-rank.sorted-asc::after,
.st-coaches-head-prank.sorted-asc::after {
    content: '▲';
    opacity: 1;
    color: #4ade80;
}

.st-coaches-head-rank.sorted-desc::after,
.st-coaches-head-prank.sorted-desc::after {
    content: '▼';
    opacity: 1;
    color: #4ade80;
}

.st-coaches-head-rank:hover,
.st-coaches-head-prank:hover {
    color: #fff;
    transform: scale(1.05);
}

.st-coaches-head-gr-points {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-coaches-head-bof {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-coaches-head-gr-ppoints {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-coaches-head-pbof {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Righe della griglia */
.st-coaches-grid-row {
    display: grid;
    grid-template-columns: 60px 1fr 60px 140px 60px 60px 140px 60px;
    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-coaches-grid-row:hover {
    background: rgba(var(--primary-color), 0.08);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.st-coaches-grid-row:last-child {
    border-radius: 0 0 8px 8px;
}

/* Colonna Logo */
.st-coaches-col-logo {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.st-coaches-col-logo img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid rgba(var(--primary-color), 0.3);
    padding: 3px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.st-coaches-grid-row:hover .st-coaches-col-logo img {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Colonna Coach/Team */
.st-coaches-col-coachteam {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    min-width: 150px;
    /* Larghezza minima per evitare compressione eccessiva */
}

.st-coaches-col-coach {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    letter-spacing: 0.3px;
}

.st-coaches-col-team {
    font-size: 0.85rem;
    color: var(--primary-color);
}

/* Colonna Rank */
.st-coaches-col-rank {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(var(--primary-color), 0.1);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.st-coaches-col-rank::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -14px;
    bottom: -14px;
    width: 2px;
    background: rgba(var(--primary-color), 0.4);
}

/* Colonne Punti (Week e Progressivi) */
.st-coaches-col-gr-points,
.st-coaches-col-gr-ppoints {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    justify-content: center;
    align-items: center;
}

.st-coaches-col-eff,
.st-coaches-col-peff {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.st-coaches-col-points,
.st-coaches-col-ppoints {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Colonne Best On Field */
.st-coaches-col-bof,
.st-coaches-col-pbof {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #fbbf24;
    /* Giallo/oro per best on field */
    background: rgba(251, 191, 36, 0.1);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Colonna Rank Progressivo */
.st-coaches-col-prank {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #60a5fa;
    /* Blu per progressivo */
    background: rgba(96, 165, 250, 0.1);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.st-coaches-col-prank::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -14px;
    bottom: -14px;
    width: 2px;
    background: rgba(var(--primary-color), 0.4);
}

/* Contenitore principale dei navigatori in stats.php */
.stats-nav {
    display: flex;
    /*justify-content: flex-start;*/
    /* Allineamento a sinistra per permettere lo scroll corretto */
    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;
    /* Rimosso lo sfondo chiaro */
    border-radius: 0;
    /* Rimosso l'arrotondamento */
    padding: 10px 5px;
    /* Allineato al padding del primo livello */
    margin-top: -10px;
    /* Opzionale: riduce lo spazio tra i due navigatori */
}

/* 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;
}

/* Gestione tabelle Coaches Desktop vs Mobile */
.st-coaches-table-desktop {
    display: block;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 18px;
    padding: 0;
    max-width: 1400px;
    margin: 20px auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.st-coaches-table-mobile {
    display: none;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 18px;
    padding: 20px;
    max-width: 600px;
    margin: 20px auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.st-coaches-mobile-section {
    margin-bottom: 30px;
}

.st-coaches-mobile-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Stili per colonne ordinabili */
[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

[data-sort]:hover {
    color: #fff;
    background: rgba(207, 174, 112, 0.25);
    border-radius: 6px;
}

/* Indicatore di ordinamento */
[data-sort].sortable::after {
    content: '⇅';
    margin-left: 4px;
    opacity: 0.4;
    font-size: 0.9em;
}

[data-sort].sorted-asc::after {
    content: '▲';
    margin-left: 4px;
    color: var(--primary-color);
    opacity: 1;
}

[data-sort].sorted-desc::after {
    content: '▼';
    margin-left: 4px;
    color: var(--primary-color);
    opacity: 1;
}

/* ============================================
   MEDIA QUERIES PER MOBILE
   ============================================ */

/* Tablet e smartphone (max-width: 768px) */
@media screen and (max-width: 768px) {
    
    /* Nascondi tabella desktop e mostra tabelle mobile */
    .st-coaches-table-desktop {
        display: none !important;
    }
    
    .st-coaches-table-mobile {
        display: block !important;
    }
    
    /* Header tabella mobile - SENZA colonna logo */
    .st-coaches-table-mobile .st-coaches-header {
        grid-template-columns: 1fr 60px 120px 50px;
        gap: 8px;
        padding: 10px 12px;
        font-size: 0.75rem;
    }
    
    /* Righe tabella mobile - SENZA colonna logo */
    .st-coaches-table-mobile .st-coaches-grid-row {
        grid-template-columns: 1fr 60px 120px 50px;
        gap: 8px;
        padding: 12px;
    }
    
    /* NASCONDI la colonna logo nelle tabelle mobile */
    .st-coaches-table-mobile .st-coaches-head-logo,
    .st-coaches-table-mobile .st-coaches-col-logo {
        display: none !important;
    }
    
    /* Ottimizzazione colonna coach/team */
    .st-coaches-col-coachteam {
        min-width: auto;
        gap: 2px;
    }
    
    .st-coaches-col-coach {
        font-size: 0.9rem;
    }
    
    .st-coaches-col-team {
        font-size: 0.75rem;
    }
    
    /* Colonne rank più compatte */
    .st-coaches-col-rank,
    .st-coaches-col-prank {
        font-size: 0.95rem;
        padding: 6px;
    }
    
    /* Colonne efficienza */
    .st-coaches-col-gr-points,
    .st-coaches-col-gr-ppoints {
        gap: 2px;
    }
    
    .st-coaches-col-eff,
    .st-coaches-col-peff {
        font-size: 0.95rem;
    }
    
    .st-coaches-col-points,
    .st-coaches-col-ppoints {
        font-size: 0.75rem;
    }
    
    /* Colonne Best16 */
    .st-coaches-col-bof,
    .st-coaches-col-pbof {
        font-size: 0.9rem;
        padding: 6px;
    }
    
    /* Titoli sezioni mobile */
    .st-coaches-mobile-title {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    /* Sezioni mobile */
    .st-coaches-mobile-section {
        margin-bottom: 25px;
    }
    
    /* Container principale mobile */
    .st-coaches-table-mobile {
        padding: 15px;
        max-width: 100%;
    }
}

/* Smartphone piccoli (max-width: 480px) */
@media screen and (max-width: 480px) {
    
    /* Header ancora più compatto */
    .st-coaches-table-mobile .st-coaches-header {
        grid-template-columns: 1fr 50px 110px 40px;
        gap: 6px;
        padding: 8px 10px;
        font-size: 0.7rem;
    }
    
    /* Righe ancora più compatte */
    .st-coaches-table-mobile .st-coaches-grid-row {
        grid-template-columns: 1fr 50px 110px 40px;
        gap: 6px;
        padding: 10px;
    }
    
    /* Colonna coach/team */
    .st-coaches-col-coach {
        font-size: 0.85rem;
    }
    
    .st-coaches-col-team {
        font-size: 0.7rem;
    }
    
    /* Colonne rank */
    .st-coaches-col-rank,
    .st-coaches-col-prank {
        font-size: 0.9rem;
        padding: 5px;
    }
    
    /* Colonne efficienza */
    .st-coaches-col-eff,
    .st-coaches-col-peff {
        font-size: 0.9rem;
    }
    
    .st-coaches-col-points,
    .st-coaches-col-ppoints {
        font-size: 0.7rem;
    }
    
    /* Colonne Best16 */
    .st-coaches-col-bof,
    .st-coaches-col-pbof {
        font-size: 0.85rem;
        padding: 5px;
    }
    
    /* Titoli sezioni */
    .st-coaches-mobile-title {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    /* Sezioni mobile */
    .st-coaches-mobile-section {
        margin-bottom: 20px;
    }
    
    /* Container principale */
    .st-coaches-table-mobile {
        padding: 12px;
        border-radius: 12px;
    }
    
    /* Header colonne - rimuovo i separatori verticali per risparmiare spazio */
    .st-coaches-col-rank::before,
    .st-coaches-col-prank::before {
        display: none;
    }
}