/* ========================================
   My Stats Page — إحصائياتي
   ======================================== */

/* Page Layout */
.mystats-page {
    padding-top: 90px;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.mystats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 36px;
    animation: fadeInUp 0.5s ease;
}

.mystats-header-text h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mystats-header-text p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.mystats-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== Section Blocks ========== */
.section-block {
    margin-bottom: 44px;
    animation: fadeInUp 0.5s ease both;
}

.section-block:nth-child(2) { animation-delay: 0.1s; }
.section-block:nth-child(3) { animation-delay: 0.2s; }
.section-block:nth-child(4) { animation-delay: 0.3s; }

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.section-title svg {
    color: var(--indigo-400);
    flex-shrink: 0;
}

.card-subtitle {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.card-subtitle svg {
    color: var(--indigo-400);
    flex-shrink: 0;
}

/* ========== Glass Card (local) ========== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

/* ========== Empty State ========== */
.empty-state-container {
    display: flex;
    justify-content: center;
    padding: 60px 0;
    animation: fadeInUp 0.6s ease;
}

.empty-state-card {
    text-align: center;
    max-width: 520px;
    padding: 60px 40px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.empty-state-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.empty-state-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 28px;
    line-height: 1.8;
}

.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* ===================================================
   Section 1: Overview
   =================================================== */

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

.overview-stat-card {
    padding: 24px 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.overview-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 20px 20px 0 0;
}

.overview-stat-card:hover::before { opacity: 1; }

.overview-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    transition: transform 0.3s ease;
}

.overview-stat-card:hover .overview-stat-icon { transform: scale(1.1); }

.overview-stat-icon svg {
    width: 24px;
    height: 24px;
}

.overview-stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.overview-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

/* Accuracy + Comparison Row */
.accuracy-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
}

.accuracy-card {
    padding: 28px;
    text-align: center;
}

