/* Subjects Management Grid Fix */
.category-cards-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.subject-card.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: box-shadow 0.2s;
    min-height: 180px;
    position: relative;
}
.subject-card.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}
/* Student Management System - Cambodian Theme */

/* Cambodian Color Variables */
:root {
    /* Primary Cambodian Colors */
    --cambodian-red: #e74c3c;
    --cambodian-red-dark: #c0392b;
    --cambodian-red-light: #f1948a;
    --cambodian-blue: #3498db;
    --cambodian-blue-dark: #2980b9;
    --cambodian-blue-light: #85c1e9;
    --cambodian-gold: #f1c40f;
    --cambodian-gold-light: #fdeaa7;
    --cambodian-gold-pale: #fef9e7;
    
    /* Theme Colors */
    --primary-color: var(--cambodian-red);
    --secondary-color: var(--cambodian-blue);
    --accent-color: var(--cambodian-gold);
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: var(--cambodian-red);
    
    /* Background Colors */
    --bg-primary: transparent;
    --bg-secondary: linear-gradient(135deg, #e8f4fd 0%, #d6eaf8 100%);
    --bg-accent: linear-gradient(135deg, #fdedec 0%, #fadbd8 100%);
    --nav-bg: linear-gradient(135deg, var(--cambodian-red) 0%, var(--cambodian-blue) 100%);
    
    /* Text Colors */
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #ecf0f1;
    --text-gold: #8b4513;
    
    /* Border Colors */
    --border-light: rgba(231, 76, 60, 0.1);
    --border-medium: rgba(231, 76, 60, 0.3);
    --border-strong: var(--cambodian-red);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Admin and role-based visibility */
body:not(.is-admin) .admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: block;
}

body.is-admin .admin-only.nav-item,
body.is-admin .admin-only.btn {
    display: inline-block;
}

/* Container and Layout - ADD SCALING HERE */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 25px;
    transition: all 0.3s ease;
    background-color: var(--surface-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-light, rgba(255,255,255,0.1));

    /* --- ADD THESE THREE LINES FOR SCALING --- */
    transform: scale(0.6);
    transform-origin: top center;
    width: 100%; /* Adjust width to compensate for scale */
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
    padding: 25px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: var(--nav-bg);
    background-size: 400% 400%;
    z-index: -1;
    filter: blur(20px);
    opacity: 0.7;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Navigation */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.top-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--nav-bg);
    background-size: 300% 300%;
    animation: gradientBar 8s ease infinite;
}

@keyframes gradientBar {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.nav-left {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-right {
    position: relative;
}

/* Navigation Items and Brand */
.nav-brand {
    font-size: 1.6rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    position: relative;
    background: linear-gradient(45deg, var(--cambodian-red), var(--cambodian-blue));
    -webkit-background-clip: text;
    background-clip: text;
}

.nav-brand::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cambodian-red), var(--cambodian-gold));
    transition: width 0.3s ease;
}

.nav-brand:hover::after {
    width: 100%;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-item {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: var(--hover-bg);
    transition: height 0.3s ease;
    z-index: -1;
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-item:hover::before {
    height: 100%;
}

.nav-item.active {
    color: var(--primary-color);
    background-color: var(--hover-bg);
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--cambodian-blue) 0%, var(--cambodian-blue-dark) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, var(--cambodian-blue-light) 0%, var(--cambodian-blue) 100%);
}

.btn:active {
    transform: translateY(0);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    min-height: auto;
}

.btn-danger {
    background: var(--error-color);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
}

.btn-secondary:hover {
    background: var(--text-secondary);
    box-shadow: 0 8px 20px var(--shadow-color);
}

/* Cards */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(231, 76, 60, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--cambodian-gold-light);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--nav-bg);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(231, 76, 60, 0.2);
    border-left-color: var(--cambodian-red);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card.full-width {
    grid-column: 1 / -1;
}

