/* ============================================
   Smart School - Ultramodern UI
   ============================================ */

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #06b6d4;
    --info-light: #cffafe;
    --light: #f8fafc;
    --dark: #0f172a;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: #6366f1;
    --header-bg: #ffffff;
    --body-bg: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #1e293b;
    --text-muted: #94a3b8;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--body-bg);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
::selection { background: var(--primary-100); color: var(--primary-dark); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================
   Layout
   ============================================ */
.wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar-thumb { background: #334155; }

.sidebar-header {
    background: transparent;
    color: var(--white);
    padding: 24px 24px 20px;
    font-size: 20px;
    font-weight: 800;
    text-align: left;
    letter-spacing: -0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header a {
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header a::before {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-user {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.15);
    object-fit: cover;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }

.sidebar-user .user-name {
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    color: var(--sidebar-text);
    font-size: 12px;
    font-weight: 400;
}

/* Sidebar Navigation */
.sidebar-nav {
    list-style: none;
    padding: 12px 12px;
}

.sidebar-nav .nav-header {
    padding: 20px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #475569;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-nav li a.active {
    background: var(--sidebar-active);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-nav li a i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 15px;
    opacity: 0.7;
}

.sidebar-nav li a.active i,
.sidebar-nav li a:hover i { opacity: 1; }

.sidebar-nav li a .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* Submenu */
.sidebar-nav .submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    padding: 0 0 0 20px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.sidebar-nav .has-submenu.open > .submenu {
    max-height: 2000px;
    padding: 4px 0 4px 20px;
    opacity: 1;
}

.sidebar-nav .submenu li a {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 400;
    color: #94a3b8;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
}

.sidebar-nav .submenu li a:hover,
.sidebar-nav .submenu li a.active {
    color: var(--white);
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary);
    box-shadow: none;
}

.sidebar-nav .has-submenu > a {
    cursor: pointer;
    user-select: none;
}

.sidebar-nav .has-submenu > a::after {
    content: '\f105';
    font-family: 'Font Awesome 5 Free', 'FontAwesome';
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 12px;
    opacity: 0.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.sidebar-nav .has-submenu.open > a::after { transform: rotate(90deg); opacity: 0.8; }

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 270px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Header */
.top-header {
    background: var(--header-bg);
    color: var(--text);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.9);
}

.top-header .toggle-btn,
.top-header .sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.top-header .toggle-btn:hover,
.top-header .sidebar-toggle:hover {
    background: var(--body-bg);
    color: var(--text);
}

.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-header .header-right a { color: var(--text-secondary); font-size: 14px; }
.top-header .header-right a:hover { color: var(--primary); }

.top-header .header-right span {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.top-header .header-right .user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 6px 12px;
    border-radius: 10px;
    transition: var(--transition);
}

.top-header .header-right .user-menu:hover { background: var(--body-bg); }

.top-header .header-right .user-menu img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
}

/* Content Wrapper */
.content-wrapper {
    padding: 28px;
    flex: 1;
    max-width: 100%;
}

/* Content Header / Breadcrumb */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 0;
    border-bottom: none;
}

.content-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.content-header h1 i {
    color: var(--primary);
    margin-right: 8px;
    font-size: 22px;
}

.breadcrumb {
    display: flex;
    list-style: none;
    font-size: 13px;
    gap: 5px;
    color: var(--text-muted);
}

.breadcrumb li + li::before {
    content: '/';
    color: var(--border);
    margin-right: 5px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--primary); font-size: 14px; }
.card-title { font-size: 18px; font-weight: 700; margin: 0; }

.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--light);
}

/* Stat Boxes — unified for bg-* and named classes */
.stat-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: visible;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

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

.stat-box.info::before, .stat-box.bg-info::before { background: var(--info); }
.stat-box.success::before, .stat-box.bg-success::before { background: var(--success); }
.stat-box.warning::before, .stat-box.bg-warning::before { background: var(--warning); }
.stat-box.danger::before, .stat-box.bg-danger::before { background: var(--danger); }
.stat-box.bg-primary::before { background: var(--primary); }

