/* ===== MODAL STATISTIQUES ===== */

.stats-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-modal-overlay.active {
    opacity: 1;
}

.stats-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.stats-modal {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(26, 26, 26, 0.95));
    border: 3px solid var(--gold);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.stats-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: rgba(212, 175, 55, 0.1);
    border-bottom: 2px solid rgba(212, 175, 55, 0.3);
}

.stats-modal-header h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    color: var(--gold);
    letter-spacing: 1px;
}

.stats-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.5);
    border-radius: 50%;
    color: #ef4444;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stats-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: rotate(90deg);
}

.stats-modal-body {
    padding: 30px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Scrollbar */
.stats-modal-body::-webkit-scrollbar {
    width: 8px;
}

.stats-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.stats-modal-body::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 10px;
}

/* ===== GRILLE DE STATS ===== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
}

.stat-card-large {
    grid-column: span 2;
}

.stat-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 42px;
    font-weight: 900;
    color: var(--gold);
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--gold), var(--light-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin-bottom: 5px;
}

.stat-sublabel {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

/* ===== SECTIONS ===== */

.stats-section {
    margin-bottom: 35px;
    padding: 25px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid rgba(212, 175, 55, 0.15);
    border-radius: 20px;
}

.stats-section-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
}

/* ===== CATÉGORIES ===== */

.stats-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.category-progress {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.category-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--light-gold));
    border-radius: 10px;
    transition: width 1s ease;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* ===== HABITUDES ===== */

.stats-habits {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.habit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.habit-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.habit-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
}

/* ===== GRAPHIQUE SEMAINE ===== */

.stats-week-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 15px;
    height: 200px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
}

.week-chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.week-chart-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--light-gold), var(--gold));
    border-radius: 8px 8px 0 0;
    position: relative;
    min-height: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    transition: height 0.8s ease;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.week-chart-value {
    font-size: 12px;
    font-weight: 700;
    color: #000;
}

.week-chart-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

/* ===== COMPARAISON ===== */

.stats-comparison {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comparison-item {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.comparison-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.comparison-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--gold);
    margin-bottom: 15px;
}

.comparison-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.comparison-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 10px;
    transition: width 1.5s ease;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* ===== ERREUR ===== */

.stats-error {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
}

/* ===== MOBILE ===== */

@media (max-width: 768px) {
    .stats-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .stats-modal-header {
        padding: 20px;
    }
    
    .stats-modal-header h2 {
        font-size: 22px;
    }
    
    .stats-modal-body {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card-large {
        grid-column: span 1;
    }
    
    .stat-value {
        font-size: 36px;
    }
    
    .stats-week-chart {
        height: 150px;
        padding: 15px;
    }
    
    .week-chart-value {
        font-size: 10px;
    }
}