/*
    classifiche_desktop.css
    Stili per classifiche stile torneo professionale
*/

h1 {
    font-family: 'Rajdhani Regular', sans-serif;
    color: #ffffff;
    margin: 15px 0 30px 0;
    text-align: center;
    font-size: 1.8em;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    width: 100%;
    display: block;
    position: relative;
    padding-bottom: 15px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
}

/* Contenitore principale per le classifiche */
#leaderboard-container {
    width: 95%;
    max-width: 1400px;
    margin: 20px auto;
    padding: 30px;
    background: linear-gradient(180deg, rgba(26, 25, 46, 0.95) 0%, rgba(26, 25, 46, 0.98) 100%);
    border: 1px solid rgba(0, 191, 255, 0.15);
    border-radius: 8px;
    flex-grow: 1;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Contenitore flessibile per le classifiche - Grid Layout */
#game-leaderboards-flex-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
    padding: 0;
}

@media (max-width: 768px) {
    #game-leaderboards-flex-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Singolo blocco classifica */
.game-leaderboard {
    background: linear-gradient(180deg, rgba(45, 44, 65, 0.8) 0%, rgba(45, 44, 65, 0.95) 100%);
    border: 1px solid rgba(0, 191, 255, 0.2);
    padding: 20px;
    border-radius: 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.25s ease;
}

.game-leaderboard:hover {
    border-color: rgba(0, 191, 255, 0.4);
    box-shadow: 
        0 6px 20px rgba(0, 191, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

/* Titolo della classifica all'interno del blocco */
.game-leaderboard h2 {
    font-family: 'Rajdhani Regular', sans-serif;
    color: #ffffff;
    margin: 0 0 18px 0;
    font-size: 1.15em;
    text-align: center;
    width: 100%;
    position: relative;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding-bottom: 12px;
}

/* Linea decorativa sotto il titolo del blocco */
.game-leaderboard h2::after {
    content: "";
    display: block;
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.4), transparent);
    margin-top: 12px;
    position: absolute;
    bottom: 0;
    left: 0;
}

/* Entry punteggi */
.score-entry {
    font-size: 0.875em;
    margin-bottom: 6px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    border-left: 2px solid rgba(0, 191, 255, 0.3);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.score-entry:hover {
    background: rgba(0, 0, 0, 0.4);
    border-left-color: var(--color-accent);
}

.score-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Evidenzia primo posto */
.score-entry:first-child {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.12) 0%, rgba(0, 0, 0, 0.25) 100%);
    border-left-color: #ffd700;
    border-left-width: 3px;
    font-weight: 600;
}

.score-entry:first-child:hover {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.18) 0%, rgba(0, 0, 0, 0.4) 100%);
}

/* Evidenzia secondo posto */
.score-entry:nth-child(2) {
    border-left-color: rgba(192, 192, 192, 0.5);
}

/* Evidenzia terzo posto */
.score-entry:nth-child(3) {
    border-left-color: rgba(205, 127, 50, 0.5);
}

/* Numero posizione */
.score-rank {
    margin-right: 14px;
    font-weight: 600;
    color: #ffffff;
    font-family: 'Rajdhani Regular', sans-serif;
    font-size: 0.85em;
    min-width: 28px;
    text-align: center;
    background: rgba(0, 191, 255, 0.1);
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid rgba(0, 191, 255, 0.2);
    flex-shrink: 0;
}

.score-entry:first-child .score-rank {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border-color: rgba(255, 215, 0, 0.4);
}

.score-entry:nth-child(2) .score-rank {
    background: rgba(192, 192, 192, 0.15);
    color: #c0c0c0;
    border-color: rgba(192, 192, 192, 0.3);
}

.score-entry:nth-child(3) .score-rank {
    background: rgba(205, 127, 50, 0.15);
    color: #cd7f32;
    border-color: rgba(205, 127, 50, 0.3);
}

/* Nome giocatore / Iniziali */
.score-player,
.score-initials {
    font-weight: 500;
    color: #e0e0e0;
    font-family: 'Rajdhani Regular', sans-serif;
    flex-grow: 1;
    text-align: left;
    font-size: 0.9em;
    margin-left: 8px;
}

.score-player {
    color: #6bb6ff;
    font-weight: 600;
}

/* Valore punteggio */
.score-value {
    color: #4ade80;
    font-family: 'Rajdhani Regular', sans-serif;
    text-align: right;
    font-size: 0.9em;
    font-weight: 600;
    min-width: 75px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Messaggio no scores */
#no-highscores {
    font-size: 1.1em;
    color: var(--color-text);
    margin-top: 40px;
    text-align: center;
    width: 100%;
    display: block;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px dashed rgba(0, 191, 255, 0.3);
    font-family: 'Rajdhani Regular', sans-serif;
}

/* Media Queries */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5em;
        margin: 15px 0 20px 0;
        letter-spacing: 2px;
    }

    #leaderboard-container {
        padding: 15px;
        margin: 15px auto;
        width: 95%;
    }

    .game-leaderboard {
        padding: 15px;
        width: 100%;
        min-width: auto;
        max-width: none;
    }

    .game-leaderboard h2 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }

    .score-entry {
        font-size: 0.85em;
        margin-bottom: 6px;
        padding: 8px 12px;
    }

    #no-highscores {
        font-size: 1em;
        margin-top: 30px;
        padding: 15px;
    }
}

@media (min-width: 769px) {
    #leaderboard-container {
        flex-direction: column;
        align-items: center;
    }

    .game-leaderboard {
        flex: 1 1 320px;
        min-width: 300px;
        max-width: 380px;
    }
}

/* --- PATCH: integrazione iframe AJAX Chat (desktop) --------------------- */
#chat-embed {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

#chat-embed>#chat-iframe.chat-iframe {
    display: block;
    width: 100%;
    height: 72vh;
    min-height: 520px;
    max-height: 90vh;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

#chat-embed iframe#chat-iframe {
    height: 72vh !important;
}

#chat-section,
#chat-embed {
    overflow: visible !important;
}