.stat-box .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--white);
    background: var(--gradient-primary);
    flex-shrink: 0;
}

.stat-box.info .stat-icon, .stat-box.bg-info .stat-icon { background: var(--gradient-info); }
.stat-box.success .stat-icon, .stat-box.bg-success .stat-icon { background: var(--gradient-success); }
.stat-box.warning .stat-icon, .stat-box.bg-warning .stat-icon { background: var(--gradient-warning); }
.stat-box.danger .stat-icon, .stat-box.bg-danger .stat-icon { background: var(--gradient-danger); }
.stat-box.bg-primary .stat-icon { background: var(--gradient-primary); }

/* Support both stat-content and stat-info */
.stat-box .stat-content,
.stat-box .stat-info { flex: 1; min-width: 0; }

.stat-box .stat-number {
    font-size: clamp(16px, 2vw, 26px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
    color: var(--dark);
    letter-spacing: -0.5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-box .stat-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress Bars */
.progress-bar-container {
    background: var(--border-light);
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--gradient-primary);
}

.progress-bar-fill.success { background: var(--gradient-success); }
.progress-bar-fill.danger { background: var(--gradient-danger); }
.progress-bar-fill.warning { background: var(--gradient-warning); }

/* Quick Access Grid */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.quick-access-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.quick-access-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.quick-access-item i {
    font-size: 24px;
    margin-bottom: 8px;
}

.quick-access-title {
    font-size: 13px;
    font-weight: 600;
}

.quick-access-sub {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* ============================================
   Grid
   ============================================ */
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col { flex: 1; padding: 0 12px; }
.col-1 { flex: 0 0 8.33%; max-width: 8.33%; padding: 0 12px; }
.col-2 { flex: 0 0 16.66%; max-width: 16.66%; padding: 0 12px; }
.col-3 { flex: 0 0 25%; max-width: 25%; padding: 0 12px; }
.col-4 { flex: 0 0 33.33%; max-width: 33.33%; padding: 0 12px; }
.col-5 { flex: 0 0 41.66%; max-width: 41.66%; padding: 0 12px; }
.col-6 { flex: 0 0 50%; max-width: 50%; padding: 0 12px; }
.col-7 { flex: 0 0 58.33%; max-width: 58.33%; padding: 0 12px; }
.col-8 { flex: 0 0 66.66%; max-width: 66.66%; padding: 0 12px; }
.col-9 { flex: 0 0 75%; max-width: 75%; padding: 0 12px; }
.col-10 { flex: 0 0 83.33%; max-width: 83.33%; padding: 0 12px; }
.col-11 { flex: 0 0 91.66%; max-width: 91.66%; padding: 0 12px; }
.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 12px; }

/* ============================================
   Tables
   ============================================ */
.table { width: 100%; border-collapse: collapse; margin-bottom: 0; }

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--primary-50); }
.table tbody tr:last-child td { border-bottom: none; }

.table-striped tbody tr:nth-child(even) { background: var(--light); }
.table-striped tbody tr:nth-child(even):hover { background: var(--primary-50); }
.table-bordered th, .table-bordered td { border: 1px solid var(--border); }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-sm th, .table-sm td { padding: 8px 12px; font-size: 13px; }

/* Global table scroll cue */
.auto-table-scroll {
    scrollbar-width: thin;
    scrollbar-color: #b8c2d8 #eef2f8;
}

.auto-table-scroll::-webkit-scrollbar {
    height: 8px;
}

.auto-table-scroll::-webkit-scrollbar-track {
    background: #eef2f8;
    border-radius: 10px;
}

.auto-table-scroll::-webkit-scrollbar-thumb {
    background: #b8c2d8;
    border-radius: 10px;
}

.auto-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a4c5;
}

/* ============================================
   Forms
   ============================================ */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-control::placeholder { color: #cbd5e1; }

select.form-control {
    .form-control-sm {
        padding: 6px 8px;
        font-size: 13px;
    }

    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 36px;
}

textarea.form-control { min-height: 100px; resize: vertical; }

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.invalid-feedback { color: var(--danger); font-size: 12px; margin-top: 6px; }

.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

.form-row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.form-row > .form-group { padding: 0 8px; box-sizing: border-box; }
.form-row > .col-md-4 { flex: 0 0 33.33%; max-width: 33.33%; padding: 0 8px; box-sizing: border-box; }
.form-row > .col-md-6 { flex: 0 0 50%; max-width: 50%; padding: 0 8px; box-sizing: border-box; }

@media (max-width: 768px) {
    .form-row > .col-md-4,
    .form-row > .col-md-6 { flex: 0 0 100%; max-width: 100%; }
}

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.5;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background: var(--gradient-primary); color: var(--white); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4); color: var(--white); }

.btn-success { background: var(--gradient-success); color: var(--white); }
.btn-success:hover { box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4); color: var(--white); }

.btn-danger { background: var(--gradient-danger); color: var(--white); }
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4); color: var(--white); }

.btn-warning { background: var(--gradient-warning); color: var(--white); }
.btn-warning:hover { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); color: var(--white); }

.btn-info { background: var(--gradient-info); color: var(--white); }
.btn-info:hover { box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4); color: var(--white); }

.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-secondary:hover { background: #475569; color: var(--white); }

.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: var(--white); }

.btn-light { background: var(--light); color: var(--text-secondary); border-color: var(--border); }
.btn-light:hover { background: var(--border); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

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

.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-light); color: #155e75; border-color: #a5f3fc; }

.alert .close-alert {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.4;
    line-height: 1;
    transition: var(--transition);
}

.alert .close-alert:hover { opacity: 0.8; }

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-100); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--info-light); color: #155e75; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-lg { padding: 6px 14px; font-size: 13px; }

.status-active { background: var(--success-light); color: #065f46; }
.status-inactive { background: var(--danger-light); color: #991b1b; }
.status-pending { background: var(--warning-light); color: #92400e; }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

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

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
}

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

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 { font-size: 18px; font-weight: 700; margin: 0; }

.modal-close {
    background: var(--light);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   Auth Pages (Login / Signup)
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--body-bg);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139,92,246,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-container {
    display: flex;
    width: 100%;
    max-width: 1000px;
    min-height: 600px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
    margin: 20px;
}

.auth-brand {
    flex: 0 0 420px;
    background: var(--gradient-dark);
    color: var(--white);
    padding: 60px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 50%;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50%;
}

.auth-brand .brand-content { position: relative; z-index: 1; }

.auth-brand .brand-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 32px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.auth-brand h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.auth-brand p {
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 0;
}

.auth-brand .brand-features {
    margin-top: 40px;
    list-style: none;
}

.auth-brand .brand-features li {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #cbd5e1;
}

.auth-brand .brand-features li i {
    color: var(--primary-light);
    width: 20px;
}

.auth-form {
    flex: 1;
    padding: 60px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-form .auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-form .form-group { margin-bottom: 20px; position: relative; }

.auth-form .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.auth-form .input-icon-wrapper {
    position: relative;
}

.auth-form .input-icon-wrapper .form-control {
    padding-left: 42px;
}

.auth-form .input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.auth-form .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
    border-radius: var(--radius-sm);
}

.auth-form .auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-form .auth-footer a { font-weight: 600; color: var(--primary); }
.auth-form .auth-footer a:hover { color: var(--primary-dark); }

.auth-form .auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    font-size: 13px;
}

.auth-form .auth-links a { color: var(--text-secondary); font-weight: 500; }
.auth-form .auth-links a:hover { color: var(--primary); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Legacy support for old login-box structure */
.login-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    padding: 48px;
    position: relative;
    z-index: 1;
}

.login-box .logo { text-align: center; margin-bottom: 32px; }
.login-box .logo img { max-height: 60px; }
.login-box .logo h2 { font-size: 22px; color: var(--dark); margin-top: 12px; font-weight: 700; }

.login-box h3 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 24px;
    text-align: center;
    font-weight: 700;
}

