﻿/* Stats Hero Section */
.stats-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 2.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.stats-hero::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(20px);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.kpi-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.kpi-item:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.15);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.kpi-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.kpi-label {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Level Card */
.level-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    position: relative;
}

.level-display {
    margin-bottom: 1.5rem;
}

.level-circle {
    display: inline-block;
    margin-bottom: 1rem;
}

.level-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.level-text {
    font-size: 1rem;
    opacity: 0.8;
}

.xp-current {
    font-size: 1.25rem;
    font-weight: 600;
}

.xp-next {
    font-size: 0.875rem;
    opacity: 0.8;
}

.level-progress {
    position: relative;
    display: inline-block;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-circle {
    transition: stroke-dashoffset 1s ease;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Controls */
.stats-controls {
    display: flex;
    justify-content: between;
    align-items: center;
    background: white;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.control-tabs {
    display: flex;
    gap: 0.5rem;
}

.control-tab {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.control-tab:hover,
.control-tab.active {
    background: var(--gradient-primary);
    color: white;
    transform: translateY(-1px);
}

.control-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Stats Cards */
.stats-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: fit-content;
    max-height: 600px;
}

.stats-card .card-header {
    background: linear-gradient(135deg, #f8f9fc 0%, #f1f3f9 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    display: flex;
    justify-content: between;
    align-items: center;
}

.stats-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.stats-card .card-body {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
}

.card-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Subject Performance */
.subject-performance-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.subject-performance-item:last-child {
    border-bottom: none;
}

.subject-info {
    flex: 1;
}

.subject-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.subject-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.subject-metrics {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.metric-item {
    text-align: center;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.subject-progress-bar {
    width: 100px;
}

.progress-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
}

/* Difficulty Details */
.difficulty-item {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.difficulty-item:last-child {
    border-bottom: none;
}

.difficulty-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.difficulty-badge.easy {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.difficulty-badge.medium {
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
    color: white;
}

.difficulty-badge.hard {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
}

.difficulty-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Time Stats */
.time-stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.time-stat-item:last-child {
    border-bottom: none;
}

.time-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.time-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

.time-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.time-efficiency {
    margin-top: 1rem;
    text-align: center;
}

.efficiency-gauge {
    position: relative;
    width: 100px;
    height: 50px;
    margin: 0.75rem auto;
    background: conic-gradient(from 0deg, #ff6b6b 0deg, #feca57 90deg, #43e97b 180deg);
    border-radius: 100px 100px 0 0;
    overflow: hidden;
}

.efficiency-gauge::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 84px;
    height: 42px;
    background: white;
    border-radius: 84px 84px 0 0;
}

.gauge-fill {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 35px;
    background: var(--dark-color);
    transform-origin: bottom center;
    transition: transform 1s ease;
}

.gauge-value {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 700;
    color: var(--dark-color);
    font-size: 0.875rem;
}

/* Badges Showcase */
.badges-showcase {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.badge-showcase-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.badge-showcase-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.badge-icon-large {
    width: 40px;
    height: 40px;
    background: var(--gradient-secondary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.badge-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
}

.badge-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badges-progress {
    margin-top: 1rem;
}

.progress-info {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar-custom {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-custom {
    height: 100%;
    background: var(--gradient-success);
    border-radius: 3px;
    transition: width 0.8s ease;
}

.empty-badges {
    text-align: center;
    padding: 2rem 0;
}

/* Recent Activity */
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.activity-icon.excellent { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.activity-icon.good { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.activity-icon.average { background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%); }
.activity-icon.poor { background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%); }

.activity-info {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
}

.activity-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.activity-score {
    text-align: center;
}

.score-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
}

.score-badge.excellent { background: #43e97b; }
.score-badge.good { background: #4facfe; }
.score-badge.average { background: #feca57; }
.score-badge.poor { background: #ff6b6b; }

.empty-activity {
    text-align: center;
    padding: 2rem 0;
}

/* Insights */
.insights-card {
    background: linear-gradient(135deg, #f8f9fc 0%, #f1f3f9 100%);
    border: none;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.insight-item {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.insight-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.insight-item.success { border-left-color: #43e97b; }
.insight-item.warning { border-left-color: #feca57; }
.insight-item.info { border-left-color: #4facfe; }
.insight-item.danger { border-left-color: #ff6b6b; }

.insight-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.insight-item.success .insight-icon { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.insight-item.warning .insight-icon { background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%); }
.insight-item.info .insight-icon { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.insight-item.danger .insight-icon { background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%); }

.insight-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.insight-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.insight-action {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
}

.insight-action:hover {
    color: var(--primary-color);
    text-decoration: none;
    transform: translateX(4px);
}

/* Stats Level Card Styles */
.stats-level-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
    transition: all 0.4s ease;
    animation: cardEntryStats 0.8s ease-out;
}

@keyframes cardEntryStats {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stats-level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.25);
}

/* Orbes flottants en arrière-plan */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float-orb-stats 20s infinite ease-in-out;
}

.orb-1 {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.orb-2 {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #00d2d3 0%, #0abde3 100%);
    bottom: -30px;
    right: -30px;
    animation-delay: 5s;
}

@keyframes float-orb-stats {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

.card-content-stats {
    position: relative;
    z-index: 1;
}

/* Header avec badge */
.card-header-custom-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.level-display-stats {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.level-number-stats {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: number-pulse-stats 3s ease-in-out infinite;
}

@keyframes number-pulse-stats {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.level-label-stats {
    font-size: 1.2rem;
    color: #8b9dc3;
    font-weight: 500;
    align-self: center;
}

.stats-badge-custom {
    background: linear-gradient(135deg, #00d2d3 0%, #0abde3 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 5px 15px rgba(0, 210, 211, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.stats-badge-custom:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 210, 211, 0.4);
}

.stats-badge-custom i {
    font-size: 1rem;
}

/* Section XP */
.xp-section-stats {
    margin-bottom: 35px;
}

.xp-current-stats {
    font-size: 2.5rem;
    font-weight: 700;
    color: #5a67d8;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.xp-icon-stats {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    animation: icon-float-stats 3s ease-in-out infinite;
}

@keyframes icon-float-stats {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

.next-level-info-stats {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 20px;
}

.next-level-xp-stats {
    color: #667eea;
    font-weight: 600;
}

/* Cercle de progression moderne */
.progress-circle-container-stats {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 30px;
}

.progress-circle-bg-stats {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #f0f3f7;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.progress-svg-stats {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    transform-origin: center;
    overflow: visible;
}

.progress-circle-track-stats {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 15;
}

.progress-circle-path-stats {
    fill: none;
    stroke-width: 15;
    stroke-linecap: round;
    transition: stroke-dashoffset 2s ease-out;
    filter: drop-shadow(0 2px 8px rgba(102, 126, 234, 0.3));
}

.percentage-text-stats {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: percentage-pop-stats 1s ease-out 0.5s both;
}

@keyframes percentage-pop-stats {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Barre de progression linéaire */
.progress-linear-stats {
    background: #e9ecef;
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-linear-bar-stats {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #10dc60 100%);
    border-radius: 10px;
    transition: width 2s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-linear-bar-stats::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shimmer-stats 2s infinite;
}

@keyframes shimmer-stats {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Info XP restants */
.xp-remaining-stats {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.xp-remaining-stats:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    transform: translateX(5px);
}

.xp-remaining-icon-stats {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #667eea;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.xp-remaining-text-stats {
    flex: 1;
}

.xp-remaining-value-stats {
    font-size: 1.4rem;
    font-weight: 700;
    color: #5a67d8;
    margin-bottom: 2px;
}

.xp-remaining-label-stats {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Particles animées */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #667eea;
    border-radius: 50%;
    opacity: 0;
    animation: particle-rise-stats 8s infinite ease-out;
}

.particle:nth-child(1) { left: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 40%; animation-delay: 2s; }
.particle:nth-child(3) { left: 60%; animation-delay: 4s; }
.particle:nth-child(4) { left: 80%; animation-delay: 6s; }

@keyframes particle-rise-stats {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) scale(0.5);
    }
}

/* Responsive */
@media (max-width: 576px) {
    .stats-level-card {
        padding: 30px 20px;
    }
    
    .level-number-stats {
        font-size: 3rem;
    }
    
    .xp-current-stats {
        font-size: 2rem;
    }
    
    .progress-circle-container-stats {
        width: 150px;
        height: 150px;
    }

    .progress-circle-track-stats,
    .progress-circle-path-stats {
        stroke-width: 13;
    }
    
    .percentage-text-stats {
        font-size: 2.2rem;
    }
}

@media (min-width: 577px) and (max-width: 991.98px) {
    .progress-circle-container-stats {
        width: 164px;
        height: 164px;
        margin-bottom: 24px;
    }

    .progress-circle-track-stats,
    .progress-circle-path-stats {
        stroke-width: 14;
    }

    .percentage-text-stats {
        font-size: 2.45rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-hero {
        padding: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-kpis {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .kpi-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .stats-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .control-tabs {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
    
    .subject-metrics {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .difficulty-stats {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .badges-showcase {
        grid-template-columns: 1fr;
    }

    .progress-circle-bg-stats {
        box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.05);
    }
}

@media (max-width: 576px) {
    .hero-kpis {
        grid-template-columns: 1fr;
    }
    
    .level-card {
        padding: 1.5rem;
    }
    
    .subject-performance-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .subject-progress-bar {
        width: 100%;
    }
}
