/* 📊 Real-Time Analytics Dashboard Styles */

/* Stats Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
    padding: 0;
}

/* Individual Stat Cards */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #10b981 100%);
    opacity: 0.7;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

/* Stat Card Icons */
.stat-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

/* Stat Content */
.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.stat-value.stat-updated {
    transform: scale(1.1);
    color: #10b981;
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    font-family: 'Noto Sans Arabic', sans-serif;
    direction: rtl;
}

.stat-subtitle {
    font-size: 12px;
    color: #94a3b8;
    font-family: 'Noto Sans Arabic', sans-serif;
    direction: rtl;
}

/* Progress Bars in Stats */
.stat-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(226, 232, 240, 0.8);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

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

.progress-text {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

/* Stat Trend Indicators */
.stat-trend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
}

.stat-trend.up {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-trend.stable {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

/* Specific Card Styling */
#daily-progress-card .stat-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

#streak-card .stat-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

#accuracy-card .stat-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

#level-card .stat-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

#session-card .stat-icon {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

#velocity-card .stat-icon {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

/* Notification System */
.analytics-notification {
    font-family: 'Noto Sans Arabic', sans-serif;
    direction: rtl;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.notification-message {
    flex: 1;
    font-weight: 600;
}

.notification-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: background 0.2s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Real-time Indicators */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

/* Analytics Update Animation */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

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

@keyframes stat-update {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Live Data Section */
.live-data-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    margin: 20px 0;
}

.live-data-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.live-data-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    font-family: 'Noto Sans Arabic', sans-serif;
    direction: rtl;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
    }
    
    .stat-card {
        padding: 20px;
        min-height: 100px;
    }
    
    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .stat-value {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
        min-height: 80px;
        gap: 12px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
        border-radius: 12px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 13px;
    }
    
    .analytics-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 12px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .progress-text {
        font-size: 10px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .stat-card {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(30, 41, 59, 0.85) 100%);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .stat-value {
        color: #f8fafc;
    }
    
    .stat-label {
        color: #cbd5e1;
    }
    
    .stat-subtitle {
        color: #94a3b8;
    }
    
    .live-data-section {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.1) 0%, rgba(30, 41, 59, 0.05) 100%);
        border-color: rgba(255, 255, 255, 0.05);
    }
    
    .live-data-title {
        color: #f8fafc;
    }
}