/* Loading States */
.loading {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* User Menu */
.user-menu {
    position: relative;
    margin-left: 24px;
}

.user-info {
    background: none;
    border: none;
    color: var(--text-light);
    font-weight: 500;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 8px;
    padding: 6px 12px;
    transition: background 0.2s;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.user-info:hover, .user-info[aria-expanded="true"] {
    background: rgba(231, 76, 60, 0.15);
    color: white;
}

.dropdown-caret {
    font-size: 0.8em;
    margin-left: 2px;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    min-width: 180px;
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-color), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 200;
    padding: 8px 0;
    border: 1px solid var(--border-color);
    animation: dropdownFadeIn 0.2s;
}

.user-dropdown.show {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--cambodian-gold-pale);
    color: var(--cambodian-red);
    font-weight: 600;
}

/* Role-based visibility */
.admin-only {
    display: none !important;
}

.admin-only.visible {
    display: inline-flex !important;
}

/* Dropdown section styles for theme selector */
.dropdown-section {
    margin: 8px 0;
}

.dropdown-section:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.dropdown-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    padding: 0 20px;
}

/* Show admin-only if .is-admin is on body */
body.is-admin .admin-only {
    display: inline-flex !important;
}
body.is-admin #adminNav,
body.is-admin #adminPanelMenu {
    display: inline-flex !important;
}

/* Hide login/logout/profile as needed (JS will toggle) */
#loginMenu, #logoutMenu, #profileMenu, #adminPanelMenu {
    display: none;
}
body.is-logged-in #logoutMenu,
body.is-logged-in #profileMenu {
    display: block;
}
body.is-admin #adminPanelMenu {
    display: block;
}
body.is-logged-in #loginMenu {
    display: none;
}
body:not(.is-logged-in) #loginMenu {
    display: block;
}
body:not(.is-logged-in) #logoutMenu,
body:not(.is-logged-in) #profileMenu {
    display: none;
}

/* Sliding System Administrator Panel */
.admin-slide-panel {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden by default */
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
}

.admin-slide-panel.open {
    right: 0;
}

.admin-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.admin-panel-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.admin-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.admin-panel-close:hover {
    color: #333;
}

.admin-panel-content {
    padding: 20px;
}

/* Collapsible Staff Section */
.staff-section-content {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 1000px;
    opacity: 1;
    overflow: hidden;
}

.staff-section-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.staff-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

/* Staff Tabs */
.staff-tabs {
    border-bottom: 2px solid #e9ecef;
}

.staff-tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: normal;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.staff-tab-btn.active {
    border-bottom-color: #007bff;
    color: #007bff;
    font-weight: bold;
}

.staff-tab-btn:not(.active) {
    color: #666;
}

.staff-tab-btn:hover:not(.active) {
    color: #007bff;
    background-color: #f8f9fa;
}

.staff-tab-content {
    padding-top: 20px;
}

/* Student Areas of Concern Chart Placeholder */
.student-concern-chart-placeholder {
    transition: all 0.3s ease;
    cursor: help;
}

.student-concern-chart-placeholder:hover {
    background: #e9ecef !important;
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Student Subject Performance Badges */
.student-subject-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 15px;
    min-height: 30px;
}

.subject-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 0.75rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    cursor: help;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.subject-badge:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    position: relative;
}

.subject-initial {
    line-height: 1;
}

.loading-badges, .no-subjects {
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

/* Update student item layout to accommodate badges */
.student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.2s ease;
}

.student-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.student-info {
    flex: 1;
    min-width: 200px;
}

.student-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Modal Styles */
.modal,
.app-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(.77,0,.18,1);
}

/* When modal is shown */
.modal.show,
.app-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    pointer-events: auto;
}

.modal-content,
.app-modal-content {
    background-color: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.98);
    transition: transform 0.25s cubic-bezier(.77,0,.18,1);
    margin: 0 auto;
    position: relative;
    left: 0;
    top: 0;
}

.modal-header,
.app-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2,
.app-modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close,
.app-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.modal-close:hover,
.app-modal-close:hover {
    opacity: 1;
}

.modal-body,
.app-modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer,
.app-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Quick Task Form Styles */
.quick-task-form {
    max-width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row.single {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cambodian-red) 0%, var(--cambodian-red-dark) 100%);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
    background: linear-gradient(135deg, var(--cambodian-red-light) 0%, var(--cambodian-red) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--cambodian-gold-light) 0%, var(--cambodian-gold) 100%);
    color: var(--text-gold);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--cambodian-gold) 0%, #e67e22 100%);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(241, 196, 15, 0.4);
}