.donut-wrapper {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

.donut-wrapper canvas {
    display: block;
}

.donut-center-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-pct {
    font-size: 2.2rem;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.donut-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Comparison Card */
.comparison-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.comparison-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.comparison-item { width: 100%; }

.comparison-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-value {
    font-feature-settings: 'tnum';
    font-weight: 700;
}

.comparison-track {
    width: 100%;
    height: 12px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.comparison-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.comparison-fill.you-fill {
    background: linear-gradient(90deg, #4F46E5, #818CF8);
}

.comparison-fill.avg-fill {
    background: linear-gradient(90deg, #64748b, #94a3b8);
}

.comparison-verdict {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.6;
}

.comparison-verdict.above {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.comparison-verdict.below {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.comparison-verdict.equal {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* ===================================================
   Section 2: Strengths & Weaknesses
   =================================================== */

.analysis-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.analysis-chart-card {
    padding: 28px;
}

.radar-chart-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-chart-wrapper canvas {
    max-width: 100%;
    height: auto !important;
}

.topics-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.topics-section { }

.topics-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topics-emoji {
    font-size: 1.3rem;
}

.strength-heading { color: #34d399; }
.weakness-heading { color: #f87171; }

.topics-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.topic-item:hover {
    border-color: var(--border-glow);
    transform: translateX(4px);
}

.topic-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.topic-rank.strength {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
}

.topic-rank.weakness {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.topic-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.92rem;
}

.topic-score {
    font-weight: 700;
    font-size: 0.95rem;
    font-feature-settings: 'tnum';
}

.topic-score.high { color: #10B981; }
.topic-score.mid { color: #F59E0B; }
.topic-score.low { color: #EF4444; }

/* Improvement Chart */
.improvement-card {
    padding: 28px;
}

.line-chart-wrapper {
    position: relative;
}

.line-chart-wrapper canvas {
    width: 100% !important;
    max-height: 300px;
}

/* ===================================================
   Section 3: Spaced Repetition
   =================================================== */

.sr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 50px;
    background: var(--danger);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.sr-overview-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.sr-info-card {
    padding: 28px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.sr-info-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.sr-info-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.sr-info-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.sr-stats-card {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    text-align: center;
}

.sr-stat { flex: 1; }

.sr-stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.sr-stat-value.sr-due {
    background: linear-gradient(135deg, #EF4444, #F59E0B);
    -webkit-background-clip: text;
    background-clip: text;
}

.sr-stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

.sr-stat-divider {
    width: 1px;
    height: 48px;
    background: var(--border-color);
    flex-shrink: 0;
}

.sr-action-row {
    text-align: center;
    margin-bottom: 12px;
}

.sr-start-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.sr-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
}

.sr-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sr-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

.sr-hint strong {
    color: var(--indigo-400);
    font-weight: 700;
}

/* ===== SR Modal ===== */
.sr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.sr-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease;
}

.sr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.sr-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sr-progress-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-feature-settings: 'tnum';
}

.sr-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sr-modal-progress {
    height: 4px;
    background: var(--bg-tertiary);
}

.sr-modal-progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    transition: width 0.4s ease;
    border-radius: 0 4px 4px 0;
}

.sr-modal-body {
    padding: 32px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Question in Modal */
.sr-question-text {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.8;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.sr-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.sr-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    background: var(--bg-glass-light);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.sr-option:hover {
    border-color: var(--indigo-400);
    background: rgba(99, 102, 241, 0.06);
}

.sr-option.selected {
    border-color: var(--indigo-500);
    background: rgba(99, 102, 241, 0.1);
}

.sr-option.correct {
    border-color: #10B981;
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.sr-option.wrong {
    border-color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.sr-option-letter {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sr-option.correct .sr-option-letter {
    background: rgba(16, 185, 129, 0.2);
}

.sr-option.wrong .sr-option-letter {
    background: rgba(239, 68, 68, 0.2);
}

.sr-feedback {
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

.sr-feedback.correct {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.sr-feedback.wrong {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.sr-next-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.sr-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* SR Complete */
.sr-complete {
    text-align: center;
    padding: 20px 0;
}

.sr-complete-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.sr-complete h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.sr-complete p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.sr-complete-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
}

.sr-complete-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sr-complete-stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===================================================
   Section 4: Score Prediction
   =================================================== */

.prediction-card {
    padding: 32px;
}

.prediction-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.prediction-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.prediction-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.prediction-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.prediction-score-row {
    display: flex;
    align-items: center;
    gap: 36px;
}

.prediction-score-circle {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.prediction-score-circle svg {
    transform: rotate(-90deg);
    width: 120px;
    height: 120px;
}

.pred-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.pred-ring-fill {
    fill: none;
    stroke: url(#predGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.prediction-score-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prediction-details {
    flex: 1;
}

.prediction-bar-section {
    margin-bottom: 20px;
}

.prediction-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.prediction-bar-track {
    width: 100%;
    height: 14px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.prediction-bar-fill {
    height: 100%;
    border-radius: 14px;
    background: linear-gradient(90deg, #4F46E5, #818CF8, #34d399);
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.prediction-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.pred-breakdown-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pred-breakdown-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.prediction-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===================================================
   Footer (shared from analytics.css pattern)
   =================================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 48px 0 0;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 32px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.8;
    margin-top: 12px;
}

.footer-links h4 {
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-links a {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 4px 0;
    transition: color 0.3s ease;
}

.footer-links a:hover { color: var(--indigo-400); }

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
}

.footer-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-heart span { color: #ef4444; }

/* ===================================================
   Responsive
   =================================================== */
@media (max-width: 1024px) {
    .analysis-row {
        grid-template-columns: 1fr;
    }

    .sr-overview-row {
        grid-template-columns: 1fr;
    }

    .accuracy-row {
        grid-template-columns: 1fr;
    }

    .prediction-score-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .prediction-breakdown {
        justify-content: center;
    }

    .prediction-note {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .mystats-page {
        padding-top: 80px;
    }

    .mystats-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mystats-header-text h1 {
        font-size: 1.6rem;
    }

    .overview-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .overview-stat-card {
        padding: 18px 14px;
    }

    .overview-stat-value {
        font-size: 1.5rem;
    }

    .accuracy-row {
        grid-template-columns: 1fr;
    }

    .analysis-row {
        grid-template-columns: 1fr;
    }

    .analysis-chart-card {
        padding: 20px 16px;
    }

    .topics-card {
        padding: 20px 16px;
    }

    .improvement-card {
        padding: 20px 16px;
    }

    .sr-info-card {
        flex-direction: column;
        padding: 20px;
    }

    .sr-stats-card {
        padding: 18px;
    }

    .sr-stat-value {
        font-size: 1.5rem;
    }

    .sr-modal {
        border-radius: 20px;
    }

    .sr-modal-body {
        padding: 24px 18px;
    }

    .prediction-card {
        padding: 20px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-bottom-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .overview-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .overview-stat-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .overview-stat-icon svg {
        width: 20px;
        height: 20px;
    }

    .overview-stat-value {
        font-size: 1.3rem;
    }

    .sr-stats-card {
        flex-direction: column;
        gap: 16px;
    }

    .sr-stat-divider {
        width: 60%;
        height: 1px;
    }

    .sr-start-btn {
        padding: 12px 28px;
        font-size: 1rem;
    }

    .sr-question-text {
        font-size: 1rem;
    }

    .prediction-score-circle {
        width: 100px;
        height: 100px;
    }

    .prediction-score-circle svg {
        width: 100px;
        height: 100px;
    }

    .prediction-score-text {
        font-size: 1.6rem;
    }
}
