/* CSS COMPLETO PER LEADERBOARD.HTML - leaderboard-style.css */

/* ===== BASE STYLES ===== */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #333;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

* {
    box-sizing: border-box;
}

.container {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 900px;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ===== NASCONDI COMPLETAMENTE LA TABELLA ===== */
.leaderboard-table,
#desktop-leaderboard {
    display: none !important;
    visibility: hidden !important;
}

/* ===== MOSTRA SEMPRE LE CARD ===== */
.mobile-leaderboard {
    display: block !important;
    width: 100%;
    overflow-x: hidden;
}

/* ===== INDICATORI DI CARICAMENTO ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    z-index: 1000;
    font-size: 14px;
    max-width: 90%;
    text-align: center;
}

/* ===== HEADER CLASSIFICHE ===== */
.leaderboard-header {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 30%, #FF6B35 70%, #1E3A8A 100%);
    color: white;
    padding: 25px 15px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.leaderboard-title {
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1.1;
}

.leaderboard-title::after {
    content: '🏆🥇🥈🥉';
    display: block;
    font-size: 0.5em;
    margin-top: 8px;
}

/* ===== CATEGORIE ===== */
.category-selector {
    background: linear-gradient(145deg, #f8fafc, #e2e8f0);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.category-title {
    font-size: 16px;
    font-weight: 800;
    color: #2d3748;
    margin-bottom: 15px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    justify-content: center;
}

.category-tab {
    padding: 10px 12px;
    background: linear-gradient(145deg, #ffffff, #f1f5f9);
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.category-tab:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.2);
    border-color: #4299e1;
}

.category-tab.active {
    background: linear-gradient(145deg, #4299e1, #3182ce);
    color: white;
    border-color: #2c5282;
    transform: translateY(-1px);
}

.category-tab.extreme {
    background: linear-gradient(145deg, #e53e3e, #c53030);
    color: white;
    border-color: #9c2626;
}

/* ===== SEZIONE CLASSIFICHE ===== */
.leaderboard-section {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow-x: hidden;
    width: 100%;
}

.leaderboard-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(145deg, #f0f9ff, #e0f2fe);
    border-radius: 10px;
    border-left: 4px solid #0ea5e9;
    font-size: 14px;
}

.leaderboard-info h3 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 1.2em;
}

.leaderboard-info div {
    color: #4a5568;
    font-size: 0.9em;
}

#leaderboard-content {
    overflow-x: hidden;
    width: 100%;
}

/* ===== LAYOUT CARD PER TUTTI I DISPOSITIVI ===== */
.mobile-entry {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border-color: #4299e1;
}

.mobile-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    width: 100%;
}

.mobile-position {
    font-size: 24px;
    font-weight: 900;
    flex-shrink: 0;
}

.mobile-position.gold { color: #FFD700; }
.mobile-position.silver { color: #C0C0C0; }
.mobile-position.bronze { color: #CD7F32; }

.mobile-score {
    font-size: 20px;
    font-weight: 900;
    color: #059669;
    flex-shrink: 0;
}

.mobile-name {
    font-size: 16px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    max-width: 100%;
}

.mobile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
    width: 100%;
    margin-bottom: 8px;
}

.mobile-stat {
    text-align: center;
    padding: 8px 4px;
    background: #f8fafc;
    border-radius: 6px;
    min-width: 0;
    word-wrap: break-word;
    overflow: hidden;
}

.mobile-stat div:first-child {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 3px;
    color: #2d3748;
}

.mobile-stat div:last-child {
    font-size: 10px;
    line-height: 1.2;
    color: #718096;
}

.mobile-title {
    margin-top: 8px;
    text-align: center;
    width: 100%;
}

.title-badge {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    max-width: 100%;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-badge.extreme-badge {
    background: linear-gradient(145deg, #e53e3e, #c53030);
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 14px 25px;
    font-size: 14px;
    font-weight: 800;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(145deg, #10b981, #059669);
    color: white;
}

.btn-secondary {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* ===== EMPTY LEADERBOARD ===== */
.empty-leaderboard {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.empty-leaderboard h3 {
    color: #4a5568;
    margin-bottom: 15px;
}

.empty-leaderboard p {
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Smartphone piccoli */
@media (max-width: 375px) {
    body {
        padding: 5px;
        overflow-x: hidden;
    }
    
    .container {
        padding: 8px;
        margin: 0;
        border-radius: 10px;
    }
    
    .leaderboard-title {
        font-size: 1.4em;
        margin-bottom: 6px;
        line-height: 1.2;
    }
    
    .category-tabs {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .category-tab {
        padding: 8px 6px;
        min-height: 40px;
        font-size: 10px;
    }
    
    .mobile-entry {
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 8px;
    }
    
    .mobile-position {
        font-size: 18px;
    }
    
    .mobile-score {
        font-size: 16px;
    }
    
    .mobile-name {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .mobile-stats {
        gap: 4px;
        font-size: 10px;
    }
    
    .mobile-stat {
        padding: 6px 2px;
    }
    
    .mobile-stat div:first-child {
        font-size: 11px;
        margin-bottom: 2px;
    }
    
    .mobile-stat div:last-child {
        font-size: 9px;
    }
    
    .title-badge {
        padding: 4px 6px;
        font-size: 8px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-btn {
        width: 100%;
        max-width: 100%;
        padding: 12px 20px;
        font-size: 12px;
    }
    
    .leaderboard-header,
    .category-selector,
    .leaderboard-section {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
}

/* Tablet */
@media (min-width: 376px) and (max-width: 768px) {
    .category-tabs {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .leaderboard-title {
        font-size: 2.2em;
    }
}

/* Desktop */
@media (min-width: 769px) {
    body {
        padding: 20px;
    }
    
    .container {
        padding: 30px;
    }
    
    .leaderboard-title {
        font-size: 3em;
        margin-bottom: 15px;
    }
    
    .category-tabs {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .mobile-entry {
        padding: 25px;
    }
    
    .mobile-stats {
        gap: 15px;
    }
    
    .mobile-stat {
        padding: 12px 10px;
    }
}

/* ===== MIGLIORAMENTI TOUCH ===== */
@media (hover: none) and (pointer: coarse) {
    .category-tab:hover,
    .action-btn:hover {
        transform: none;
    }
    
    .category-tab:active,
    .action-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.category-tab:focus,
.action-btn:focus {
    outline: 3px solid #4299e1;
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .action-buttons {
        display: none;
    }
    
    .leaderboard-header {
        background: #f8f9fa !important;
        color: #333 !important;
        border: 1px solid #ddd;
    }
    
    .category-tabs {
        display: none;
    }
}