/* Notification Styles */
.notification {
    border-radius: 8px;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Reduce Staff Management Edit/Delete buttons by 50% */
.staff-section-content .btn,
.data-table .btn {
    padding: 4px 9px;
    font-size: 4px;
    min-width: auto;
}

.staff-section-content .btn-small,
.data-table .btn-small {
    padding: 4px 8px;
    font-size: 6px;
}

.staff-section-content .btn-sm,
.data-table .btn-sm {
    padding: 4px 8px;
    font-size: 6px;
}

/* Enhanced Staff & Role Management Section */
.staff-section {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.staff-section-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.staff-section-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.collapse-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.collapse-toggle.collapsed {
    transform: rotate(-90deg);
}

.staff-section-content.enhanced {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    padding: 1.5rem;
    max-height: 600px;
    transition: max-height 0.3s ease;
}

.staff-section-content.enhanced.collapsed {
    max-height: 0;
    padding: 0 1.5rem;
    overflow: hidden;
}

.staff-list-container {
    min-height: 0; /* Allow grid item to shrink */
}

.staff-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.staff-list-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.staff-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.staff-list-scroll {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-primary);
}

.staff-item.enhanced {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.staff-item.enhanced:last-child {
    border-bottom: none;
}

.staff-item.enhanced:hover {
    background-color: var(--hover-bg);
}

.staff-info.enhanced {
    min-width: 0; /* Prevent overflow */
}

.staff-name.enhanced {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.staff-details.enhanced {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.staff-role.enhanced {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.staff-actions.enhanced {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.roles-reference {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 0;
}

.roles-reference h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.roles-reference-icon {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.roles-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.role-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.role-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.role-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.role-permissions {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Mobile Responsive for Enhanced Staff Section */
@media (max-width: 768px) {
    .staff-section-content.enhanced {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .staff-item.enhanced {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .staff-actions.enhanced {
        justify-content: flex-start;
    }
    
    .roles-reference {
        order: -1; /* Show roles first on mobile */
        position: static;
    }
    
    .staff-list-scroll {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .staff-section-header {
        padding: 0.75rem 1rem;
    }
    
    .staff-section-content.enhanced {
        padding: 0.75rem;
    }
    
    .staff-item.enhanced {
        padding: 0.75rem;
    }
    
    .staff-name.enhanced {
        font-size: 0.9rem;
    }
    
    .staff-details.enhanced {
        font-size: 0.8rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Split Panel Staff Management Styles */
.staff-split-container {
    display: flex;
    gap: 1rem;
    min-height: 400px;
}

.staff-left-panel {
    flex: 2;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.staff-right-panel {
    flex: 1;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.panel-placeholder h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.role-quick-ref {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.role-item-mini {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.role-item-mini .role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    align-self: flex-start;
}

.role-item-mini span:last-child {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.3;
}

.panel-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.panel-section h5 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.stats-mini {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.stat-number {
    font-weight: 600;
    color: #4f46e5;
    font-size: 1rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Mobile responsiveness for split panel */
@media (max-width: 768px) {
    .staff-split-container {
        flex-direction: column;
    }
    
    .staff-left-panel,
    .staff-right-panel {
        flex: 1;
    }
    
    .staff-right-panel {
        order: -1; /* Show reference panel first on mobile */
    }
}

/* Improved Staff Section Styles - Compact Layout */
.staff-section.improved {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 1rem;
}

.staff-section.improved .staff-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border: none;
    transition: background 0.3s ease;
}

.staff-section.improved .staff-section-header:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.staff-section.improved .staff-section-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.staff-section.improved .header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.staff-section.improved .staff-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.staff-section.improved .collapse-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.staff-section.improved .collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.staff-section.improved .collapse-toggle.collapsed {
    transform: rotate(0deg);
}

.staff-section-content.improved {
    display: flex;
    max-height: 400px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.staff-section-content.improved.collapsed {
    max-height: 0;
    padding: 0;
}

.staff-main-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid #e2e8f0;
}

.roles-sidebar {
    width: 200px;
    background: #f8fafc;
    padding: 1rem;
    border-left: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.roles-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.roles-header .roles-icon {
    font-size: 1rem;
}

.roles-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.role-item.compact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.role-item.compact .role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    align-self: flex-start;
}

.role-item.compact .role-desc {
    font-size: 0.7rem;
    color: #6b7280;
    line-height: 1.3;
}

.staff-list-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staff-item.compact {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.staff-item.compact:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.staff-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.staff-primary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.staff-primary .staff-name {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.staff-primary .role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.staff-actions {
    display: flex;
    gap: 0.25rem;
}

.staff-actions .btn.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-width: auto;
    border-radius: 4px;
}

.staff-secondary {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.staff-email {
    color: #4f46e5;
    text-decoration: none;
}

.staff-username {
    color: #6b7280;
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}

.empty-state h4 {
    margin: 0.5rem 0;
    color: #374151;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* ========================================
   ENROLLMENTS SECTION STYLING
   ======================================== */

.enrollments-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.enrollment-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.enrollment-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.enrollment-info h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.enrollment-info p {
    margin: 0.3rem 0;
    color: #555;
    font-size: 0.9rem;
}

.enrollment-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.enrollment-actions .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.enrollment-edit-btn {
    background: #3498db;
    color: white;
}

.enrollment-edit-btn:hover {
    background: #2980b9;
}

.enrollment-delete-btn {
    background: #e74c3c;
    color: white;
}

.enrollment-delete-btn:hover {
    background: #c0392b;
}

/* Status styling */
.status-active {
    color: #27ae60;
    font-weight: 600;
}

.status-completed {
    color: #3498db;
    font-weight: 600;
}

.status-withdrawn {
    color: #e74c3c;
    font-weight: 600;
}

.status-unknown {
    color: #95a5a6;
    font-weight: 600;
}

/* Loading and empty states */
.loading, .empty-state, .error {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.empty-state {
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.error {
    background: #fff5f5;
    color: #e74c3c;
    border: 1px solid #fadbd8;
    border-radius: 8px;
}

/* Sleek Angkor Wat System Logo Styles */
.system-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 2.3rem;
  font-weight: 800;
  font-family: 'Segoe UI', 'Arial', sans-serif;
  letter-spacing: 1px;
  user-select: none;
}
.angkorwat-svg {
  display: flex;
  align-items: center;
  height: 2.2em;
  width: auto;
  min-width: 48px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.08));
  /* Animate temple up and down */
}
.angkorwat-svg svg .temple-group {
  animation: temple-breathe 2.5s ease-in-out infinite;
  transform-origin: 24px 20px;
}
@keyframes temple-breathe {
  0%   { transform: translateY(0px) scale(1); }
  20%  { transform: translateY(-2px) scale(1.01); }
  50%  { transform: translateY(-4px) scale(1.02); }
  80%  { transform: translateY(-2px) scale(1.01); }
  100% { transform: translateY(0px) scale(1); }
}
.system-title {
  background: linear-gradient(90deg, #b71c1c 0%, #1976d2 100%);
  color: #fff;
  -webkit-background-clip: text;

  background-clip: text;



  text-shadow:
    1px 1px 2px #fff,
    0 2px 8px rgba(0,0,0,0.08),
    0 4px 12px rgba(33, 150, 243, 0.10);
  font-size: 1.1em;
  font-weight: 900;
  letter-spacing: 1.5px;
  line-height: 1.1;
}
@media (max-width: 600px) {
  .system-logo { font-size: 1.2rem; gap: 8px; }
  .angkorwat-svg { min-width: 32px; height: 1.2em; }
}

/* Background overlay: only this is blurred */
[id^="bg-overlay"] {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: filter 0.3s, opacity 0.3s;
}
[id^="bg-overlay"].blurred {
  filter: blur(6px) brightness(0.9);
}




/* FORCE ENROLLMENTS MODAL TO CENTER - HIGHEST SPECIFICITY */
#enrollmentsModal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* FORCE STYLE EDITOR MODAL TO CENTER - HIGHEST SPECIFICITY */
#styleEditorModal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}