:root {
    --primary-bg: #0f172a;
    --secondary-bg: #1e293b;
    --accent-color: #fbbf24;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success-color: #10b981;
    --error-color: #ef4444;
    --border-color: #334155;
    
    /* Premium Gradients */
    --gradient-1: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    --gradient-3: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    --gradient-4: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

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

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    /* Subtle background glow for premium feel */
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
                      radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.dashboard-container { max-width: 1400px; } /* Wider container for Dashboard */

/* ===== TOP NAV ===== */
.top-nav {
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0; position: sticky; top: 0; z-index: 100;
}
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.nav-brand { font-weight: 800; font-size: 1.1rem; color: #fff; display: flex; align-items: center; gap: 8px; }
.nav-brand i { color: var(--accent-color); font-size: 1.3rem; }
.nav-links { font-size: 0.9rem; color: var(--text-secondary); font-weight: 600;}

/* ===== HEADER ===== */
.main-header {
    background: transparent;
    padding: 60px 0 110px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.badge {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-color);
    padding: 6px 18px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

h1 { font-size: 2.8rem; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.main-header p { color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* Stats Bar - Glassmorphism */
.stats-bar {
    display: flex; justify-content: center; gap: 40px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 25px 50px; border-radius: 20px;
    position: absolute; bottom: -45px; left: 50%; transform: translateX(-50%);
    box-shadow: 0 20px 40px -5px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 10;
    width: max-content;
    max-width: 90%;
}

.stat-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-value { font-size: 2rem; font-weight: 700; color: #fff; font-family: 'Outfit', sans-serif; line-height: 1; }
.stat-label { font-size: 0.95rem; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.stat-divider { width: 1px; background: rgba(255,255,255,0.1); }

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed; inset: 0; background: var(--primary-bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
    background-image: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
}
.login-card {
    background: var(--secondary-bg); border: 1px solid var(--border-color);
    padding: 50px 40px; border-radius: 24px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    width: 100%; max-width: 450px; text-align: center;
}
.login-header i { font-size: 4rem; color: var(--accent-color); margin-bottom: 15px; display: inline-block;}
.login-header h2 { font-size: 2rem; margin-bottom: 10px; color: #fff; }
.login-header p { color: var(--text-secondary); margin-bottom: 30px; }
.login-form .form-group { text-align: right; margin-bottom: 20px; }
.login-error { color: var(--error-color); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); padding: 12px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; display: none; }

/* ===== MAIN CONTENT ===== */
main { padding-top: 80px; padding-bottom: 100px; }

.card {
    background: var(--secondary-bg);
    border-radius: 20px; padding: 40px; margin-bottom: 35px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.section-label { display: block; margin-bottom: 14px; font-weight: 700; font-size: 1.1rem; color: #fff; }
.required { color: var(--error-color); margin-right: 4px; }

/* Selection Cards */
.type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }

.type-card, .level-card {
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border-color);
    padding: 24px; border-radius: 16px; text-align: center;
    cursor: pointer; transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    position: relative; overflow: hidden;
}
.type-card:hover, .level-card:hover { 
    border-color: rgba(251,191,36, 0.5); 
    transform: translateY(-2px);
}
.type-card.active, .level-card.active { 
    border-color: var(--accent-color); 
    background: rgba(251,191,36,0.08); 
    box-shadow: 0 10px 30px rgba(251,191,36,0.1); 
}
.type-icon, .level-icon { font-size: 2.5rem; margin-bottom: 12px; color: var(--text-secondary); transition: color 0.3s; }
.type-card.active .type-icon, .level-card.active .level-icon { color: var(--accent-color); }

.type-card span, .level-card span { display: block; font-weight: 700; font-size: 1.2rem; margin-bottom: 4px; color: #fff; }
.type-card small { color: var(--text-secondary); font-size: 0.9rem; }

/* Form Row */
.form-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 30px; }
.level-selector { display: flex; gap: 15px; }
.level-card { flex: 1; padding: 18px 10px; }

.form-input {
    width: 100%; calc(100% - 28px);
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border-color);
    padding: 16px 20px; border-radius: 12px; color: #fff;
    font-family: inherit; font-size: 1.05rem; outline: none;
    transition: all 0.3s;
}
.form-input:focus { border-color: var(--accent-color); background: var(--primary-bg); box-shadow: 0 0 0 4px rgba(251,191,36,0.1); }

/* Autocomplete Custom UI */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.suggestions-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1e293b;
    border-radius: 12px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.5);
    z-index: 2000;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #334155;
    padding: 8px;
    backdrop-filter: blur(10px);
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.95rem;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.suggestion-item:hover {
    background: #334155;
    color: var(--accent-color);
    padding-right: 20px;
}

.suggestion-item i {
    color: #94a3b8;
    font-size: 1.1rem;
}

.input-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: #fbbf24;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(251, 191, 36, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    border-right: 3px solid #fbbf24;
}

/* ===== PROGRESS ===== */
.progress-section { margin-bottom: 40px; padding: 0 10px; }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 15px; font-weight: 700; font-size: 1.1rem; }
.progress-percentage { color: var(--accent-color); font-family: 'Outfit'; }
.progress-bar-container { height: 10px; background: var(--secondary-bg); border-radius: 10px; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--border-color); }
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    width: 0%; transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ===== CRITERIA GROUPS ===== */
.criterion-group {
    background: var(--secondary-bg); border-radius: 20px;
    overflow: hidden; border: 1px solid var(--border-color);
    margin-bottom: 30px; box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    transition: transform 0.3s;
}
.criterion-group:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(0,0,0,0.2); }

.group-header {
    padding: 24px 30px; display: flex;
    justify-content: space-between; align-items: center;
    position: relative; overflow: hidden;
}
.group-header::before {
    content: ''; position: absolute; inset: 0; opacity: 0.9; z-index: 1;
}
.group-header > * { position: relative; z-index: 2; }

.group-info h3 { margin: 0 0 4px 0; font-size: 1.3rem; font-weight: 700; }
.group-info p { font-size: 0.9rem; opacity: 0.9; margin: 0; }

.group-badge {
    background: rgba(0,0,0,0.25); padding: 6px 16px;
    border-radius: 30px; font-size: 0.95rem; font-weight: 700;
    font-family: 'Outfit', sans-serif; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.1);
}

