/* EduERP - Classic Modern Design System 2.0 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* Premium Educational Palette - Unified Color System */
    --primary: #1A4DCC;
    --primary-light: #4c7df2;
    --primary-dark: #12368f;
    --primary-surface: #eff4ff;
    
    /* Secondary & Neutral Palette */
    --secondary: #475569;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --text-inverse: #ffffff;
    
    /* Academic Accents (Soft Pastel) */
    --accent: #B1D7D6;
    --accent-pink: #FBCFE8;
    --accent-green: #8EB488;
    --accent-yellow: #C1DA5F;
    
    /* Functional Colors */
    --success: #22C55E;
    --danger: #EF4444;
    --warning: #F97316;
    --info: #0EA5E9;
    
    /* Backgrounds & Structure */
    --bg-main: #F8FAFC;
    --bg-canvas: #FFFFFF;
    --sidebar-bg: #F8FAFC;
    --topbar-bg: rgba(255, 255, 255, 0.9);
    
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    
    /* Shadows & Radii */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 30px -5px rgba(26, 77, 204, 0.05), 0 8px 10px -6px rgba(26, 77, 204, 0.05);
    --shadow-lg: 0 20px 40px -10px rgba(26, 77, 204, 0.12);
    --shadow-premium: 0 10px 40px rgba(26, 77, 204, 0.1);
    
    --radius-sm: 10px;
    --radius: 20px;
    --radius-lg: 32px;
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-width-mini: 76px;
    --topbar-height: 80px;
    
    /* Animation Values */
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base resets & typography */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Outfit', sans-serif; 
    background: var(--bg-main); 
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .sidebar-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

.btn, .badge, .nav-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* Layout Grid */
.layout { display: flex; min-height: 100vh; position: relative; background: #f1f5f9; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-inverse);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow-x: hidden;
    overflow-y: hidden;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand-modern {
    display: flex;
    align-items: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -1px;
}

.brand-d {
    font-weight: 800;
    font-size: 1.35rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-v {
    font-weight: 400;
    font-size: 1.35rem;
    color: var(--secondary);
    margin-left: 2px;
}

.sidebar nav {
    flex: 1;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}
/* 🎨 Custom Scrollbar for Sidebar */
.sidebar nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar nav hr {
    border: none;
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 12px 12px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    margin: 2px 12px;
    border-radius: 12px;
    transition: var(--transition);
}

.sidebar nav a i { font-size: 1.2rem; filter: opacity(0.7); }

.sidebar nav a:hover {
    background: var(--primary-surface);
    color: var(--primary);
}

.sidebar nav a:hover i { filter: opacity(1); transform: translateX(2px); }

.sidebar nav a.active {
    background: var(--primary-surface);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}
.sidebar nav a.active i { filter: opacity(1); color: var(--primary); }

.sidebar nav a.logout {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}
.sidebar nav a.logout:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Sidebar Dropdown Group */
.nav-dropdown { margin: 0 12px; border-radius: 12px; }
summary.nav-dropdownSummary { 
    display: flex !important; align-items: center; gap: 14px; padding: 14px 20px; 
    color: var(--text-muted); font-size: 0.95rem; font-weight: 500; cursor: pointer; 
    list-style: none !important; list-style-type: none !important; transition: var(--transition); border-radius: 12px;
}
summary.nav-dropdownSummary::-webkit-details-marker,
summary.nav-dropdownSummary::marker { display: none !important; content: "" !important; visibility: hidden !important; }

.nav-dropdownSummary:hover { background: var(--primary-surface); color: var(--primary); }
.nav-dropdownSummary i:first-child { font-size: 1.2rem; filter: opacity(0.7); width: 20px; text-align: center; }
.nav-dropdownSummary i:last-child { margin-left: auto; font-size: 0.8rem; transition: transform 0.3s; opacity: 0.5; }
details[open] .nav-dropdownSummary { color: var(--primary); background: var(--primary-surface); }
details[open] .nav-dropdownSummary i:first-child { filter: opacity(1); color: var(--primary); }
details[open] .nav-dropdownSummary i:last-child { transform: rotate(180deg); opacity: 1; }
.nav-dropdownContent { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 8px 0; }
.nav-dropdownContent a { margin: 2px 0 2px 54px !important; padding: 8px 12px !important; font-size: 0.85rem !important; opacity: 0.7; border-left: none !important; }
.nav-dropdownContent a:hover { opacity: 1; color: var(--primary); }
.nav-dropdownContent a.active { background: transparent !important; color: var(--primary) !important; font-weight: 700; opacity: 1; border-left: none !important; }

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition);
}

.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 900;
    transition: var(--transition);
}

.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar-right { display: flex; align-items: center; gap: 24px; }

.menu-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--border-light);
    border: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    transition: var(--transition);
}
.menu-toggle:hover { background: var(--border); }

/* Sidebar Mini (Collapsed) State */
@media (min-width: 769px) {
    .layout.collapsed .sidebar { width: var(--sidebar-width-mini); }
    .layout.collapsed .main-content { margin-left: var(--sidebar-width-mini); }
    .layout.collapsed .sidebar-brand { justify-content: center; padding: 0; }
    .layout.collapsed .sidebar-brand .brand-modern { display: none; }
    .layout.collapsed .sidebar-brand::after { content: 'DVS'; font-size: 1.4rem; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; }
    .layout.collapsed .sidebar nav a { padding: 14px; justify-content: center; margin: 2px 8px; }
    .layout.collapsed .sidebar nav a span, 
    .layout.collapsed .sidebar nav a i:last-child,
    .layout.collapsed .nav-dropdownSummary span,
    .layout.collapsed .nav-dropdownSummary i:last-child { display: none; }
    .layout.collapsed .nav-dropdown { margin: 0 8px; }
    .layout.collapsed .nav-dropdownSummary { justify-content: center; padding: 14px; }
    .layout.collapsed .nav-dropdownContent { display: none !important; }
}

