/* ================================
   UNIFIED PROGRESS & STREAK WIDGET
   ================================ */

.unified-progress-widget {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 28px;
    margin: 30px 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.unified-progress-widget:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Header Section */
.unified-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h4 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-level {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
    }
}

.streak-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    padding: 10px 16px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.streak-flame {
    font-size: 1.3rem;
    animation: flicker 1.5s infinite;
}

@keyframes flicker {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.2);
    }
}

.streak-indicator .streak-current {
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
}

.streak-label-mini {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* Stats Grid */
.unified-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.unified-stat-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.unified-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

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

.unified-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.streak-card::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.stat-icon-circle {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.streak-card .stat-icon-circle {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.stat-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress Section */
.unified-progress-section {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: block !important;
    visibility: visible !important;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.progress-text {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.progress-bar-container {
    background: #f1f5f9;
    height: 14px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb, #1d4ed8);
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
    position: relative;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

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

/* Badges Section */
.unified-badges {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    display: block !important;
    visibility: visible !important;
}

.unified-badges h5 {
    margin: 0 0 16px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    display: flex !important;
    align-items: center;
    gap: 8px;
    visibility: visible !important;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.badge:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.badge-icon {
    font-size: 2rem;
    filter: grayscale(100%);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.badge-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.badge.unlocked {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fbbf24;
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3);
}

.badge.unlocked .badge-icon {
    filter: grayscale(0%);
    opacity: 1;
    animation: bounce 0.6s ease;
}

.badge.unlocked .badge-name {
    color: #92400e;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.badge.unlocked::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    background: #10b981;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Dark Mode */
body.dark-mode .unified-progress-widget {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

body.dark-mode .unified-header {
    border-bottom-color: #334155;
}

body.dark-mode .header-left h4 {
    color: #f1f5f9;
}

body.dark-mode .unified-stat-card,
body.dark-mode .unified-progress-section,
body.dark-mode .unified-badges {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .stat-value,
body.dark-mode .progress-label {
    color: #f1f5f9;
}

body.dark-mode .stat-label,
body.dark-mode .progress-text {
    color: #94a3b8;
}

body.dark-mode .progress-bar-container {
    background: #1e293b;
}

body.dark-mode .badge {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .badge-name {
    color: #64748b;
}

body.dark-mode .badge.unlocked .badge-name {
    color: #fbbf24;
}

/* Responsive */
@media (max-width: 1024px) {
    .unified-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .unified-progress-widget {
        padding: 20px;
    }
    
    .unified-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .unified-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .streak-indicator {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .unified-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
