:root {
    --correct-color: #10b981; /* Modern Emerald */
    --wrong-color: #ef4444; /* Modern Rose */
    --skipped-color: #64748b;
    --accent-color: #f59e0b; /* Amber */
    --gov-navy: #0f172a; /* Slate 900 */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
}

.analysis-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.95));
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.analysis-modal.open {
    display: flex;
    opacity: 1;
    justify-content: center;
    align-items: center;
}

.analysis-content {
    background: var(--glass-bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(245, 158, 11, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    backdrop-filter: blur(25px);
    color: #1e293b;
    width: 95%;
    max-width: 1200px;
    height: 92vh;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 70px -12px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(60px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.analysis-header {
    padding: 20px 30px;
    background: rgba(15, 23, 42, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analysis-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--gov-navy), #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-analysis {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #64748b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.close-analysis:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg);
}

.analysis-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* Advanced Power BI KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.kpi-card {
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s;
}

.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }

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

.kpi-label { font-size: 0.75rem; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-trend { font-size: 0.7rem; font-weight: 800; color: #059669; background: #ecfdf5; padding: 2px 6px; border-radius: 4px; }

.kpi-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.kpi-val { font-size: 1.8rem; font-weight: 900; color: var(--gov-navy); }

.kpi-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 30px;
}

.spark-bar {
    width: 6px;
    background: var(--accent-color);
    border-radius: 2px;
    opacity: 0.8;
}

/* Advanced Charts Grid */
.charts-grid-advanced {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-box {
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    height: 340px;
}

.chart-box h3 {
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--gov-navy);
    text-transform: uppercase;
}

.chart-canvas-wrapper {
    position: relative;
    height: 250px;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -15%);
    text-align: center;
    pointer-events: none;
}

.donut-center span { display: block; font-size: 1.8rem; font-weight: 900; color: var(--gov-navy); }
.donut-center small { font-size: 0.6rem; font-weight: 800; color: #94a3b8; text-transform: uppercase; }

.gauge-audit {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 100%;
}

.audit-label { font-size: 0.65rem; font-weight: 800; color: #94a3b8; text-transform: uppercase; }
.audit-val { font-size: 0.9rem; font-weight: 900; color: var(--gov-navy); margin-left: 5px; }

@media (max-width: 1024px) {
    .charts-grid-advanced { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
}

/* Power BI Style Subject Matrix */
.subject-matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
}

.matrix-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.matrix-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.05);
}

.matrix-card .m-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--gov-navy);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.m-progress-bg {
    height: 8px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.m-progress-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.m-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
}

.m-accuracy { color: #059669; }
.m-time { color: #64748b; }

/* Question Navigation Strip */
.q-nav-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 5px;
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
    margin-bottom: 15px;
    scrollbar-width: none;
}

.q-nav-strip::-webkit-scrollbar { display: none; }

.q-bubble {
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.q-bubble:hover { transform: translateY(-2px); border-color: var(--gov-navy); }
.q-bubble.correct { background: #ecfdf5; border-color: #10b981; color: #059669; }
.q-bubble.wrong { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.q-bubble.skipped { background: #f8fafc; border-color: #94a3b8; color: #64748b; }

/* Refined Question Cards */
.q-review-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.q-review-card .q-topic-tag {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #475569;
    text-transform: uppercase;
}

.q-text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 25px;
    padding-right: 100px;
}

.ans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.ans-item {
    padding: 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ans-item .ans-meta { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; opacity: 0.6; }
.ans-item .ans-content { font-weight: 700; font-size: 1rem; color: #1e293b; }

.ans-item.correct-sol { background: #ecfdf5; border-color: #10b981; }
.ans-item.correct-sol .ans-meta { color: #059669; }

.ans-item.user-wrong { background: #fef2f2; border-color: #ef4444; }
.ans-item.user-wrong .ans-meta { color: #dc2626; }

/* Professional Tabbed Review */
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.review-tabs-container {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
}

.rev-tab-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.rev-tab-btn:hover { color: var(--gov-navy); }
.rev-tab-btn.active { background: white; color: var(--gov-navy); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

.review-tab-content { display: none; }
.review-tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Entry Animations */
.matrix-card { animation: matrixEntry 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.matrix-card:nth-child(1) { animation-delay: 0.1s; }
.matrix-card:nth-child(2) { animation-delay: 0.2s; }
.matrix-card:nth-child(3) { animation-delay: 0.3s; }
.matrix-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes matrixEntry {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Question Nav Polish */
.q-nav-strip {
    border: 1px solid rgba(0,0,0,0.05);
}

.q-bubble.active {
    border-color: var(--gov-navy);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

/* Mobile Polish */
@media (max-width: 768px) {
    .review-header { flex-direction: column; align-items: flex-start; }
    .review-tabs-container { width: 100%; overflow-x: auto; }
    .rev-tab-btn { flex: 1; white-space: nowrap; }
}
