/* assets/css/storicopartite.css - VERSIONE FINALE (Mobile, Glass, Legenda Fix) */

/* =========================================
   1. FONTS & VARIABILI GLOBALI
   ========================================= */
@font-face {
    font-family: 'DrukWide';
    src: url('/assets/doc/DrukWideBold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}
@font-face {
    font-family: 'HelveticaBold';
    src: url('/assets/doc/HelveticaBold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

:root {
    --rosa-neon: #ff19ff;
    --viola: #5e00ff;
    --bianco: #ffffff;
    /* Opacità ridotta per i container */
    --nero-transp: rgba(0, 0, 0, 0.7); 
    --verde: #00ff66;
    --rosso: #ff3333;
    --sfondo-box: rgba(17, 17, 17, 0.95);
}

body {
    background: url('/assets/imm/sfondouml25.jpg') center/cover fixed !important;
    color: var(--bianco);
    font-family: 'HelveticaBold', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Utility Fonts - NO LETTER SPACING */
.druk-font { font-family: 'DrukWide', sans-serif; letter-spacing: 0; }
.helvetica-font { font-family: 'HelveticaBold', sans-serif; }
.no-link-decoration { text-decoration: none; color: inherit; transition: opacity 0.2s; }
.no-link-decoration:hover { opacity: 0.8; }

main {
    max-width: 1200px;
    width: 95%;
    margin: 40px auto;
    animation: fadeIn 0.8s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   2. HEADER PARTITA (Match Grid)
   ========================================= */
.match-header-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 20px;
    background: var(--nero-transp);
    padding: 30px;
    border-radius: 20px;
    box-shadow: none; /* No ombra */
    margin-bottom: 40px;
    align-items: center;
    border: 1px solid rgba(255, 25, 255, 0.15);
    backdrop-filter: blur(5px);
}

/* Squadre Laterali */
.team-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.team-logo-wrapper img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.1));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.team-logo-wrapper img:hover { transform: scale(1.05); }

.team-name {
    font-size: 1.2rem;
    color: var(--bianco);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0;
}

/* Centro (Punteggio) */
.match-center-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.match-score {
    font-size: 4.5rem;
    color: var(--rosa-neon);
    text-shadow: 0 0 15px rgba(255, 25, 255, 0.3);
    line-height: 1;
    margin-bottom: 15px;
}

.match-meta-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.meta-item {
    font-size: 0.9rem;
    color: var(--bianco);
    text-transform: uppercase;
    opacity: 0.9;
}
.phase-label { color: var(--rosa-neon); font-weight: bold; letter-spacing: 0; }
.meta-extra { font-size: 0.8rem; color: var(--bianco); margin-top: 5px; font-style: italic; opacity: 0.8; }

/* Bottone Info */
.info-btn {
    background: transparent;
    border: 1px solid var(--rosa-neon);
    color: var(--rosa-neon);
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'HelveticaBold', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.info-btn:hover { background: var(--rosa-neon); color: #fff; box-shadow: 0 0 10px var(--rosa-neon); }

/* =========================================
   3. LISTE SQUADRE (Columns)
   ========================================= */
.teams-columns-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--nero-transp);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 25, 255, 0.15);
    backdrop-filter: blur(5px);
    box-shadow: none;
}

.team-column { padding: 0; }

.border-left-desktop {
    border-left: 1px solid rgba(255,255,255,0.1);
}

.team-col-header {
    text-align: center;
    font-size: 1rem;
    color: var(--rosa-neon);
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255, 25, 255, 0.2);
    letter-spacing: 0;
}

.players-list {
    padding: 10px 20px 30px 20px;
}

/* Player Row (Card) */
.player-row {
    padding: 15px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s ease, background 0.3s;
}
.player-row:hover {
    background: rgba(255, 25, 255, 0.08);
    transform: translateX(4px);
}

.player-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

/* Lato Sinistro: Foto + Nomi */
.player-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-img-wrap {
    position: relative;
    width: 50px;
    height: 50px;
}
.player-pic {
    width: 100%; height: 100%;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
}
.player-flag {
    position: absolute;
    bottom: -2px; right: -5px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid #111;
}

/* TESTI NOME/COGNOME/RUOLO */
.player-texts {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
}
.p-nome { 
    font-family: 'HelveticaBold', sans-serif;
    font-size: 0.75rem; 
    color: var(--bianco); 
    text-transform: uppercase; 
    margin-bottom: 2px; 
    opacity: 0.9; 
    letter-spacing: 0;
}
.p-cognome { 
    font-family: 'HelveticaBold', sans-serif;
    font-size: 1rem; 
    color: var(--bianco); 
    text-transform: uppercase; 
    opacity: 1; 
    letter-spacing: 0;
}
.p-ruolo { 
    font-family: 'HelveticaBold', sans-serif;
    font-size: 0.65rem; 
    color: var(--rosa-neon);
    margin-top: 2px; 
    letter-spacing: 0; 
    opacity: 0.9; 
}

/* Lato Destro: Icone + Voto */
.player-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icons-area {
    display: flex;
    justify-content: flex-end;
}
.gol-container-row {
    display: flex;
    gap: 2px;
}

.icon-s {
    width: 20px; 
    height: 20px;
    filter: brightness(0) invert(1);
    transition: transform 0.2s;
}
.icon-s:hover { transform: scale(1.1); }
.icon-s.ag { filter: sepia(1) saturate(5000%) hue-rotate(-50deg); }

/* Wrapper Voto */
.vote-wrapper {
    position: relative;
    width: 45px; height: 45px;
    display: flex; justify-content: center; align-items: center;
}

.voto-num {
    display: inline-flex; justify-content: center; align-items: center;
    width: 36px; height: 36px;
    border-radius: 6px;
    font-family: 'HelveticaBold', sans-serif !important; 
    font-size: 1rem;
    color: #ffffff !important; 
    font-weight: bold;
    position: relative; z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

.extra-icon-img { width: 36px; height: 36px; object-fit: contain; z-index: 10; }

.corner-icon {
    position: absolute;
    width: 20px; height: 20px;
    z-index: 20;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.8)) brightness(0) invert(1);
}
.mp { top: -5px; left: -5px; }
.motn { top: -5px; right: -5px; }

