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

:root {
    --primary: #4e73df;
    --primary-dark: #224abe;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #5a5c69;
    --bg-body: #f3f4f6;
    --sidebar-width: 250px;
    --header-height: 70px;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --border-radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-body);
    color: var(--dark);
    font-size: 1rem;
    line-height: 1.5;
}

/* --- Layout --- */
.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header --- */
.header {
    height: var(--header-height);
    background-color: #fff;
    box-shadow: 0 .15rem 1.75rem 0 rgba(58,59,69,.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left .logo {
    height: 40px;
    width: auto;
}

.header-left h1 {
    font-size: 1.2rem;
    color: var(--primary);
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.05rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right span {
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 600;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 10%, var(--primary-dark) 100%);
    min-height: 100vh;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 900;
    overflow-y: auto;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar ul {
    list-style: none;
    padding: 1rem 0;
}

.sidebar li a {
    display: block;
    padding: 1rem 1.5rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.sidebar li a:hover, 
.sidebar li a.active {
    background-color: #2c3e50;
    border-left-color: #fff;
    padding-left: 1.8rem; /* Slight shift effect */
}

.menu-category {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    letter-spacing: 0.05em;
}

.menu-category hr {
    border: 0;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 0.5rem;
}

/* --- Main Content --- */
.main-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    padding: 2rem;
    flex: 1;
    transition: margin-left 0.3s ease;
}

/* --- Components --- */
.section, .card, .stat-card, .student-card, .teacher-card, .assignment-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e3e6f0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--dark);
    margin-bottom: 1.2rem;
}

h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--dark);
    font-size: 0.85rem;
}

.form-control, input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], select, textarea {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #6e707e;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    color: #6e707e;
    background-color: #fff;
    border-color: #bac8f3;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(78,115,223,.25);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label, .radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 0.35rem;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-primary { color: #fff; background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background-color: #2e59d9; border-color: #2653d4; }

.btn-secondary { color: #fff; background-color: var(--secondary); border-color: var(--secondary); }
.btn-secondary:hover { background-color: #717384; border-color: #6c6e7e; }

.btn-success { color: #fff; background-color: var(--success); border-color: var(--success); }
.btn-success:hover { background-color: #17a673; border-color: #169b6b; }

.btn-danger { color: #fff; background-color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background-color: #be2617; border-color: #b32415; }

.btn-info { color: #fff; background-color: var(--info); border-color: var(--info); }
.btn-warning { color: #fff; background-color: var(--warning); border-color: var(--warning); }

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Tables */
.data-table, table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
}

.data-table th, table th {
    background-color: #f8f9fc;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    padding: 1rem;
    border-bottom: 2px solid #e3e6f0;
    text-align: left;
}

.data-table td, table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #e3e6f0;
    color: #858796;
}

.data-table tr:hover td {
    background-color: #f8f9fc;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    border-radius: 0.35rem;
    font-weight: 600;
}

.alert.success { color: #0f6848; background-color: #d4edda; border-color: #c3e6cb; }
.alert.error { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    border-left: 0.25rem solid var(--primary);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }

.stat-label {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-card.success .stat-label { color: var(--success); }
.stat-card.warning .stat-label { color: var(--warning); }
.stat-card.danger .stat-label { color: var(--danger); }

.stat-number {
    color: var(--dark);
    font-weight: bold;
    font-size: 1.5rem;
}

/* Login Page */
.login-body {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.175);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header img.logo {
    height: 80px;
    margin-bottom: 1rem;
}

/* Mobile Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: none;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 2000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 899;
    backdrop-filter: blur(2px);
}

.mobile-sidebar-header {
    display: none;
    padding: 1rem;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-sidebar-header h3 {
    color: #fff;
    margin-bottom: 0;
}

.mobile-menu-close {
    color: #fff;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        left: -100%;
        width: 280px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu-overlay.active {
        display: block;
    }
    
    .mobile-sidebar-header {
        display: flex;
    }
    
    .header {
        padding: 0 1rem;
    }
    
    .header-left h1 {
        font-size: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }

    .sidebar li a {
        color: #ffffff;
    }
}

/* CLEAN MATRIX STYLES */
.assignment-matrix-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
}

.matrix-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.matrix-row {
    display: table-row;
    border-bottom: 1px solid #ecf0f1;
}

.matrix-row:last-child {
    border-bottom: none;
}

.matrix-row:hover {
    background: #f8f9fa;
}

.matrix-cell {
    display: table-cell;
    padding: 12px 8px;
    vertical-align: middle;
    border-right: 1px solid #ecf0f1;
}

.matrix-cell:last-child {
    border-right: none;
}

.matrix-header {
    background: var(--primary);
    color: white;
    font-weight: bold;
}

.matrix-header .matrix-cell {
    border-right: 1px solid #7d868f;
    text-align: center;
}

.subject-header {
    background: var(--dark);
    font-size: 14px;
    padding: 15px 12px;
}

.class-header {
    font-size: 12px;
    text-align: center;
    min-width: 100px;
}

.subject-name {
    font-weight: 600;
    color: var(--dark);
    background: #f8f9fa;
    min-width: 180px;
    font-size: 14px;
    padding: 12px 15px;
}

.class-checkbox {
    text-align: center;
    min-width: 80px;
}

.class-checkbox input[type="checkbox"] {
    transform: scale(1.2);
    accent-color: #27ae60;
    cursor: pointer;
}

/* Bulk actions for cleaner layout */
.bulk-class-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bulk-action-btn {
    flex: 1;
    min-width: 150px;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-align: center;
}

.bulk-action-btn.select-all {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.bulk-action-btn.select-all:hover {
    background: #c3e6cb;
}

.bulk-action-btn.clear-all {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.bulk-action-btn.clear-all:hover {
    background: #f5c6cb;
}

.bulk-action-btn.select-subject {
    background: #d1ecf1;
    color: #0c5460;
    border: 2px solid #17a2b8;
}

.bulk-action-btn.select-subject:hover {
    background: #bee5eb;
}

/* TEACHER SELECTION AND SUBJECT FILTER - COMPACT SIDE BY SIDE */
.teacher-filter-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.teacher-selection {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.subject-filter {
    background: #e8f5e8;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.teacher-select-form,
.subject-filter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.teacher-select-group,
.subject-filter-group {
    flex: 1;
}

.teacher-select-group label,
.subject-filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.teacher-select-group select,
.subject-filter-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.subject-filter-group label {
    color: #155724;
}

.subject-filter-group select {
    border: 1px solid #28a745;
}

.filter-info {
    font-size: 0.8rem;
    color: #155724;
    margin-top: 0.5rem;
    font-style: italic;
}

.filter-info a {
    color: #dc3545;
    text-decoration: none;
    margin-left: 5px;
}

.filter-info a:hover {
    text-decoration: underline;
}

/* Responsive design for teacher filter container */
@media (max-width: 768px) {
    .teacher-filter-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .assignment-matrix-container {
        font-size: 12px;
    }
    
    .matrix-cell {
        padding: 8px 4px;
    }
    
    .subject-name {
        min-width: 120px;
        font-size: 12px;
    }
    
    .class-header {
        min-width: 70px;
        font-size: 10px;
    }
    
    .bulk-class-actions {
        flex-direction: column;
    }
    
    .bulk-action-btn {
        min-width: 100%;
    }
}

.sidebar ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar li:not(.menu-category) {
    margin: 0;
}

/* Utilities */
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }