@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700&display=swap');

/* ═══════════════════════════════════════════════════════
   DASHBOARD PAGE — BFA Ground Class
   Desktop ≥ 1024px : 2-col main grid, 4-col stats
   Tablet  640–1023px: 1-col main grid, 2-col stats
   Mobile  < 640px   : full-width, 2-col stats, stacked
═══════════════════════════════════════════════════════ */

body {
    font-family: 'Outfit', sans-serif;
    background: #f0f4ff;
    color: #0f172a;
    margin: 0; padding: 0;
}

/* Layout shell — keeps dashboard working
   even if sidebar.css loads after this file */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.dashboard-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    background: #f0f4ff;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

/* ════════════════════════════════════════
   HERO BAND
════════════════════════════════════════ */
.dash-hero {
    position: relative;
    background: linear-gradient(130deg, #1e3a8a 0%, #2563eb 50%, #4f46e5 100%);
    padding: 32px 40px 28px;
    overflow: hidden;
    color: #fff;
}

.dash-hero::before {
    content: '';
    position: absolute;
    width: 360px; height: 360px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.07);
    top: -120px; right: -80px; pointer-events: none;
}
.dash-hero::after {
    content: '';
    position: absolute;
    width: 220px; height: 220px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.05);
    bottom: -80px; right: 140px; pointer-events: none;
}

.dash-hero-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
}

.dash-hero-eyebrow {
    font-size: 11px; letter-spacing: 0.16em;
    text-transform: uppercase; color: #93c5fd;
    font-weight: 600; margin-bottom: 6px;
}

.dash-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 30px; color: #fff;
    line-height: 1.1; margin: 0 0 6px;
}

.dash-hero-sub {
    font-size: 14px; color: #bfdbfe;
    font-weight: 400; margin: 0;
}

.dash-hero-actions {
    display: flex; gap: 10px;
    flex-wrap: wrap; flex-shrink: 0;
}

.dash-hero-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 18px; border-radius: 9px;
    font-size: 13px; font-weight: 600;
    text-decoration: none; transition: all 0.15s;
    white-space: nowrap; font-family: 'Outfit', sans-serif;
    border: none; cursor: pointer;
}

.dash-hero-btn.primary { background: #fff; color: #2563eb; }
.dash-hero-btn.primary:hover {
    background: #e0f2fe; transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dash-hero-btn.outline {
    background: rgba(255,255,255,0.12); color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}
.dash-hero-btn.outline:hover {
    background: rgba(255,255,255,0.2); transform: translateY(-1px);
}

/* ════════════════════════════════════════
   PAGE BODY
════════════════════════════════════════ */
.dash-body {
    padding: 28px 40px 48px;
    display: flex; flex-direction: column; gap: 24px;
}

/* ════════════════════════════════════════
   STAT CARDS — 4 col desktop
════════════════════════════════════════ */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.analytics-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 22px 18px;
    position: relative; overflow: hidden;
    transition: transform 0.22s cubic-bezier(.22,.68,0,1.3), box-shadow 0.22s;
    animation: dashFadeUp 0.45s ease both;
}

.analytics-card:nth-child(1) { animation-delay: 0.05s; }
.analytics-card:nth-child(2) { animation-delay: 0.10s; }
.analytics-card:nth-child(3) { animation-delay: 0.15s; }
.analytics-card:nth-child(4) { animation-delay: 0.20s; }

@media (hover: hover) {
    .analytics-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 28px rgba(79,95,224,0.11);
    }
}

.analytics-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    border-radius: 14px 14px 0 0;
}

.analytics-card.ac-blue::before  { background: linear-gradient(90deg,#4f5fe0,#818cf8); }
.analytics-card.ac-green::before { background: linear-gradient(90deg,#10b981,#34d399); }
.analytics-card.ac-amber::before { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.analytics-card.ac-rose::before  { background: linear-gradient(90deg,#f43f5e,#fb7185); }

.analytics-card-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 14px;
}

.ac-blue  .analytics-card-icon { background: #eef2ff; }
.ac-green .analytics-card-icon { background: #d1fae5; }
.ac-amber .analytics-card-icon { background: #fef3c7; }
.ac-rose  .analytics-card-icon { background: #fff1f2; }

.analytics-number {
    font-size: 30px; font-weight: 800; color: #0f172a;
    line-height: 1; margin-bottom: 5px;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}

.analytics-label {
    font-size: 12px; color: #94a3b8;
    font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
}

/* ════════════════════════════════════════
   MAIN GRID
════════════════════════════════════════ */
.dash-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 20px; align-items: start;
}

.dash-left  { display: flex; flex-direction: column; gap: 20px; }
.dash-right { display: flex; flex-direction: column; gap: 20px; }

/* ════════════════════════════════════════
   CHART CARD
════════════════════════════════════════ */
.chart-box {
    background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 14px; padding: 24px 26px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    animation: dashFadeUp 0.5s 0.1s ease both;
    overflow: hidden;
}

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

.chart-title    { font-size: 15px; font-weight: 700; color: #0f172a; }
.chart-subtitle { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.chart-badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 99px;
    background: #eef2ff; color: #4f5fe0;
    white-space: nowrap; flex-shrink: 0;
}

canvas { max-width: 100%; display: block; }

/* Chart canvas heights — desktop default */
#scoreChart, #subjectChart {
    height: 200px !important;
    width: 100% !important;
}

/* ════════════════════════════════════════
   EXAM HISTORY
════════════════════════════════════════ */
.exam-list {
    background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 14px; padding: 22px 24px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    animation: dashFadeUp 0.5s 0.15s ease both;
    display: flex; flex-direction: column;
}

.exam-list-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}

.exam-title { font-size: 15px; font-weight: 700; color: #0f172a; }

.exam-count-badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 99px;
    background: #f1f5f9; color: #64748b;
}

.exam-history {
    max-height: 460px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent;
    margin: 0 -24px; padding: 0 0 16px;
}

.exam-history::-webkit-scrollbar       { width: 4px; }
.exam-history::-webkit-scrollbar-track { background: transparent; }
.exam-history::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.exam-item {
    display: block; padding: 14px 24px;
    border-bottom: 1px solid #f8fafc;
    text-decoration: none; color: inherit;
    transition: background 0.15s;
}

.exam-item:last-child { border-bottom: none; }

@media (hover: hover) { .exam-item:hover { background: #f8fafc; } }

.exam-item-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 5px; gap: 8px;
}

.exam-subject {
    font-size: 14px; font-weight: 600;
    color: #0f172a; text-transform: capitalize;
    display: flex; align-items: center; gap: 7px; min-width: 0;
}

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

.exam-score {
    font-size: 14px; font-weight: 700;
    padding: 2px 9px; border-radius: 99px; flex-shrink: 0;
}

.score-pass { background: #d1fae5; color: #065f46; }
.score-mid  { background: #fef3c7; color: #92400e; }
.score-fail { background: #fff1f2; color: #9f1239; }

.exam-meta {
    font-size: 12px; color: #94a3b8;
    margin-bottom: 8px;
    display: flex; gap: 12px; flex-wrap: wrap;
}

.exam-meta span { display: flex; align-items: center; gap: 4px; }

.performance-bar {
    height: 4px; background: #f1f5f9;
    border-radius: 99px; overflow: hidden;
}

.performance-fill {
    height: 100%; border-radius: 99px;
    transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

.performance-fill.pf-pass { background: linear-gradient(90deg,#10b981,#34d399); }
.performance-fill.pf-mid  { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.performance-fill.pf-fail { background: linear-gradient(90deg,#f43f5e,#fb7185); }

.exam-empty {
    padding: 40px 24px; text-align: center;
    color: #94a3b8; font-size: 14px;
}
.exam-empty-icon { font-size: 36px; margin-bottom: 12px; display: block; }

/* ════════════════════════════════════════
   ANIMATION
════════════════════════════════════════ */
@keyframes dashFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════
   TABLET  640px – 1023px
════════════════════════════════════════ */
@media (max-width: 1023px) {
    .dashboard-content { margin-left: 210px; }
    .dash-hero    { margin-top: 58px; padding: 24px 24px 22px; }
    .dash-hero h1 { font-size: 26px; }
    .dash-body    { padding: 20px 24px 36px; gap: 18px; }

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

    .dash-main-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-box    { padding: 20px 20px 16px; }
    .exam-list    { padding: 18px 20px 0; }
    .exam-history { margin: 0 -20px; }
    .exam-item    { padding: 12px 20px; }

    #scoreChart, #subjectChart { height: 180px !important; }
}

/* ════════════════════════════════════════
   MOBILE  < 640px
════════════════════════════════════════ */
@media (max-width: 639px) {
    /* Full-width layout — sidebar hidden, topbar is 58px */
    .dashboard-content {
        margin-left: 0 !important;
        padding-top: 0 !important; /* topbar offset already handled by sidebar.css */
    }

    .dash-hero { padding: 18px 16px 16px; }

    .dash-hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .dash-hero h1   { font-size: 20px; }
    .dash-hero-sub  { font-size: 13px; }

    /* Full-width stacked CTA buttons */
    .dash-hero-actions { width: 100%; }
    .dash-hero-btn {
        flex: 1; justify-content: center;
        padding: 11px 12px; font-size: 13px;
    }

    .dash-body { padding: 12px 12px 40px; gap: 12px; }

    /* 2-col compact stat cards */
    .analytics-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .analytics-card {
        padding: 14px 14px 12px;
        border-radius: 12px;
    }

    .analytics-card-icon {
        width: 30px; height: 30px;
        font-size: 14px; margin-bottom: 10px; border-radius: 8px;
    }

    .analytics-number { font-size: 22px; margin-bottom: 3px; }
    .analytics-label  { font-size: 10px; }

    /* Single col main grid */
    .dash-main-grid { grid-template-columns: 1fr; gap: 12px; }

    /* Shorter charts */
    .chart-box {
        padding: 16px 14px 12px; border-radius: 12px;
    }

    .chart-header { margin-bottom: 12px; }
    .chart-title  { font-size: 14px; }
    .chart-badge  { display: none; }

    /* Cap chart height on mobile */
    #scoreChart   { max-height: 160px !important; }
    #subjectChart { max-height: 160px !important; }

    /* Exam list */
    .exam-list {
        padding: 14px 14px 0; border-radius: 12px;
    }

    /* Scrollable exam list on mobile — reasonable cap */
    .exam-history {
        max-height: 360px;
        overflow-y: auto;
        margin: 0 -14px;
    }

    .exam-item    { padding: 11px 14px; }
    .exam-subject { font-size: 13px; }
    .exam-score   { font-size: 13px; }

    .exam-meta {
        font-size: 11px; gap: 8px; margin-bottom: 6px;
    }

    .exam-list-header { margin-bottom: 12px; }
    .exam-title       { font-size: 14px; }
}

/* Small phones < 380px */
@media (max-width: 379px) {
    .analytics-number { font-size: 19px; }
    .dash-hero h1     { font-size: 18px; }
    .dash-hero-btn    { font-size: 12px; padding: 10px 8px; }
    .analytics-label  { font-size: 9px; letter-spacing: 0.02em; }
}