/* Definitive Fix for Summary Marker */
summary.nav-dropdownSummary { list-style: none !important; list-style-type: none !important; }
summary.nav-dropdownSummary::-webkit-details-marker { display: none !important; }
summary.nav-dropdownSummary::marker { display: none !important; content: "" !important; }

.topbar h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--border-light);
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

/* Page Content Container */
.content {
    padding: 40px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInSlideUp 0.6s ease-out;
}

@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Premium Component Styling */
.card {
    background: var(--bg-canvas);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    margin-bottom: 32px;
    transition: var(--transition);
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: var(--accent-soft); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
}
.card-title { font-size: 1.25rem; font-weight: 700; color: #0f172a; }

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-canvas);
    padding: 32px;
    border-radius: var(--radius);
    border-bottom: 4px solid #e2e8f0;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: currentColor;
    opacity: 0.3;
}

.stat-icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.1);
}

.stat-card.blue { color: #1e40af; border-color: #1e40af; }
.stat-card.blue .stat-icon { background: #eff6ff; color: #1e40af; }
.stat-card.green { color: #065f46; border-color: #065f46; }
.stat-card.green .stat-icon { background: #ecfdf5; color: #059669; }
.stat-card.orange { color: #9a3412; border-color: #9a3412; }
.stat-card.orange .stat-icon { background: #fff7ed; color: #ea580c; }
.stat-card.red { color: #991b1b; border-color: #991b1b; }
.stat-card.red .stat-icon { background: #fef2f2; color: #dc2626; }

.stat-info .stat-num {
    display: block;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.stat-info .stat-label { font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; filter: opacity(0.7); }

/* Tables Overhaul */
.table-container {
    background: var(--bg-canvas);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
    margin-bottom: 32px;
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; min-width: 800px; }

.data-table th {
    background: #f8fafc;
    padding: 20px 24px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 18px 24px;
    font-size: 0.9375rem;
    color: #334155;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr { transition: background 0.2s; }
.data-table tr:hover td { background: var(--primary-surface); }
.data-table tr:last-child td { border-bottom: none; }

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(15, 23, 42, 0.2); background: var(--primary-dark); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: #fff;
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-main); border-color: var(--secondary); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary-surface); }

.btn-sm { padding: 10px 18px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* Form Elements */
.form-group { margin-bottom: 24px; }
.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 10px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-canvas);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
}
.badge.badge-success { background-color: #dcfce7 !important; color: #15803d !important; }
.badge.badge-danger { background-color: #fee2e2 !important; color: #b91c1c !important; }
.badge.badge-warning { background-color: #fef9c3 !important; color: #a16207 !important; }
.badge.badge-info { background-color: #e0f2fe !important; color: #0369a1 !important; }

/* Login Page Overhaul */
.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 1000px;
    height: 1000px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -500px;
    right: -500px;
}

.login-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 480px;
    border-radius: 24px;
    padding: 60px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 10;
    opacity: 0;
    animation: fadeInScale 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9) translateY(40px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header { text-align: center; margin-bottom: 40px; }
.login-header h2 { font-size: 2rem; font-weight: 800; color: #0f172a; margin-bottom: 12px; letter-spacing: -0.05em; }
.login-header p { color: var(--text-muted); font-size: 1rem; }

/* Mobile Navigation Components */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    :root { --sidebar-width: 260px; }
    .topbar { padding: 0 24px; }
    .content { padding: 24px; }
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        overflow: hidden; /* sidebar clips — nav scrolls inside */
    }
    .sidebar.active {
        transform: translateX(0);
    }

    /* THE FIX: nav is the scroll box with explicit height */
    .sidebar nav {
        height: calc(100vh - 80px) !important;  /* fill below brand bar */
        max-height: calc(100vh - 80px) !important;
        overflow-y: scroll !important;           /* scroll > auto on mobile */
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        padding-bottom: 24px !important;
    }

    /* Mobile topbar quick-logout button */
    .mobile-topbar-logout {
        display: flex !important;
        align-items: center;
        gap: 6px;
        color: #dc2626;
        font-size: 0.85rem;
        font-weight: 600;
        padding: 6px 12px;
        border-radius: 8px;
        border: 1px solid rgba(220, 38, 38, 0.3);
        background: rgba(220, 38, 38, 0.05);
        transition: all 0.2s;
        white-space: nowrap;
    }
    .mobile-topbar-logout:hover { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
    .mobile-topbar-logout i { font-size: 1rem; }

    .main-content { margin-left: 0; }
    .sidebar-backdrop.active { display: block; }
    .mobile-close-btn { display: block !important; }
    .brand-d, .brand-v { font-size: 1.15rem; }

    .stats-grid { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 1.25rem; }
    .topbar-right .user-profile span { display: none; }
    .topbar-right { gap: 12px; }

    .login-box { padding: 40px 24px; }
    .d-none-mobile { display: none !important; }
    .data-table { min-width: auto !important; }
    .table-container { padding: 0; margin: 10px 0; border-radius: 12px; }
}

/* Utilities */
.glass { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.3); }
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.font-bold { font-weight: 700; }

