:root {
    --bg-color: #f4f7f6;
    --text-color: #333;
    --card-bg: white;
    --border-color: #ddd;
    --header-bg: #fff;
    --primary-color: #3498db;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --border-color: #333;
    --header-bg: #181818;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

.analytics-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    padding: 15px 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-title {
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
}

.charts-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.chart-card.full-width {
    width: 100%;
    flex: 1 1 100%;
}

.chart-card.half-width {
    width: calc(50% - 10px);
    flex: 1 1 calc(50% - 10px);
}

@media (max-width: 768px) {
    .chart-card.half-width {
        width: 100%;
        flex: 1 1 100%;
    }
}

.chart-title {
    font-size: 16px;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.insights-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
    line-height: 1.6;
}

.insight-point {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
}

.insight-point:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.insight-icon {
    font-size: 20px;
}

/* =============================================
   Subject-Wise Analytics Styles
   ============================================= */

.subject-analytics-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-top: 30px;
    margin-bottom: 30px;
}

.section-heading {
    font-size: 20px;
    color: var(--text-color);
    margin: 0 0 8px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.7;
    margin: 0 0 20px 0;
}

/* Filter Bar */
.subject-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.subject-filter-bar label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.subject-filter-select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 13px;
    cursor: pointer;
    min-width: 180px;
    transition: border-color 0.2s;
}

.subject-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* Subject Table */
.subject-table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.subject-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.subject-table thead th {
    background: var(--primary-color);
    color: white;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.subject-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    white-space: nowrap;
}

.subject-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.06);
}

.subject-table tbody tr:last-child td {
    border-bottom: none;
}

/* Subject color dot */
.subject-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

/* Value colors */
.val-correct {
    color: #27ae60;
    font-weight: 600;
}

.val-incorrect {
    color: #e74c3c;
    font-weight: 600;
}

.val-negative {
    color: #e74c3c;
    font-weight: 600;
}

/* Strength badges */
.strength-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.strength-strong {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.strength-moderate {
    background: rgba(52, 152, 219, 0.15);
    color: #2980b9;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.strength-weak {
    background: rgba(243, 156, 18, 0.15);
    color: #e67e22;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.strength-critical {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Dark mode tweaks for subject section */
[data-theme="dark"] .subject-table thead th {
    background: #2c3e50;
}

[data-theme="dark"] .subject-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.1);
}

[data-theme="dark"] .val-correct {
    color: #2ecc71;
}

[data-theme="dark"] .val-incorrect {
    color: #ff6b6b;
}

[data-theme="dark"] .val-negative {
    color: #ff6b6b;
}

/* Responsive */
@media (max-width: 768px) {
    .subject-analytics-section {
        padding: 15px;
    }

    .subject-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .subject-filter-select {
        width: 100%;
    }

    .subject-table {
        font-size: 12px;
    }

    .subject-table thead th,
    .subject-table tbody td {
        padding: 8px 10px;
    }
}