/* ===== STATS.CSS - Thème light avec vue d'ensemble améliorée ===== */
/* css/stats.css */

/* ===== Hero Section ===== */
.stats-hero {
    background: linear-gradient(135deg, #4A90E2 0%, #5CA0F2 100%);
    color: var(--white);
    padding: var(--spacing-3xl) 0;
    margin-top: 0px;
    padding-top: calc(var(--spacing-3xl) + 80px);
    text-align: center;
}

.stats-hero .hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.stats-hero .hero-title {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
    margin: 0 0 var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
}

.stats-hero .hero-icon {
    font-size: 1.1em;
    animation: pulse 2s ease-in-out infinite;
}

.stats-hero .hero-subtitle {
    font-size: 1.25rem;
    font-weight: 300;
    opacity: 0.95;
}

/* ===== Main Content ===== */
.stats-page .main-content {
    padding: var(--spacing-3xl) 0;
    background: #FAFBFC;
    /* Fix navbar overlap */
    margin-top: 80px;
}

/* ===== Stats Section ===== */
.stats-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    margin-bottom: var(--spacing-2xl);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #E1E4E8;
}

/* Vue d'ensemble avec style amélioré */
.overview-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid #E1E4E8;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: 0;
}

.section-icon {
    font-size: 1em;
}

/* ===== Stats Grid amélioré ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
}

.stat-card {
    background: #FAFBFC;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: var(--primary-blue);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

/* Cards colorées pour la vue d'ensemble */
.stat-card.primary {
    background: linear-gradient(135deg, #4A90E2 0%, #5CA0F2 100%);
    color: white;
}

.stat-card.primary .stat-label {
    color: rgba(255,255,255,0.9);
}

.stat-card.secondary {
    background: linear-gradient(135deg, #48BB78 0%, #38A169 100%);
    color: white;
}

.stat-card.secondary .stat-label {
    color: rgba(255,255,255,0.9);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1A202C;
    margin-bottom: var(--spacing-sm);
}

.stat-card.primary .stat-value,
.stat-card.secondary .stat-value {
    color: white;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ===== Chart Container ===== */
.chart-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    margin: var(--spacing-2xl) 0;
}

.chart-wrapper {
    background: #FAFBFC;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    position: relative;
    height: 300px;
    border: 1px solid #E1E4E8;
}

.chart-wrapper.full-width {
    grid-column: 1 / -1;
    height: 400px;
}

/* ===== Activities Table ===== */
.activities-table-wrapper {
    overflow-x: auto;
    margin-top: var(--spacing-2xl);
    border-radius: var(--radius-lg);
    border: 1px solid #E1E4E8;
}

.activities-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.activities-table th {
    background: #F6F8FA;
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid #E1E4E8;
    font-size: 0.875rem;
}

.activities-table td {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid #F0F0F0;
}

.activities-table tbody tr:hover {
    background: #FAFBFC;
}

.activities-table .text-center {
    text-align: center;
}

/* ===== Activity Badge ===== */
.activity-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    background: #F0F2F5;
    color: var(--gray-700);
}

.activity-badge.rando {
    background: #E6F4EA;
    color: #1E7E34;
}

.activity-badge.ski {
    background: #E1F5FE;
    color: #0277BD;
}

.activity-badge.roller {
    background: #FFEBEE;
    color: #C62828;
}

.activity-badge.randoski,
.activity-badge.ski_de_randonnee {
    background: #E0F7FA;
    color: #006064;
}

.activity-badge.trekking {
    background: #FFF8E1;
    color: #F57C00;
}

/* ===== Section Filters ===== */
.section-filters {
    display: flex;
    gap: var(--spacing-md);
}

.filter-select {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: 1px solid #D1D5DB;
    border-radius: var(--radius-md);
    background: var(--white);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: #4A90E2;
}

.filter-select:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* ===== Monthly Stats ===== */
.monthly-stats {
    margin-top: var(--spacing-3xl);
}

.monthly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.monthly-header h3 {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin: 0;
}

/* ===== Fun Stats ===== */
.fun-stats {
    background: #F8F9FB;
}

.fun-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.fun-stat-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    transition: all 0.2s ease;
    border: 1px solid #E1E4E8;
}

.fun-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.fun-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    background: #F0F7FF;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fun-content {
    flex: 1;
}

.fun-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1A202C;
    margin-bottom: var(--spacing-xs);
}

.fun-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-section {
    animation: fadeInUp 0.5s ease;
}

/* ===== Loading State ===== */
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    color: var(--gray-500);
}

/* ===== Error Message ===== */
.error-message {
    background: #FEE2E2;
    color: #991B1B;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    border: 1px solid #FECACA;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .stats-page .main-content {
        margin-top: 60px; /* Adjust for mobile navbar */
    }
    
    .stats-section {
        padding: var(--spacing-lg);
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .monthly-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: flex-start;
    }
    
    .monthly-header .filter-select {
        width: 100%;
    }
    
    .stat-card {
        padding: var(--spacing-lg);
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .fun-stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-wrapper {
        height: 250px;
        padding: var(--spacing-md);
    }
    
    .activities-table {
        font-size: 0.75rem;
    }
    
    .activities-table th,
    .activities-table td {
        padding: var(--spacing-sm);
    }
    
    /* Masquer certaines colonnes sur mobile */
    .activities-table th:nth-child(5),
    .activities-table td:nth-child(5),
    .activities-table th:nth-child(6),
    .activities-table td:nth-child(6),
    .activities-table th:nth-child(7),
    .activities-table td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-hero .hero-title {
        font-size: 1.75rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .fun-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* ===== Print Styles ===== */
@media print {
    .section-filters,
    nav,
    footer {
        display: none;
    }
    
    .stats-section {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* Ajout pour l'animation JavaScript corrigée */
.stat-card, .fun-stat-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.stat-card.is-visible, .fun-stat-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ===== AJOUT POUR L'ALIGNEMENT DES STATS ===== */
.activities-table th:nth-child(n+2),
.activities-table td:nth-child(n+2) {
    text-align: right;
}
