
/* Variables CSS pour cohérence */
:root {
    --badges-primary: #667eea;
    --badges-secondary: #764ba2;
    --badges-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --badges-gradient-light: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
    --badges-success: #43e97b;
    --badges-warning: #f6d365;
    --badges-gold: #ffd700;
    --badges-silver: #c0c0c0;
    --badges-bronze: #cd7f32;
    --badges-card-bg: #ffffff;
    --badges-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --badges-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
    --badges-border-radius: 20px;
    --badges-transition: all 0.3s ease;
}

/* Hero Section */
.badges-hero {
    background: var(--badges-gradient);
    border-radius: 24px;
    padding: 3rem 2rem;
    color: white;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--badges-shadow-lg);
}

.badges-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.badges-hero::after {
    content: "🏆";
    position: absolute;
    top: 26px;
    right: 34px;
    font-size: 5rem;
    opacity: 0.42;
    filter: brightness(1.08) saturate(1.05) drop-shadow(0 10px 24px rgba(255, 196, 87, 0.18));
    transform: rotate(-8deg);
    z-index: 0;
    pointer-events: none;
}

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

.badges-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badges-description {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
    gap: 1.5rem;
    margin-top: 2rem;
    justify-content: center;
}

.hero-stat {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--badges-transition);
    width: 100%;
}

.hero-stat:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 500;
}

/* Sections */
.badges-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-subtitle {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Grille de badges */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

/* Badge Cards */
.badge-card {
    background: var(--badges-card-bg);
    border-radius: var(--badges-border-radius);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    box-shadow: var(--badges-shadow);
    transition: var(--badges-transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.badge-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--badges-shadow-lg);
}

.badge-card.earned {
    border-color: var(--badges-success);
    background: linear-gradient(135deg, rgba(67, 233, 123, 0.05) 0%, rgba(56, 249, 215, 0.05) 100%);
}

.badge-card.earned::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--badges-success) 0%, #38f9d7 100%);
}

.badge-card.in-progress {
    border-color: var(--badges-warning);
    background: linear-gradient(135deg, rgba(246, 211, 101, 0.05) 0%, rgba(253, 160, 133, 0.05) 100%);
}

.badge-card.locked {
    opacity: 0.6;
    background: #f8f9fa;
}

.badge-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.badge-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    position: relative;
    flex-shrink: 0;
}

.badge-icon.earned {
    background: linear-gradient(135deg, var(--badges-success) 0%, #38f9d7 100%);
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
}

.badge-icon.in-progress {
    background: linear-gradient(135deg, var(--badges-warning) 0%, #fda085 100%);
    box-shadow: 0 4px 15px rgba(246, 211, 101, 0.3);
}

.badge-icon.locked {
    background: #cbd5e0;
    box-shadow: none;
}

.badge-icon::after {
    content: "✓";
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--badges-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: var(--badges-transition);
}

.badge-icon.earned::after {
    opacity: 1;
    transform: scale(1);
}

.badge-info {
    flex: 1;
    min-width: 0;
}

.badge-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.badge-category {
    font-size: 0.8rem;
    color: var(--badges-primary);
    background: rgba(102, 126, 234, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    display: inline-block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-description {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.badge-requirement {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.requirement-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.requirement-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--badges-primary);
}

.badge-progress {
    margin-bottom: 1rem;
}

.progress-bar-badges {
    width: 100%;
    height: 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6b7280;
}

.badge-reward {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(246, 211, 101, 0.1);
    padding: 0.75rem;
    border-radius: 12px;
    color: #d97706;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: auto;
}

.earned-date {
    background: rgba(67, 233, 123, 0.1);
    padding: 0.75rem;
    border-radius: 12px;
    color: var(--badges-success);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
}

/* Filtres */
.filters-section {
    background: var(--badges-card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--badges-shadow);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.filters-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    background: white;
    color: #6b7280;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--badges-transition);
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--badges-primary);
    background: var(--badges-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.75rem;
}

/* Animations */
@keyframes badgeEarn {
    0% {
        transform: scale(0.8) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes progressFill {
    from {
        width: 0%;
    }
}

.badge-card.earned {
    animation: badgeEarn 0.6s ease-out;
}

.progress-fill-badges {
    animation: progressFill 1s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .badges-title {
        font-size: 2rem;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .badges-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .badge-card {
        padding: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .filters-grid {
        justify-content: center;
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .badges-hero {
        padding: 2rem 1.5rem;
    }
    
    .badges-title {
        font-size: 1.75rem;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
    }
    
    .badge-header {
        flex-direction: column;
        text-align: center;
    }
    
    .badge-icon {
        margin: 0 auto;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