.login-box .form-group { position: relative; }

.login-box .form-group i.field-icon {
    position: absolute;
    right: 14px;
    top: 40px;
    color: var(--text-muted);
}

.login-box .btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }
.login-box .login-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.login-box .login-footer a { color: var(--primary); font-weight: 500; }

.login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--white);
}

/* ============================================
   Footer
   ============================================ */
.main-footer {
    background: var(--white);
    padding: 16px 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    width: 100%;
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-white { color: var(--white) !important; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mt-5 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.mr-1 { margin-right: 5px; }
.mr-2 { margin-right: 10px; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }

.gap-1 { gap: 5px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

.w-100 { width: 100%; }
.float-right { float: right; }
.clearfix::after { content: ''; display: table; clear: both; }

.rounded { border-radius: var(--radius-sm); }
.rounded-circle { border-radius: 50%; }
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; border-radius: 8px; }
.avatar-lg { width: 60px; height: 60px; border-radius: 14px; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.15;
    color: var(--primary);
}

.empty-state p { font-size: 15px; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    animation: fadeIn 0.15s ease;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
    justify-content: center;
    margin: 24px 0;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pagination .page-item .page-link:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary-light);
}

/* ============================================
   DataTables Override
   ============================================ */
.dataTables_wrapper { font-size: 13px; }
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
}

/* ============================================
   Sidebar Collapse (Desktop toggle)
   ============================================ */
.wrapper.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.wrapper.sidebar-collapsed .main-content { margin-left: 0; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .col-3 { flex: 0 0 50%; max-width: 50%; }
    .col-8 { flex: 0 0 60%; max-width: 60%; }
    .col-4 { flex: 0 0 40%; max-width: 40%; }
    .col-2 { flex: 0 0 33.33%; max-width: 33.33%; }
    .quick-access-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }

    .auth-container { max-width: 500px; }
    .auth-brand { display: none; }

    .stat-box .stat-number { font-size: 22px; }
    .stat-box .stat-icon { width: 44px; height: 44px; font-size: 18px; }
    .stat-box { padding: 18px; gap: 12px; }
}

@media (max-width: 1024px) {
    .sidebar.open {
        box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
    }
}

@media (max-width: 768px) {
    .row { flex-wrap: wrap; }
    .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .content-wrapper { padding: 16px; }
    .top-header { padding: 0 16px; height: 56px; }

    .stat-box { padding: 16px; gap: 14px; }
    .stat-box .stat-number { font-size: 22px; }
    .stat-box .stat-icon { width: 46px; height: 46px; font-size: 20px; }

    .table-responsive { display: block; width: 100%; overflow-x: auto; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .content-header { flex-direction: column; gap: 12px; align-items: flex-start; }

    .auth-container { margin: 12px; border-radius: var(--radius); }
    .auth-form { padding: 32px 24px; }
    .quick-access-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
    .login-box { padding: 32px 24px; margin: 12px; }
    .content-wrapper { padding: 12px; }
    .card-body { padding: 16px; }
    .card-header { padding: 14px 16px; }

    .stat-box { padding: 14px; gap: 10px; }
    .stat-box .stat-number { font-size: 18px; }
    .stat-box .stat-icon { width: 40px; height: 40px; font-size: 16px; }
    .stat-box .stat-label { font-size: 11px; }
    .quick-access-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   Print
   ============================================ */
@media print {
    .sidebar, .top-header, .main-footer, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
}

/* ============================================
   Animations
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse { animation: pulse 2s infinite; }

/* Loading spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notification */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-size: 14px;
    animation: slideInRight 0.3s ease;
    min-width: 300px;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