.color-1 .group-header::before { background: var(--gradient-1); }
.color-2 .group-header::before { background: var(--gradient-2); }
.color-3 .group-header::before { background: var(--gradient-3); }
.color-4 .group-header::before { background: var(--gradient-4); }

.criterion-item {
    padding: 24px 30px; display: flex;
    justify-content: space-between; align-items: center; gap: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(15, 23, 42, 0.3);
}

.item-content { display: flex; align-items: center; gap: 24px; flex: 1; }
.item-content p { margin: 6px 0 0 0; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }
.item-content strong { color: #fff; font-size: 1.1rem; }

.item-number {
    width: 44px; height: 44px; min-width: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; font-weight: 700;
    font-family: 'Outfit', sans-serif; font-size: 1.2rem;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--accent-color);
}

/* ===== UPLOAD CONTROLS ===== */
.upload-controls { display: flex; align-items: center; gap: 15px; }

.upload-btn {
    background: transparent; border: 2px solid var(--border-color);
    color: var(--text-primary); padding: 12px 24px; border-radius: 12px;
    cursor: pointer; font-family: inherit; font-weight: 700; font-size: 0.95rem;
    display: flex; align-items: center; gap: 10px;
    transition: all 0.3s;
}
.upload-btn i { font-size: 1.3rem; color: var(--text-secondary); transition: color 0.3s; }
.upload-btn:hover { border-color: var(--accent-color); background: rgba(251,191,36,0.05); }
.upload-btn:hover i { color: var(--accent-color); }

.upload-status { min-width: 140px; text-align: left; }

.status-uploading { color: var(--accent-color); font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; }
.status-success { color: var(--success-color); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px;}
.status-error { color: var(--error-color); font-weight: 700; font-size: 0.95rem; }