/* Separatore Extra */
.extra-separator {
    text-align: center;
    margin: 15px 0 10px 0;
    border-top: 1px dashed rgba(255,25,255,0.2);
    position: relative;
}
.extra-separator span {
    background: rgba(0,0,0,0.8);
    padding: 0 10px;
    position: relative;
    top: -9px;
    font-size: 0.7rem;
    color: var(--rosa-neon);
    letter-spacing: 0;
    border-radius: 10px;
}

/* Palette Colori Voti */
.voto-5down  { background-color: #cc0000 !important; }
.voto-5to6   { background-color: #ff6600 !important; }
.voto-6to65  { background-color: #ffcc00 !important; }
.voto-65to7  { background-color: #99cc00 !important; }
.voto-7to75  { background-color: #00cc00 !important; }
.voto-75to85 { background-color: #00ccff !important; }
.voto-85to95 { background-color: #0066ff !important; }
.voto-95to10 { background-color: #ff19ff !important; }
.voto-neutro { background-color: #444 !important; }

/* =========================================
   4. POPUP & TAVOLINO (FIX LEGENDA)
   ========================================= */

/* TAVOLINO */
.tavolino-box {
    text-align: center; padding: 40px 20px;
    background: var(--nero-transp); border-radius: 20px;
    border: 1px solid var(--rosa-neon); margin-top: 20px;
}
.tavolino-title { font-size: 1.8rem; color: var(--rosa-neon); margin-bottom: 10px; letter-spacing: 0; }
.tavolino-text { font-size: 1rem; color: var(--bianco); }

/* LEGENDA POPUP (Modale) */
.legend-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    z-index: 9990;
    display: none; /* Gestito via JS */
}

.legend-popup {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 90%; max-width: 350px;
    background: var(--nero-transp);
    border: 1px solid var(--rosa-neon);
    border-radius: 16px;
    z-index: 9999;
    display: none; /* Gestito via JS */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.legend-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.legend-title { font-size: 0.9rem; color: var(--rosa-neon); margin: 0; letter-spacing: 0; font-family: 'DrukWide', sans-serif; }

.close-btn {
    background: none; border: none; color: var(--bianco);
    font-size: 1.5rem; cursor: pointer; padding: 0; line-height: 1;
}

.legend-items { 
    padding: 20px; 
    /* Griglia 2 colonne per compattezza mobile */
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
}

.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: #ccc; }

.legend-icon { width: 24px; display: flex; justify-content: center; }
.leg-img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.leg-img.ag { filter: sepia(1) saturate(5000%) hue-rotate(-50deg); }
.penalty-icon-leg { width: 20px; height: 20px; object-fit: contain; }

.error-container {
    text-align: center; padding: 40px; background: var(--nero-transp);
    border-radius: 20px; color: var(--rosso); font-size: 1.2rem;
}

/* =========================================
   5. RESPONSIVE (MOBILE OTTIMIZZATO)
   ========================================= */
@media (max-width: 768px) {
    /* Header Compatto */
    .match-header-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 5px;
        padding: 15px 5px;
    }

    /* Loghi piccoli */
    .team-logo-wrapper img {
        width: 35px;
        height: 35px;
    }
    .team-display { gap: 4px; }

    /* Testo squadre ridotto */
    .team-name {
        font-size: 0.5rem;
        line-height: 1.1;
        word-break: break-word;
    }

    /* Punteggio ridotto */
    .match-score {
        font-size: 1.6rem;
        margin-bottom: 5px;
        text-shadow: 0 0 10px rgba(255, 25, 255, 0.3);
    }

    /* Meta info micro */
    .meta-item { font-size: 0.55rem; }
    .meta-extra { font-size: 0.5rem; }
    .info-btn { font-size: 0.55rem; padding: 3px 8px; margin-top: 5px; }

    /* Stack Colonne */
    .teams-columns-container { grid-template-columns: 1fr; }
    .border-left-desktop {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 0;
    }
    .team-col-header { font-size: 0.9rem; padding: 10px; }
    
    /* Player Row Compact */
    .players-list { padding: 5px 8px 20px 8px; }
    .player-row { padding: 8px 2px; } 
    
    .player-left { gap: 10px; }
    
    .player-img-wrap { width: 35px; height: 35px; }
    .player-pic { border-radius: 8px; } 
    .player-flag { width: 14px; height: 14px; bottom: -2px; right: -4px; }
    
    .p-cognome { font-size: 0.8rem; }
    .p-nome { font-size: 0.6rem; }
    .p-ruolo { font-size: 0.5rem; margin-top: 1px; }
    
    .player-right { gap: 6px; }
    .icon-s { width: 14px; height: 14px; }
    
    .vote-wrapper { width: 30px; height: 30px; }
    .voto-num { width: 26px; height: 26px; font-size: 0.8rem; border-radius: 4px; }
    .extra-icon-img { width: 26px; height: 26px; }
    .corner-icon { width: 14px; height: 14px; top: -4px; right: -4px; }
    .mp { left: -4px; }
    
    .extra-separator { margin: 10px 0; }
    .extra-separator span { font-size: 0.6rem; top: -8px; padding: 0 8px; }
}