:root {
    --bg-color: #f8fafc;
    --sidebar-bg: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

.app-container {
    display: flex;
    width: 100%;
}

/* ─── Sidebar ─── */
.sidebar {
    width: 260px;
    min-width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding-top: 1rem;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed {
    margin-left: -260px;
}

.sidebar-header {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.logo-box {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.logo-text h2 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.logo-text p { font-size: 0.75rem; color: var(--text-secondary); margin: 0; }

.sidebar-label {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
    gap: 0.25rem;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.nav-btn i { font-size: 1.1rem; }
.nav-btn:hover { background-color: #f1f5f9; color: var(--text-primary); }
.nav-btn.active { background-color: #eef2ff; color: var(--primary-color); font-weight: 600; }

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    min-width: 0;
}

.top-header {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.content-wrapper {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background-color: var(--bg-color);
}

/* ─── Views ─── */
.view-section {
    display: none;
    animation: fadeIn 0.2s ease-in;
}

.view-section.active { display: block; }

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

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.dash-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.dash-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(79,70,229,0.1);
    transform: translateY(-2px);
}

.dash-card i { font-size: 1.5rem; margin-bottom: 1rem; display: inline-block; }
.text-purple { color: var(--primary-color); }
.dash-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.dash-card p { font-size: 0.875rem; color: var(--text-secondary); }

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

/* ─── Form Rows ─── */
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-btn-group {
    flex: 0 0 auto;
    min-width: auto;
}

input, select, textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background-color: #f8fafc;
    font-family: inherit;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

/* ─── Buttons ─── */
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.primary-btn:hover { background-color: var(--primary-hover); }

/* ─── Results ─── */
.hidden { display: none !important; }

.result-box {
    margin-top: 1.25rem;
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.result-success { background-color: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.result-error { background-color: var(--error-bg); color: var(--error-text); border: 1px solid #fecaca; }

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

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ─── Tables ─── */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid #f1f5f9;
}

/* ─── Badges & Tags ─── */
.badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-green { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #fed7aa; color: #9a3412; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #eef2ff; color: var(--primary-color); }

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin: 2px 2px;
    font-weight: 500;
}

/* ─── Search & Sort Badges ─── */
.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.num-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 36px;
}

.num-badge-plain { background: #f1f5f9; color: var(--text-primary); }
.num-badge-sorted { background: var(--primary-color); color: white; }

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ─── Enrolled List ─── */
.enrolled-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.enrolled-info h4 { font-size: 0.95rem; font-weight: 600; }
.enrolled-info p { font-size: 0.8rem; color: var(--primary-color); margin-top: 2px; }

.enrolled-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 4px;
    transition: color 0.2s;
}

.enrolled-delete:hover { color: #ef4444; }

/* ─── Chart ─── */
.chart-wrapper {
    position: relative;
    width: 100%;
    max-height: 350px;
}

/* ─── Marks Badge (green pill) ─── */
.marks-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
}