.btn-replace {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-replace:hover {
    background: var(--accent-color);
    color: #000;
}

/* ===== DASHBOARD (ADMIN) Header Bar ===== */
.admin-top-bar {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.admin-title-area { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.admin-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }

.header-action-btn {
    background: rgba(15,23,42,0.6); backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1); color: var(--text-primary);
    padding: 8px 16px; border-radius: 8px; font-family: inherit; font-weight: 600; font-size: 0.9rem;
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; transition: all 0.3s;
}
.header-action-btn i { font-size: 1.1rem; }
.header-action-btn.btn-blue { color: #60a5fa; border-color: rgba(96,165,250,0.3); }
.header-action-btn.btn-blue:hover { background: rgba(96,165,250,0.1); border-color: #60a5fa; }
.header-action-btn.btn-red { color: #f87171; border-color: rgba(248,113,113,0.3); }
.header-action-btn.btn-red:hover { background: rgba(248,113,113,0.1); border-color: #f87171; }

.dashboard-header { margin-bottom: 30px; display: flex; flex-direction: column; gap: 20px; margin-top: 30px;}
.dashboard-title h2 { font-size: 1.8rem; margin-bottom: 5px;}
.dashboard-title p { color: var(--text-secondary); }

/* Tabs */
.tab-btn { background: none; border: none; font-family: inherit; font-size: 1rem; color: var(--text-secondary); padding: 12px 20px; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.tab-btn:hover { color: #fff; background: rgba(255,255,255,0.05); border-radius: 8px 8px 0 0; }
.tab-btn.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Checkbox Grids for Modals */
.super-admin-cb { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; color: #fff; }
.super-admin-cb input { width: 18px; height: 18px; accent-color: var(--accent-color); cursor: pointer; }

.cb-group-title { margin: 0 0 8px; color: var(--text-secondary); font-size: 0.85rem; font-weight: 600;}
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-bottom: 15px; }
.checkbox-grid.grid-cols-4 { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.checkbox-grid label {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem;
    transition: all 0.2s; user-select: none;
}
.checkbox-grid label:hover { background: rgba(255,255,255,0.08); }
.checkbox-grid label:has(input:checked) { background: rgba(251,191,36,0.15); border-color: var(--accent-color); color: var(--accent-color); font-weight: 700; }
.checkbox-grid input[type="checkbox"] { display: none; }

.filter-panel {
    background: var(--secondary-bg); padding: 25px; border-radius: 16px;
    border: 1px solid var(--border-color); margin-bottom: 30px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 10px; }
.filter-group label { font-size: 0.9rem; font-weight: 700; color: var(--text-secondary); }
.filter-select {
    background: var(--primary-bg); border: 1px solid var(--border-color);
    color: #fff; padding: 12px 16px; border-radius: 10px; font-family: inherit;
    outline: none; transition: border-color 0.3s; width: 100%;
}
.filter-select:focus { border-color: var(--accent-color); }

/* Table */
.table-container { overflow-x: auto; background: var(--secondary-bg); border-radius: 16px; border: 1px solid var(--border-color); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.admin-table th, .admin-table td { padding: 14px 18px; text-align: right; border-bottom: 1px solid var(--border-color); }
.admin-table th { background: rgba(15, 23, 42, 0.5); color: var(--text-secondary); font-weight: 700; letter-spacing: 0.5px; font-size: 0.9rem; white-space: nowrap; }
.admin-table tbody tr { transition: background 0.2s; }
.admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.nowrap-col { white-space: nowrap; }

.action-buttons { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.action-btn { 
    width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    border: none; cursor: pointer; transition: all 0.2s; font-size: 1.2rem;
}
.btn-download { background: rgba(251, 191, 36, 0.1); color: var(--accent-color); }
.btn-download:hover { background: var(--accent-color); color: #000; transform: translateY(-2px); }
.btn-edit { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.btn-edit:hover { background: #3b82f6; color: #fff; transform: translateY(-2px); }
.btn-delete { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.btn-delete:hover { background: #ef4444; color: #fff; transform: translateY(-2px); }

.badge-tag { padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.badge-boys { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-girls { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success-color); }

.download-link {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(251, 191, 36, 0.1); color: var(--accent-color);
    padding: 8px 16px; border-radius: 8px; text-decoration: none;
    font-weight: 700; font-size: 0.9rem; transition: all 0.3s;
}
.download-link:hover { background: var(--accent-color); color: #000; transform: translateY(-2px); }

/* Buttons */
.btn {
    border: none; padding: 12px 24px; border-radius: 12px;
    font-size: 1rem; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: all 0.3s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-2px); }

.btn-primary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.2);
}
.btn-primary:hover { box-shadow: 0 15px 30px rgba(245, 158, 11, 0.3); }

.submit-final-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000; border: none; padding: 16px 40px; border-radius: 12px;
    font-size: 1.15rem; font-weight: 800; cursor: pointer; font-family: inherit;
    transition: all 0.3s; box-shadow: 0 10px 20px rgba(245, 158, 11, 0.2);
    display: inline-flex; align-items: center; gap: 12px;
}
.submit-final-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(245, 158, 11, 0.3); }

/* Site Footer */
.site-footer {
    text-align: center; padding: 30px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 40px; color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .container { padding: 0 15px; }
    h1 { font-size: 2rem; }
    .main-header { padding: 40px 0 90px; }
    .stats-bar { padding: 20px; gap: 20px; width: calc(100% - 20px); }
    .stat-value { font-size: 1.5rem; }
    
    main { padding-top: 100px; } 
    .school-info-section { margin-top: 40px; } /* Added specific margin to escape stats bar */
    
    .form-row { grid-template-columns: 1fr; gap: 20px;}
    .type-selector { grid-template-columns: 1fr; }
    .card { padding: 30px 20px; }
    
    .admin-table th, .admin-table td { padding: 12px 10px; font-size: 0.85rem; } /* Compressed rows */
    .admin-table { min-width: 600px; }
    
    .submit-final-btn { 
        width: 100%; 
        max-width: 320px; 
        justify-content: center; 
        padding: 14px 20px; 
        font-size: 1.05rem;
    }
    .app-footer { display: flex; justify-content: center; }
    
    .criterion-item { flex-direction: column; align-items: flex-start; gap: 20px;}
    .upload-controls { width: 100%; justify-content: space-between; flex-direction: row-reverse; }
    .item-content { gap: 16px; }
    
    .filter-panel { grid-template-columns: 1fr; padding: 20px;}
    .dashboard-summary { grid-template-columns: 1fr 1fr; }
}

/* ===== MODALS & OVERLAYS (Restored) ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; backdrop-filter: blur(8px);
    padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }

.modal-box {
    background: var(--secondary-bg);
    padding: 40px; border-radius: 24px;
    text-align: center; border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    max-width: 450px; width: 100%;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-icon { font-size: 5rem; margin-bottom: 20px; display: block; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #fff; color: #000;
    padding: 14px 28px; border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    z-index: 10000; transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 700; white-space: nowrap;
    display: flex; align-items: center; gap: 10px;
}
.toast::before { content: '✅'; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--error-color); color: #fff; }
.toast.error::before { content: '❌'; }

/* ==================================================
   ADMIN DASHBOARD V2 OVERHAUL
================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    background: #E2E8F0;
    color: #1e293b;
    position: relative;
}

/* Mobile Backdrop */
.admin-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.admin-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar */
.admin-sidebar {
    width: 280px;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 0;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 1001;
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 25px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    min-height: 80px;
}

.sidebar-header i {
    font-size: 2rem;
    color: var(--accent-color);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    transition: opacity 0.2s;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.admin-sidebar.collapsed .sidebar-header h2,
.admin-sidebar.collapsed .sidebar-header p,
.admin-sidebar.collapsed .sidebar-link-text {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.admin-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 0;
}

.admin-sidebar.collapsed .sidebar-header > div:first-child {
    display: none;
}

.admin-sidebar.collapsed .sidebar-toggle-btn {
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.sidebar-link.active {
    background: linear-gradient(90deg, transparent 0%, rgba(251, 191, 36, 0.1) 100%);
    color: var(--accent-color);
    border-right-color: var(--accent-color);
}

.sidebar-link.active i {
    color: var(--accent-color);
}

/* Main Content Area */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex-child truncation */
    margin-right: 280px;
    transition: margin-right 0.3s;
}

.admin-sidebar.collapsed ~ .admin-main {
    margin-right: 80px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 900;
}

.mobile-nav-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.8rem;
    color: #2b3674;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.1);
}

.page-content {
    display: none;
    padding: 20px 40px 40px 40px;
    animation: fadeIn 0.4s ease;
}

.page-content.active {
    display: block;
}

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

/* CSS Only Bar Charts */
.css-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    height: 250px;
    padding: 20px 0;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    margin-top: 20px;
}

.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.bar-fill {
    width: 40px;
    background: linear-gradient(180deg, #4318FF 0%, #3b82f6 100%);
    border-radius: 8px 8px 0 0;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 10px 20px rgba(67, 24, 255, 0.2);
}

.bar-value {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: 700;
    color: #4318FF;
}

.bar-label {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #475569;
    text-align: center;
    white-space: nowrap;
}

/* Overview Cards */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.overview-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    transition: transform 0.3s, box-shadow 0.3s;
}

.overview-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -10px rgba(0,0,0,0.08);
}

.overview-icon {
    width: 60px;
    height: 60px;
    background: rgba(67, 24, 255, 0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #4318FF;
}

.overview-card.success .overview-icon { background: rgba(5, 205, 153, 0.1); color: #05CD99; }
.overview-card.warning .overview-icon { background: rgba(255, 172, 51, 0.1); color: #FFAC33; }
.overview-card.pink .overview-icon { background: rgba(238, 93, 80, 0.1); color: #EE5D50; }

.overview-info h3 { font-size: 0.95rem; color: #1e293b; margin-bottom: 5px; font-weight: 700;}
.overview-info p { font-size: 1.8rem; font-weight: 700; color: #2b3674; line-height: 1; font-family: 'Outfit';}

/* Utilities override for light dashboard */
.page-title {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i { color: #4318FF; }

/* Light Dashboard Containers */
.dashboard-card-light {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    margin-bottom: 30px;
}

.dashboard-card-light h3 {
    color: #2b3674;
    font-weight: 700;
}

/* Light Theme Tables/Filters Overlay */
.admin-main .filter-panel, .admin-main .table-container {
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    border: none;
}
.admin-main .admin-table th { background: #f1f5f9; color: #334155; border-bottom: 1px solid #e2e8f0; font-weight: 700; }
.admin-main .admin-table td { color: #1e293b; border-bottom: 1px solid #e2e8f0; font-weight: 600; }
.admin-main .section-label { color: #1e293b; font-weight: 700; }
.admin-main .form-input, .admin-main .filter-select { background: #f1f5f9; border: 1px solid #e2e8f0; color: #1e293b; font-weight: 700; }

/* ===== ANALYTICS CHARTS ===== */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}
.analytics-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.report-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}
.report-card h4 {
    color: #1e293b;
    font-size: 1.05rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.report-card h4 i {
    font-size: 1.3rem;
}

/* KPI Mini Cards */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 30px;
}
.kpi-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    text-align: center;
}
.kpi-card .kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
    margin-bottom: 6px;
}
.kpi-card .kpi-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 700;
}

/* Horizontal Bar Row */
.h-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.h-bar-label {
    min-width: 80px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    text-align: right;
}
.h-bar-track {
    flex: 1;
    height: 28px;
    background: #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.h-bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-right: 10px;
}
.h-bar-fill span {
    font-size: 0.78rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
}
.h-bar-count {
    min-width: 45px;
    font-size: 0.9rem;
    font-weight: 800;
    color: #1e293b;
    text-align: center;
    font-family: 'Outfit', sans-serif;
}

/* Donut Chart CSS */
.donut-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}
.donut-chart {
    position: relative;
    width: 160px;
    height: 160px;
}
.donut-chart svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.donut-chart circle {
    fill: none;
    stroke-width: 22;
    cx: 80;
    cy: 80;
    r: 60;
}
.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.donut-center .donut-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
    font-family: 'Outfit';
}
.donut-center .donut-sub {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}
.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.legend-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
}
.legend-text span {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 600;
}

/* School list items */
.school-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed #e2e8f0;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
}
.school-item i {
    color: #64748b;
    font-size: 1.2rem;
}

/* User Management UI Fixes */
.super-admin-cb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: #1e293b; /* Dark navy for high contrast */
    font-size: 1.05rem;
    cursor: pointer;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}
.super-admin-cb:hover {
    background: #f8fafc;
    border-color: #fbbf24;
}
.super-admin-cb input {
    width: 20px;
    height: 20px;
    accent-color: #fbbf24;
    cursor: pointer;
}

.cb-group-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#permissions-container label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

/* Tabs UI Improvements */
.tabs-container {
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
    display: inline-flex;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-btn.active {
    background: #ffffff;
    color: #4318FF;
    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.1);
}

.tab-btn i {
    font-size: 1.2rem;
}

.tab-btn:hover:not(.active) {
    background: rgba(255,255,255,0.5);
    color: #334155;
}
#permissions-container label:hover {
    background: #ffffff;
}
#permissions-container input {
    accent-color: #4318FF;
}



/* Quick Notes */
.quick-note-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Cairo', sans-serif;
}

.quick-note-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* ==========================================
   Advanced Viewer Modal (Lightbox)
   ========================================== */
.viewer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    padding: 20px 80px;
    gap: 20px;
    position: relative;
}

.viewer-content {
    background: #fff;
    width: 100%;
    height: 90vh;
    max-width: 1200px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.viewer-header {
    padding: 20px 30px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================
   School Reports Styles 
   ========================================= */

.school-reports-tabs {
    overflow-x: auto;
    white-space: nowrap;
}

.sr-tab-btn {
    transition: all 0.2s ease;
    border: 2px solid transparent !important;
}

.sr-tab-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.school-report-card {
    transition: all 0.2s ease;
}

.school-report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.badge-tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

#pdf-report-content {
    /* To ensure PDF is rendered correctly */
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.viewer-school-info h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.25rem;
}

.viewer-school-info p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

.viewer-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.viewer-nav-btn:hover {
    background: #4318FF;
    border-color: #4318FF;
    transform: scale(1.1);
}

.viewer-nav-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .viewer-container {
        padding: 10px;
        flex-direction: column;
    }
    .viewer-nav-btn {
        position: fixed;
        bottom: 20px;
        z-index: 11002;
    }
    .viewer-nav-btn.prev { right: 20px; }
    .viewer-nav-btn.next { left: 20px; }
}

/* ==========================================
   Bulk Actions Toolbar
   ========================================== */
.bulk-toolbar {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 15px 25px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    animation: slideDown 0.3s ease-out;
}

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

.bulk-info {
    font-weight: 600;
    color: #2b3674;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bulk-info i {
    color: #4318FF;
    font-size: 1.2rem;
}

.bulk-actions {
    display: flex;
    gap: 12px;
}

.bulk-btn {
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.bulk-btn.approve {
    background: #05CD99;
    color: #fff;
    box-shadow: 0 4px 12px rgba(5, 205, 153, 0.2);
}

.bulk-btn.approve:hover {
    background: #04b586;
    transform: translateY(-2px);
}

.bulk-btn.download {
    background: #4318FF;
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.2);
}

.bulk-btn.download:hover {
    background: #3311cc;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .bulk-toolbar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Inline Editing */
.inline-note-cell:hover {
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.inline-note-cell:focus {
    background: #fff;
    box-shadow: inset 0 0 0 2px #4318FF;
    outline: none;
}

/* Viewer Control Buttons */
.viewer-btn-approve {
    background: #05CD99;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(5, 205, 153, 0.3);
    font-family: 'Cairo', sans-serif;
}

.viewer-btn-approve:hover {
    background: #04b586;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(5, 205, 153, 0.4);
}

.viewer-btn-download {
    background: white;
    color: #2b3674;
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-family: 'Cairo', sans-serif;
}

.viewer-btn-download:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

/* ==========================================
   Login Screen
   ========================================== */
.login-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--primary-bg); /* #0f172a */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.login-card {
    background: var(--secondary-bg); /* #1e293b */
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.login-header h2 {
    color: #fff;
    font-size: 1.5rem;
    margin: 0 0 5px 0;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.login-form label.section-label {
    display: block;
    text-align: right;
    color: #f8fafc;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.login-form .form-input {
    width: 100%;
    background: #fef9c3; /* Light yellow input */
    color: #1e293b;
    border: 1px solid #fde047;
    padding: 14px 15px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    outline: none;
    margin-bottom: 20px;
    text-align: right;
}

.login-form .form-input::placeholder {
    color: #94a3b8;
    font-weight: 600;
}

.login-form button {
    background: var(--accent-color);
    color: #0f172a;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-form button:hover {
    background: #f59e0b;
    transform: translateY(-2px);
}

.login-error {
    background: #fee2e2;
    color: #ef4444;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: none;
    text-align: center;
}
/* ==========================================
   Mobile Responsiveness - Full Dashboard
   ========================================== */
@media (max-width: 768px) {
    /* Sidebar: Overlay pattern on mobile */
    .admin-sidebar {
        transform: translateX(100%);
        width: 280px !important;
        box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    }
    
    .admin-sidebar.open-mobile {
        transform: translateX(0);
    }

    .admin-sidebar .sidebar-link-text,
    .admin-sidebar .sidebar-header h2,
    .admin-sidebar .sidebar-header p {
        display: block !important;
        opacity: 1 !important;
    }

    .admin-main {
        margin-right: 0 !important;
    }

    /* Page content padding */
    .page-content {
        padding: 10px !important;
    }
    .page-title {
        font-size: 1.1rem !important;
        margin-bottom: 15px !important;
    }

    .report-card {
        padding: 15px !important;
    }

    .report-card h4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
        font-size: 1rem !important;
    }

    /* Fix header actions in reports */
    .report-card > div[style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    
    .report-card .upload-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Topbar Visibility on Mobile */
    .admin-topbar {
        padding: 10px 20px;
        display: flex !important;
    }
    .mobile-nav-toggle {
        display: block !important;
    }

    /* Overview cards: 1 column if small */
    .overview-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Prevent content clipping in dashboard cards */
    .dashboard-card-light, .report-card, .overview-card {
        overflow-x: hidden; /* Changed from auto to hidden to allow normal vertical flow */
        max-width: 100%;
    }

    .school-item {
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 10px !important;
    }
    
    .school-item > div {
        width: 100%;
    }
    
    .school-item div[style*="white-space:nowrap"] {
        text-align: right !important;
        margin-top: 5px;
    }

    /* Chart scrollability */
    .css-bar-chart {
        overflow-x: auto;
        padding-bottom: 10px;
        min-width: 100%;
    }

    /* Smart Stats */
    .smart-stats-container {
        flex-direction: column !important;
    }

    /* Filters */
    .filter-panel {
        flex-direction: column !important;
    }
    .filter-group {
        width: 100% !important;
    }

    /* Table: horizontal scroll */
    .table-container, .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
        background: #fff;
        border-radius: 12px;
    }
    .admin-table {
        min-width: 700px !important;
    }

    /* Bulk Toolbar */
    .bulk-toolbar {
        flex-direction: column !important;
        gap: 15px !important;
        height: auto !important;
        padding: 15px !important;
    }
    .bulk-actions {
        flex-direction: column !important;
        width: 100%;
    }
    .bulk-btn {
        width: 100% !important;
    }

    /* KPI Row */
    .kpi-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .kpi-card {
        width: 100% !important;
    }

    /* Analytics Grids: Force vertical stack on mobile */
    .analytics-grid, .analytics-grid-3 {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
    }
    
    .report-card, .overview-card, .dashboard-card-light {
        width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        box-sizing: border-box !important;
    }

    /* Viewer (Lightbox) */
    .viewer-container {
        padding: 10px !important;
    }
    .viewer-content {
        height: 95vh;
        border-radius: 12px;
    }
    .viewer-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
        padding: 15px !important;
    }
    .viewer-actions {
        width: 100%;
        flex-direction: row !important;
    }
    .viewer-btn-approve, .viewer-btn-download {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    .viewer-nav-btn {
        display: none !important;
    }
    .viewer-close-btn {
        top: 10px !important;
        left: 10px !important;
        font-size: 2rem !important;
    }

    /* Login */
    .login-card {
        margin: 15px;
        padding: 25px;
    }

    /* Modals */
    .modal-box {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        padding: 20px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Approval form row stacking */
    .modal-box div[style*="display: flex; gap: 20px"] {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .modal-box div[style*="display: flex; gap: 10px"] {
        flex-wrap: wrap;
    }
    
    .rating-btn {
        padding: 10px 5px !important;
        font-size: 0.8rem !important;
    }
}


/* ============================================================
   Returning School Flow Styles
   ============================================================ */

/* مسافات بين الأقسام */
#school-details-section {
    margin-top: 32px;
}

#school-details-section .form-group {
    margin-bottom: 32px;
}

#school-details-section .form-group:last-child {
    margin-bottom: 0;
}

/* تحسين الكاردات المحددة - إطار ذهبي فقط */
.type-card.selected,
.level-card.selected {
    border: 3px solid #fbbf24 !important;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2), 
                0 4px 12px rgba(251, 191, 36, 0.15) !important;
    transform: scale(1.02);
}

/* تحسين الـ Dropdown - تصميم احترافي */
#school-dropdown {
    width: 100%;
    padding: 18px 24px;
    padding-left: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
    color: #1e293b;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: 
        linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234318FF' stroke-width='2.5' 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, no-repeat;
    background-position: center, left 16px center;
    background-size: auto, 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#school-dropdown:hover {
    border-color: #4318FF;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f4ff 100%);
    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.12);
    transform: translateY(-1px);
}

#school-dropdown:focus {
    outline: none;
    border-color: #4318FF;
    box-shadow: 0 0 0 4px rgba(67, 24, 255, 0.12), 0 4px 16px rgba(67, 24, 255, 0.15);
    background: white;
}

#school-dropdown option {
    padding: 16px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    background: white;
    line-height: 1.8;
    border-bottom: 1px solid #f1f5f9;
    direction: rtl;
    min-height: 50px;
}

#school-dropdown option:hover {
    background: linear-gradient(to left, #f8f9ff 0%, #ffffff 100%);
    color: #4318FF;
}

#school-dropdown option:checked,
#school-dropdown option:focus {
    background: linear-gradient(135deg, #4318FF 0%, #6C3AFF 100%);
    color: white;
    font-weight: 700;
}

#filtered-count-hint {
    display: block;
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #4318FF;
    font-weight: 600;
    background: rgba(67, 24, 255, 0.08);
    border-radius: 8px;
    border-right: 3px solid #4318FF;
}

#filtered-count-hint i {
    margin-left: 6px;
    font-size: 1.1rem;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    #school-dropdown {
        font-size: 16px; /* منع الزوم التلقائي في iOS */
        padding: 18px 20px;
        padding-left: 50px;
    }
    
    #school-dropdown option {
        font-size: 16px;
        padding: 16px;
    }
}

/* تحسين الـ type-selector للخطوة الأولى */
.type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

@media (max-width: 480px) {
    .type-selector {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Supervisor Performance Dashboard Styles
   ============================================================ */
.supervisor-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.supervisor-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}
.supervisor-header {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 15px;
}
.supervisor-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #4318FF 0%, #3b82f6 100%);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}
.supervisor-info h4 {
    margin: 0 0 5px 0;
    color: #1e293b;
    font-size: 1.1rem;
}
.supervisor-info p {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
}
.supervisor-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}
.supervisor-stat {
    text-align: center;
    flex: 1;
}
.supervisor-stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    font-family: 'Outfit', sans-serif;
}
.supervisor-stat-lbl {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
}
.supervisor-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}
.supervisor-progress-fill {
    height: 100%;
    background: #05CD99;
    border-radius: 4px;
}
.supervisor-timeline {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}
.supervisor-timeline p {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
}
.timeline-item {
    font-size: 0.8rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.timeline-item i {
    color: #4318FF;
}

@page {
    size: A4 portrait;
    margin: 1.5cm;
}

@media print {
    /* Hide everything except the report */
    body > *:not(#school-report-modal) {
        display: none !important;
    }
    
    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #school-report-modal {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: white !important;
        overflow: visible !important;
        display: block !important;
    }
    
    #school-report-modal[hidden] {
        display: none !important;
    }
    
    #school-report-container {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    #pdf-report-content {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: white !important;
    }
    
    /* Hide Action Buttons */
    #close-modal-btn,
    #report-action-buttons {
        display: none !important;
    }
    
    /* Ensure colors print exactly as they appear */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    /* Smart Page Breaks */
    /* Never break inside these elements */
    .modal-box > div,
    .evidence-item,
    table, 
    tr,
    td,
    th,
    .status-badge {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* Ensure Headings stick with their content */
    h1, h2, h3, h4, h5 {
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-inside: avoid !important;
    }
}

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: #05CD99; }
input:focus + .slider { box-shadow: 0 0 1px #05CD99; }
input:checked + .slider:before { transform: translateX(24px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }
