:root {
    --primary: #4361ee;
    --primary-hover: #3a56d4;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --danger: #f72585;
    --dark: #2b2d42;
    --light: #f8f9fa;
    --gray: #8d99ae;
    --bg-color: #0f172a;
    --panel-bg: rgba(255, 255, 255, 0.05);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-color: #f1f5f9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Login Page Specific */
.login-page {
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    padding: 40px 30px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.login-header p {
    color: var(--gray);
    font-size: 14px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #cbd5e1;
}

.form-group input:not([type="checkbox"]):not([type="radio"]), .form-group select, .form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-group select, select.form-control {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.form-group select option, select.form-control option {
    background: var(--dark);
    color: #fff;
}

.form-group input:focus, .form-group select:focus, .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 12px 24px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
}

/* Messages */
.form-messages {
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

.msg-error {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.1);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.msg-success {
    color: #86efac;
    background: rgba(74, 222, 128, 0.1);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Dashboard specific layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
.sidebar {
    width: 260px;
    min-width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 900;
}
.sidebar-header {
    padding: 20px 20px 15px;
    border-bottom: 1px solid var(--panel-border);
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}
/* Custom Scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-menu {
    list-style: none;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}
.sidebar-menu li a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-left-color: var(--primary);
}
.sidebar-menu li a.active {
    background: rgba(67, 97, 238, 0.15);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--panel-border);
    background: rgba(10, 15, 29, 0.6);
    margin-top: auto;
}
.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 8px;
    background: rgba(247, 37, 133, 0.12);
    border: 1px solid rgba(247, 37, 133, 0.35);
    color: #ff70a6;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}
.sidebar-logout-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(247, 37, 133, 0.3);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
    overflow-y: auto;
}

/* Topbar Styles */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    gap: 15px;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}
.topbar-title-block {
    display: flex;
    flex-direction: column !important;
    gap: 4px;
}
.topbar h2, .topbar-title-block h2 {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    line-height: 1.25;
}
.topbar p, .topbar-title-block p {
    color: #8d99ae;
    font-size: 14px;
    margin: 0;
    line-height: 1.4;
    display: block !important;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.data-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    color: #cbd5e1;
}
.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--panel-border);
}
.data-table th {
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}
.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.badge-success { background: rgba(76, 201, 240, 0.2); color: var(--success); }
.badge-danger { background: rgba(247, 37, 133, 0.2); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-secondary { background: transparent; border: 1px solid var(--gray); color: #cbd5e1; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}
.modal.show {
    display: flex;
}
.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    box-sizing: border-box;
}
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 12px;
}
.close-modal, .close-modal-nc, .close-modal-bulk, .close-modal-excel {
    color: var(--gray);
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.close-modal:hover, .close-modal-nc:hover, .close-modal-bulk:hover, .close-modal-excel:hover {
    color: #fff;
}

/* Responsive Navigation & Mobile Elements */
.mobile-only-btn {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--panel-border);
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}
.mobile-only-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1040;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .sidebar.show {
        left: 0;
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
    }
    .mobile-only-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        padding: 20px 15px;
    }
    .classes-container, .layout-container {
        flex-direction: column !important;
    }
    .class-list, .class-list-sidebar {
        width: 100% !important;
        max-height: 250px;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .topbar-left {
        width: 100%;
    }
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .card {
        padding: 15px;
    }
    .modal-content {
        padding: 18px 15px;
    }
    /* Grid in modals to single column */
    .modal-body form div[style*="grid-template-columns: 1fr 1fr"],
    .modal-body form div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    /* Form inputs full width on mobile */
    .filter-bar, .search-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}