/* ========================================
   Education Management System - Theme CSS
   ======================================== */

:root {
    --primary: #4361ee;
    --primary-dark: #3a0ca3;
    --primary-light: #4cc9f0;
    --secondary: #f72585;
    --accent: #7209b7;
    --success: #06d6a0;
    --warning: #ffd166;
    --danger: #ef476f;
    --info: #118ab2;
    --dark: #1a1a2e;
    --darker: #16213e;
    --card-bg: #ffffff;
    --body-bg: #f0f2f5;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--body-bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 270px;
    height: 100vh;
    background: linear-gradient(180deg, var(--dark) 0%, var(--darker) 100%);
    color: #fff;
    padding: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.sidebar-brand {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}

.sidebar-brand h3 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand small {
    display: block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-menu { padding: 8px 0; list-style: none; }

/* ===== Menu Group (accordion item) ===== */
.sidebar-menu .menu-group {
    list-style: none;
}

.sidebar-menu .menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: rgba(255,255,255,0.45);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    border-left: 3px solid transparent;
}

.sidebar-menu .menu-header:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.04);
    border-left-color: var(--accent);
}

.menu-group.open > .menu-header {
    color: var(--primary-light);
    background: rgba(255,255,255,0.06);
    border-left-color: var(--primary-light);
}

/* Chevron arrow */
.sidebar-menu .chevron {
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.3s ease, color 0.3s ease;
    display: inline-block;
    color: rgba(255,255,255,0.35);
    line-height: 1;
}

.menu-group.open > .menu-header .chevron {
    transform: rotate(90deg);
    color: var(--primary-light);
}

/* ===== Sub-menu (collapsible list) ===== */
.sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-group.open > .sub-menu {
    max-height: 800px;
}

/* ===== Sub-menu items ===== */
.sub-menu li {
    position: relative;
    list-style: none;
}

.sub-menu a {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 24px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 6px;
    margin: 2px 10px;
}

.sub-menu a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.sub-menu a.active {
    color: #fff;
    background: rgba(76,201,240,0.12);
    border-left: 3px solid var(--primary-light);
    margin-left: 7px;
}

.sub-menu a .icon {
    width: 22px;
    margin-right: 12px;
    text-align: center;
    font-size: 1rem;
}

/* Separator between menu groups */
.menu-group {
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 270px;
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== TOP NAVBAR ===== */
.top-navbar {
    background: var(--card-bg);
    padding: 12px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-navbar h5 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.top-navbar .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-navbar .user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.top-navbar .user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.top-navbar .user-role {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Logout Button */
.logout-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.logout-btn:hover {
    background: linear-gradient(135deg, var(--danger), #d63c5e);
    border-color: var(--danger);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 71, 111, 0.4);
}

.logout-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(239, 71, 111, 0.3);
}

.logout-btn svg {
    transition: transform 0.3s ease;
}

.logout-btn:hover svg {
    transform: translateX(2px);
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px 30px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 24px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: none;
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    font-weight: 700;
    font-size: 0.95rem;
}

.card-body {
    padding: 24px;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }
.stat-card.accent::before { background: var(--accent); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.stat-card.primary .stat-icon { background: rgba(67,97,238,0.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(6,214,160,0.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(255,209,102,0.15); color: #e6a800; }
.stat-card.danger .stat-icon { background: rgba(239,71,111,0.1); color: var(--danger); }
.stat-card.info .stat-icon { background: rgba(17,138,178,0.1); color: var(--info); }
.stat-card.accent .stat-icon { background: rgba(114,9,183,0.1); color: var(--accent); }

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    color: var(--dark);
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 20px;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(67,97,238,0.35); }

.btn-success { background: linear-gradient(135deg, var(--success), #05b889); color: #fff; }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(6,214,160,0.35); }

.btn-danger { background: linear-gradient(135deg, var(--danger), #d63c5e); color: #fff; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(239,71,111,0.35); }

.btn-warning { background: linear-gradient(135deg, var(--warning), #e6a800); color: var(--dark); }

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 14px; font-size: 0.78rem; }
.btn-lg { padding: 12px 32px; font-size: 1rem; }

/* ===== TABLES ===== */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--body-bg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border);
}

.table tbody td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover { background: rgba(67,97,238,0.03); }

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

/* ===== FORMS ===== */
.form-control, .form-select {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.85rem;
    transition: var(--transition);
    background: #fff;
    color: var(--text);
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
}

.form-group { margin-bottom: 16px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--primary-dark) 50%, var(--accent) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(76,201,240,0.15), transparent);
    top: -200px; right: -200px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(247,37,133,0.1), transparent);
    bottom: -100px; left: -100px;
    border-radius: 50%;
}

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    max-width: 95%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
}

.login-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    color: var(--dark);
}

.login-card .subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 32px;
}

.login-card .logo-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.8rem;
    color: #fff;
}

/* ===== BADGES ===== */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(6,214,160,0.15); color: #059669; }
.badge-warning { background: rgba(255,209,102,0.2); color: #b88600; }
.badge-danger { background: rgba(239,71,111,0.15); color: #dc2626; }
.badge-info { background: rgba(17,138,178,0.15); color: #0e7490; }
.badge-primary { background: rgba(67,97,238,0.15); color: var(--primary); }

/* ===== ALERTS ===== */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(6,214,160,0.1); color: #059669; border-left: 4px solid var(--success); }
.alert-danger { background: rgba(239,71,111,0.1); color: #dc2626; border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(255,209,102,0.15); color: #b88600; border-left: 4px solid var(--warning); }
.alert-info { background: rgba(17,138,178,0.1); color: #0e7490; border-left: 4px solid var(--info); }

/* ===== GRID ===== */
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 { padding: 0 12px; margin-bottom: 24px; }
.col-1 { width: 8.33%; } .col-2 { width: 16.67%; } .col-3 { width: 25%; }
.col-4 { width: 33.33%; } .col-5 { width: 41.67%; } .col-6 { width: 50%; }
.col-7 { width: 58.33%; } .col-8 { width: 66.67%; } .col-9 { width: 75%; }
.col-10 { width: 83.33%; } .col-11 { width: 91.67%; } .col-12 { width: 100%; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: translateY(-20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box h4 { font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; }

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.mr-1 { margin-right: 8px; } .ml-1 { margin-left: 8px; }
.p-2 { padding: 16px; } .p-3 { padding: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

.action-btn.edit { background: rgba(67,97,238,0.1); color: var(--primary); }
.action-btn.edit:hover { background: var(--primary); color: #fff; }
.action-btn.delete { background: rgba(239,71,111,0.1); color: var(--danger); }
.action-btn.delete:hover { background: var(--danger); color: #fff; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h4 { font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* ===== SIDEBAR TOGGLE ===== */
.sidebar-toggle {
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    width: 38px; height: 38px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: var(--transition);
}
.sidebar-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Collapsed sidebar state */
body.sidebar-collapsed .sidebar {
    width: 0;
    overflow: hidden;
    padding: 0;
}
body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .sidebar.open { width: 270px; }
    .main-content { margin-left: 0; }
    .row { flex-direction: column; }
    .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 { width: 100%; }
}