/* ===== SIDEBAR DE ESTATÍSTICAS MODERNO ===== */
.user-stats-sidebar {
    position: fixed;
    top: 80px;
    right: -350px;
    width: 350px;
    height: calc(100vh - 80px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1050;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    border-radius: 20px 0 0 20px;
    backdrop-filter: blur(20px);
}

.user-stats-sidebar.open {
    right: 0;
}

.stats-toggle-btn {
    position: absolute;
    left: -60px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px 0 0 20px;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    z-index: 1051;
    animation: gentle-pulse 3s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% {
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15), 0 0 15px rgba(102, 126, 234, 0.3);
        transform: translateY(-50%) scale(1);
    }
    50% {
        box-shadow: -8px 0 25px rgba(0, 0, 0, 0.2), 0 0 20px rgba(102, 126, 234, 0.5);
        transform: translateY(-50%) scale(1.02);
    }
}

.stats-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-toggle-btn:hover::before {
    opacity: 1;
}

.stats-toggle-btn:hover {
    transform: translateY(-50%) translateX(-8px) scale(1.05);
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.25);
}

.stats-toggle-btn i {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
    position: relative;
}

.user-stats-sidebar.open .stats-toggle-btn i {
    transform: rotate(180deg);
}

.stats-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    position: relative;
}

.stats-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.stats-header h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.3rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.stats-content {
    padding: 2rem 1.5rem;
}

.materia-filter {
    margin-bottom: 2rem;
}

.materia-filter label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: block;
}

.materia-filter select {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.materia-filter select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.2);
}

.materia-filter select option {
    background: #2c3e50;
    color: white;
    padding: 0.5rem;
}

.stats-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-item:hover::before {
    opacity: 1;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.95;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.stat-item.large {
    grid-column: 1 / -1;
}

.stat-item.small {
    padding: 1.25rem 0.75rem;
}

.stat-item.small .stat-number {
    font-size: 1.8rem;
}

.progress-container {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.progress-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.progress-container .stat-label {
    font-size: 1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.progress {
    height: 28px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin: 1rem 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.progress-bar {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.3) 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-subtext {
    font-size: 0.85rem;
    margin-top: 1rem;
    opacity: 0.9;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.stats-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    margin: 2rem 0;
    border-radius: 1px;
}

.loading-stats {
    text-align: center;
    padding: 3rem 2rem;
    opacity: 0.8;
}

.loading-stats .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 3px;
}

.loading-stats p {
    margin-top: 1rem;
    font-weight: 500;
}

.total-questions-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.total-questions-info .small-stat {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.total-questions-info .big-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Responsividade */
@media (max-width: 768px) {
    .user-stats-sidebar {
        width: 320px;
        right: -320px;
    }
    
    .stats-toggle-btn {
        left: -50px;
        width: 50px;
        height: 70px;
        font-size: 1.2rem;
    }
    
    .stats-content {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .user-stats-sidebar {
        width: 100vw;
        right: -100vw;
        border-radius: 0;
    }
    
    .stats-toggle-btn {
        left: -55px;
        border-radius: 15px 0 0 15px;
    }
    
    .stats-header {
        padding: 1.5rem 1rem;
    }
    
    .stats-content {
        padding: 1.5rem 1rem;
    }
}