/* ========================================
   Analytics Page — تحليل نقاط الضعف
   ======================================== */

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

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

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

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

/* ========== 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;
}

/* ========== Glass Card ========== */
.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);
}

/* ========== Weakness/Strength Alerts ========== */
.alerts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
    animation: fadeInUp 0.5s ease 0.1s both;
}

.alert-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid;
    transition: all 0.3s ease;
    cursor: default;
}

.alert-card:hover {
    transform: translateY(-2px);
}

.alert-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.alert-card-content {
    flex: 1;
    min-width: 0;
}

.alert-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.alert-card-subject {
    font-size: 1.2rem;
    font-weight: 700;
}

.alert-card-score {
    font-size: 1.8rem;
    font-weight: 800;
    flex-shrink: 0;
    font-feature-settings: 'tnum';
}

/* Weakness (red-ish) */
.alert-weakness {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.alert-weakness .alert-card-label {
    color: #f87171;
}

.alert-weakness .alert-card-score {
    color: #ef4444;
}

[data-theme="light"] .alert-weakness {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Strength (green) */
.alert-strength {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
}

.alert-strength .alert-card-label {
    color: #34d399;
}

.alert-strength .alert-card-score {
    color: #6366F1;
}

[data-theme="light"] .alert-strength {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

/* ========== Overall Stats ========== */
.overall-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    animation: fadeInUp 0.5s ease 0.15s both;
}

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

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 20px 20px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-box:hover::before {
    opacity: 1;
}

.stat-box-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;
}

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

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

.green-bg {
    background: rgba(99, 102, 241, 0.12);
    color: var(--success);
}

.green-bg + .stat-box-value ~ .stat-box-label { }
.stat-box:nth-child(1)::before { background: var(--success); }

.blue-bg {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info);
}

.stat-box:nth-child(2)::before { background: var(--info); }

.purple-bg {
    background: rgba(139, 92, 246, 0.12);
    color: #8B5CF6;
}

.stat-box:nth-child(3)::before { background: #8B5CF6; }

.amber-bg {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.stat-box:nth-child(4)::before { background: var(--warning); }

.stat-box-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;
}

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

/* ========== Charts Row ========== */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
    margin-bottom: 36px;
    animation: fadeInUp 0.5s ease 0.2s both;
}

.chart-card {
    padding: 28px;
    position: relative;
}

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

.chart-card-title svg {
    color: var(--green-400);
    flex-shrink: 0;
}

/* Radar Chart */
.radar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

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

.radar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.radar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.radar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Timeline Chart */
.timeline-container {
    position: relative;
}

.timeline-container canvas {
    width: 100% !important;
    height: auto !important;
}

.timeline-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ========== Subject Cards ========== */
.section-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    animation: fadeInUp 0.5s ease 0.25s both;
}

.section-inline-title {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-inline-title svg {
    color: var(--green-400);
}

.section-inline-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
    animation: fadeInUp 0.5s ease 0.3s both;
}

.subject-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

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

.subject-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.subject-card:hover::before {
    opacity: 1;
}

.subject-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subject-card-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.subject-card-trend {
    font-size: 1.3rem;
    line-height: 1;
}

.trend-up { color: #6366F1; }
.trend-slight-up { color: #34d399; }
.trend-flat { color: var(--warning); }
.trend-slight-down { color: #fb923c; }
.trend-down { color: #ef4444; }

.subject-card-bar-wrap {
    width: 100%;
    position: relative;
}

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

.subject-card-bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 4px;
}

.subject-card-bar-fill.bar-high {
    background: linear-gradient(90deg, #6366F1, #34d399);
}

.subject-card-bar-fill.bar-medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.subject-card-bar-fill.bar-low {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.subject-card-score-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: left;
    direction: ltr;
    font-feature-settings: 'tnum';
}

.subject-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.subject-card-attempts {
    display: flex;
    align-items: center;
    gap: 4px;
}

.subject-card-action {
    color: var(--green-400);
    font-weight: 600;
    font-size: 0.82rem;
}

/* ========== Suggestions ========== */
.suggestions-section {
    margin-bottom: 40px;
    animation: fadeInUp 0.5s ease 0.35s both;
}

.suggestions-section .section-inline-title {
    margin-bottom: 20px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.suggestion-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.suggestion-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
}

.suggestion-text {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.suggestion-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.suggestion-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.suggestion-card:hover .suggestion-arrow {
    transform: translateX(-4px);
    color: var(--green-400);
}

/* ========== Footer ========== */
.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(--green-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) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .overall-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

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

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

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

    .stat-box {
        padding: 18px 14px;
    }

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

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

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .suggestions-grid {
        grid-template-columns: 1fr;
    }

    .alerts-section {
        grid-template-columns: 1fr;
    }

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

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

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

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

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

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

    .alert-card {
        padding: 16px 18px;
    }

    .alert-card-score {
        font-size: 1.4rem;
    }

    .empty-state-card {
        padding: 40px 24px;
    }

    .suggestion-card {
        padding: 16px 18px;
    }
}
