/**
 * School Management System - Premium Modern Design
 * Enhanced & Refined UI/UX - Cleaned & Unified
 */

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

:root {
    /* Modern Color Palette */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-lighter: #eef2ff;
    
    --secondary-color: #0ea5e9;
    --accent-color: #8b5cf6;
    --accent-light: #a78bfa;
    
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --info-color: #06b6d4;
    --info-light: #cffafe;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    
    /* Layout Variables */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: rgba(99, 102, 241, 0.15);
    --sidebar-active: rgba(99, 102, 241, 0.25);
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    
    --navbar-height: 65px;
    --navbar-bg: #1e293b;
    --navbar-border: rgba(255, 255, 255, 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.25rem;
}

/* Dark & Light Mode Variables */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --card-bg: #1e293b;
}
body:not(.dark-mode) {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #111827;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
}

/* ============================================ */
/* GLOBAL RESET & BASE STYLES */
/* ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
    font-size: var(--font-size-base);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.4); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.6); }
body.dark-mode ::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); }
::selection { background: var(--primary-light); color: var(--white); }

/* ============================================ */
/* LOGIN PAGE */
/* ============================================ */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%; animation: gradientShift 15s ease infinite;
    padding: 2rem; position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
}
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.login-container { width: 100%; max-width: 440px; position: relative; z-index: 1; }
@media (min-width: 1024px) { .login-container { max-width: 460px; width: 460px; } }
.login-card {
    background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(20px); border-radius: var(--radius-2xl);
    padding: 2.5rem; box-shadow: var(--shadow-2xl); animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
@keyframes slideUpFade { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.login-header { text-align: center; margin-bottom: 2rem; }
.logo-circle {
    width: 75px; height: 75px; background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem;
    position: relative; box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3); animation: float 3s ease-in-out infinite;
}
.logo-circle::before {
    content: ''; position: absolute; inset: -3px; border-radius: inherit;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0.3; filter: blur(8px); z-index: -1;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.logo-circle i { font-size: 2rem; color: var(--white); }
.login-header h2 {
    font-size: 1.625rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.375rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-header p { color: var(--gray-600); font-size: var(--font-size-sm); }
.login-form .form-label { font-weight: 600; color: var(--gray-700); margin-bottom: 0.375rem; font-size: var(--font-size-sm); display: flex; align-items: center; }
.login-form .form-label i { margin-left: 0.375rem; color: var(--primary-color); font-size: var(--font-size-base); }
.login-form .form-control, .login-form .input-group { margin-bottom: 1rem; }
.login-form .form-control {
    padding: 0.75rem 0.875rem; border-radius: var(--radius-lg); border: 2px solid var(--gray-200);
    font-size: var(--font-size-sm); transition: all var(--transition-base); background: var(--white); height: 44px; line-height: 1.5;
}
.login-form .form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); outline: none; }
.login-form .input-group { position: relative; display: block; width: 100%; }
.login-form .input-group .form-control { width: 100%; padding-left: 3rem; padding-right: 0.875rem; border-radius: var(--radius-lg) !important; margin-bottom: 0; height: 44px; }
.login-form .input-group button {
    position: absolute; left: 0.25rem; top: 50%; transform: translateY(-50%); background: transparent !important;
    border: none !important; color: var(--gray-500); padding: 0; width: 40px; height: 40px; display: flex;
    align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition-base); z-index: 10; border-radius: var(--radius-md);
}
.login-form .input-group button:hover { color: var(--primary-color); background: rgba(99, 102, 241, 0.08) !important; }
.login-form .input-group button:focus { outline: none !important; box-shadow: none !important; background: transparent !important; }
.login-form .input-group button:active { background: rgba(99, 102, 241, 0.12) !important; transform: translateY(-50%) scale(0.95); }
.login-form .input-group button i { font-size: var(--font-size-base); pointer-events: none; }
.login-form .input-group .btn { box-shadow: none !important; }
.login-form .input-group .btn:focus, .login-form .input-group .btn:active, .login-form .input-group .btn:active:focus { background: transparent !important; border: none !important; box-shadow: none !important; outline: none !important; }
.login-form .input-group .btn-outline-secondary { background: transparent !important; border: none !important; }
.login-form .input-group .btn-outline-secondary:hover, .login-form .input-group .btn-outline-secondary:focus, .login-form .input-group .btn-outline-secondary:active { background: rgba(99, 102, 241, 0.08) !important; border: none !important; box-shadow: none !important; }
.form-check { margin-bottom: 1.25rem; }
.form-check-input { width: 1rem; height: 1rem; border: 2px solid var(--gray-300); cursor: pointer; }
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.form-check-label { font-size: var(--font-size-sm); color: var(--gray-700); cursor: pointer; margin-right: 0.375rem; }
.btn-login {
    width: 100%; padding: 0.75rem; font-weight: 600; font-size: var(--font-size-base); border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%); border: none; color: var(--white);
    transition: all var(--transition-base); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); position: relative; overflow: hidden;
}
.btn-login::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); transition: left 0.5s;
}
.btn-login:hover::before { left: 100%; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4); }
.btn-login:active { transform: translateY(0); }
.login-footer { text-align: center; margin-top: 1.25rem; }
.login-footer a { color: var(--primary-color); text-decoration: none; font-weight: 500; font-size: var(--font-size-sm); transition: color var(--transition-base); }
.login-footer a:hover { color: var(--primary-dark); text-decoration: underline; }
.login-info { margin-top: 1.5rem; text-align: center; }
.login-info p { color: rgba(255, 255, 255, 0.9); font-size: var(--font-size-sm); text-shadow: 0 2px 4px rgba(0,0,0,0.1); }

/* ============================================ */
/* NAVBAR */
/* ============================================ */
.navbar {
    height: var(--navbar-height); background: var(--navbar-bg) !important; backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 var(--navbar-border); border-bottom: 1px solid var(--navbar-border); position: fixed;
    top: 0; left: 0; right: 0; z-index: 1000; transition: all var(--transition-base); padding: 0 1rem;
}
.navbar.navbar-dark { background: var(--navbar-bg) !important; }
.navbar .container-fluid { display: flex; align-items: center; justify-content: space-between; padding: 0; }
.navbar-brand { font-weight: 700; font-size: var(--font-size-lg); color: var(--white) !important; display: flex; align-items: center; gap: 0.625rem; transition: all var(--transition-base); text-decoration: none; }
.navbar-brand:hover { color: var(--white) !important; transform: scale(1.02); }
.navbar-brand i { font-size: var(--font-size-2xl); background: linear-gradient(135deg, var(--primary-light), var(--accent-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
#sidebarToggle {
    background: rgba(255, 255, 255, 0.08); color: var(--white) !important; border: 1px solid rgba(255, 255, 255, 0.1);
    width: 38px; height: 38px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-base); font-size: var(--font-size-lg); text-decoration: none;
}
#sidebarToggle:hover { background: rgba(99, 102, 241, 0.2); border-color: var(--primary-light); transform: scale(1.05); color: var(--white) !important; }

/* Search Box (RTL Fixed) */
.search-box { position: relative; width: 320px; direction: rtl; }
.search-box input { text-align: right !important; direction: rtl; padding: 0.5rem 2.75rem 0.5rem 0.875rem !important; border-radius: var(--radius-full); border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.08) !important; font-size: var(--font-size-sm); transition: all var(--transition-base); color: var(--white) !important; height: 38px; }
.search-box input:focus { border-color: var(--primary-light); background: rgba(255, 255, 255, 0.12) !important; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); outline: none; color: var(--white) !important; }
.search-box input::placeholder { color: rgba(255, 255, 255, 0.5); }
.search-box > i { position: absolute; left: 0.875rem !important; right: auto !important; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, 0.5); pointer-events: none; font-size: var(--font-size-sm); z-index: 2; }
#navSchoolName { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* ============================================ */
/* تنسيق احترافي لشارة الإشعارات (Notification Badge) */
/* ============================================ */
#notificationCount.notification-badge {
    background-color: #dc3545 !important; /* لون أحمر قياسي واضح */
    color: #ffffff !important;
    font-size: 0.65rem !important; /* حجم خط صغير جداً */
    font-weight: 800 !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 4px !important;
    border-radius: 10px !important; /* يجعلها دائرة أو بيضاوية صغيرة */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #ffffff !important; /* إطار أبيض يفصل الرقم عن أيقونة الجرس */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3) !important; /* ظل خفيف يعطي عمقاً واحترافية */
    
    /* ضبط الموقع ليكون فوق رأس الجرس بدقة */
    top: -2px !important;
    inset-inline-start: 55% !important; 
    transform: translateX(-30%) translateY(-30%); /* رفع البادج قليلاً للأعلى والوسط */
    z-index: 10 !important;
}

/* تأثير تفاعلي عند مرور الماوس على زر الإشعارات */
#notificationDropdown:hover .notification-badge {
    transform: translateX(-30%) translateY(-30%) scale(1.1); /* تكبير خفيف جداً عند اللمس */
    transition: transform 0.2s ease-in-out;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.notification-btn { background: transparent !important; border: none !important; color: rgba(255, 255, 255, 0.8) !important; padding: 0.5rem !important; transition: all var(--transition-base); position: relative; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius-md); }
.notification-btn:hover { background: rgba(255, 255, 255, 0.08) !important; color: var(--white) !important; }
.notification-btn:focus { box-shadow: none !important; }
.notification-btn i { font-size: 1.25rem; }
.dropdown-toggle { background: rgba(255, 255, 255, 0.08) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; color: var(--white) !important; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.875rem !important; border-radius: var(--radius-md); transition: all var(--transition-base); font-size: var(--font-size-sm); height: 38px; text-decoration: none; }
.dropdown-toggle:hover { background: rgba(255, 255, 255, 0.12) !important; border-color: rgba(255, 255, 255, 0.2) !important; color: var(--white) !important; }
.dropdown-toggle:focus { box-shadow: none !important; }
.dropdown-toggle i { font-size: var(--font-size-lg); }
.dropdown-toggle::after { margin-right: 0.25rem; vertical-align: middle; }
.dropdown-menu { border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); padding: 0.375rem; min-width: 260px; margin-top: 0.5rem !important; background: var(--bg-primary); animation: dropdownSlide 0.2s ease-out; }
@keyframes dropdownSlide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-header { font-weight: 700; font-size: var(--font-size-xs); color: var(--text-primary); padding: 0.5rem 0.75rem; text-transform: uppercase; letter-spacing: 0.025em; }
.dropdown-item { border-radius: var(--radius-md); padding: 0.5rem 0.75rem; transition: all var(--transition-fast); color: var(--text-primary); display: flex; align-items: center; gap: 0.625rem; font-size: var(--font-size-sm); }
.dropdown-item:hover { background: var(--primary-lighter); color: var(--primary-color); }
.dropdown-item i { width: 18px; text-align: center; font-size: var(--font-size-base); }
.dropdown-divider { margin: 0.375rem 0; border-top-color: var(--border-color); }
.notification-dropdown { max-width: 360px; max-height: 380px; overflow-y: auto; }
.notification-item { padding: 0.75rem; border-bottom: 1px solid var(--border-color); cursor: pointer; transition: all var(--transition-base); font-size: var(--font-size-sm); }
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-tertiary); }
.notification-item.unread { background: var(--primary-lighter); border-right: 3px solid var(--primary-color); }
.navbar .d-flex { display: flex; align-items: center; }
@media (max-width: 768px) { .navbar-brand span { display: none; } .search-box { display: none !important; } #sidebarToggle { margin-left: 0; } }
.navbar-dark .navbar-nav .nav-link { color: var(--white) !important; }
.navbar-dark .navbar-toggler { border-color: rgba(255, 255, 255, 0.1); }
.navbar-dark .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }

/* تنسيق قائمة البحث الذكية */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e3e6f0;
    z-index: 9999;
    max-height: 450px;
    overflow-y: auto;
    display: none;
    margin-top: 5px;
}

.search-dropdown.active {
    display: block;
}

.search-section-title {
    padding: 10px 15px;
    font-size: 11px;
    font-weight: 800;
    color: #5a5c69;
    text-transform: uppercase;
    background: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: #333;
}

.search-result-item:hover {
    background: #f8f9fc;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.search-result-info h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.search-result-info small {
    color: #858796;
    font-size: 12px;
}

.search-empty {
    padding: 30px;
    text-align: center;
    color: #858796;
}
/* ============================================ */
/* SIDEBAR */
/* ============================================ */
.sidebar { position: fixed; top: var(--navbar-height); right: 0; width: var(--sidebar-width); height: calc(100vh - var(--navbar-height)); background: var(--sidebar-bg); overflow-y: auto; overflow-x: hidden; transition: width var(--transition-slow); z-index: 999; box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1); border-left: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar-header { padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-header h5 { margin: 0; font-size: var(--font-size-xs); font-weight: 700; color: rgba(255, 255, 255, 0.6); text-transform: uppercase; letter-spacing: 0.05em; transition: opacity var(--transition-base); white-space: nowrap; }
.sidebar.collapsed .sidebar-header h5 { opacity: 0; }
.sidebar-menu { padding: 0.75rem 0; }
.menu-item { display: flex; align-items: center; padding: 0.75rem 1rem; color: var(--sidebar-text); text-decoration: none; transition: all var(--transition-base); cursor: pointer; position: relative; margin: 0.25rem 0.625rem; border-radius: var(--radius-md); min-height: 42px; }
.menu-item::before { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.05); border-radius: inherit; opacity: 0; transition: opacity var(--transition-base); }
.menu-item:hover::before { opacity: 1; }
.menu-item:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); }
.menu-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25); }
.menu-item.active::after { content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; background: linear-gradient(180deg, var(--primary-light), var(--accent-light)); border-radius: var(--radius-full); }
.menu-item i { width: 20px; min-width: 20px; margin-left: 0.75rem; font-size: var(--font-size-lg); transition: transform var(--transition-base); display: flex; align-items: center; justify-content: center; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 0.75rem; }
.sidebar.collapsed .menu-item i { margin-left: 0; font-size: 1.125rem; }
.menu-item:hover i { transform: scale(1.1); }
.menu-item span { flex: 1; white-space: nowrap; font-size: var(--font-size-sm); font-weight: 500; transition: opacity var(--transition-base); }
.sidebar.collapsed .menu-item span { opacity: 0; width: 0; overflow: hidden; }
.menu-divider { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 0.625rem 1rem; }
.sidebar.collapsed .menu-divider { margin: 0.625rem 0.5rem; }
.menu-label { padding: 0.625rem 1rem 0.375rem; font-size: var(--font-size-xs); text-transform: uppercase; color: rgba(255, 255, 255, 0.5); font-weight: 700; letter-spacing: 0.05em; transition: opacity var(--transition-base); }
.sidebar.collapsed .menu-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }
@media (max-width: 768px) { .sidebar { transform: translateX(100%); } .sidebar.show { transform: translateX(0); } }

/* ============================================ */
/* MAIN CONTENT & CARDS */
/* ============================================ */
.main-content { margin-top: var(--navbar-height); margin-right: var(--sidebar-width); min-height: calc(100vh - var(--navbar-height)); transition: margin-right var(--transition-slow); background: var(--bg-secondary); }
.sidebar.collapsed ~ .main-content { margin-right: var(--sidebar-collapsed-width); }
@media (max-width: 768px) { .main-content { margin-right: 0; } }
.container-fluid { padding: 1.5rem; }
.stat-card { background: var(--card-bg); border-radius: var(--radius-xl); padding: 1.5rem; box-shadow: var(--shadow-md); transition: all var(--transition-base); border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; right: 0; width: 80px; height: 80px; background: linear-gradient(135deg, var(--primary-light), var(--accent-light)); opacity: 0.05; border-radius: 50%; transform: translate(25%, -25%); }
.stat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-xl); border-color: var(--primary-light); }
.stat-card.primary { border-right: 3px solid var(--primary-color); }
.stat-card.success { border-right: 3px solid var(--success-color); }
.stat-card.warning { border-right: 3px solid var(--warning-color); }
.stat-card.danger { border-right: 3px solid var(--danger-color); }
.stat-card.info { border-right: 3px solid var(--info-color); }
.stat-card-icon { width: 56px; height: 56px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 0.875rem; position: relative; z-index: 1; }
.stat-card-icon.primary { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); color: var(--white); box-shadow: 0 6px 12px rgba(99, 102, 241, 0.3); }
.stat-card-icon.success { background: linear-gradient(135deg, var(--success-color), #059669); color: var(--white); box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3); }
.stat-card-icon.warning { background: linear-gradient(135deg, var(--warning-color), #d97706); color: var(--white); box-shadow: 0 6px 12px rgba(245, 158, 11, 0.3); }
.stat-card-icon.danger { background: linear-gradient(135deg, var(--danger-color), #dc2626); color: var(--white); box-shadow: 0 6px 12px rgba(239, 68, 68, 0.3); }
.stat-card-icon.info { background: linear-gradient(135deg, var(--info-color), #0891b2); color: var(--white); box-shadow: 0 6px 12px rgba(6, 182, 212, 0.3); }
.stat-card-value { font-size: 1.875rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.375rem; line-height: 1; }
.stat-card-label { color: var(--text-secondary); font-size: var(--font-size-sm); font-weight: 500; }
.stat-card-trend { margin-top: 0.625rem; font-size: var(--font-size-xs); font-weight: 600; display: flex; align-items: center; gap: 0.25rem; }
.trend-up { color: var(--success-color); }
.trend-down { color: var(--danger-color); }

/* ============================================ */
/* DASHBOARD CHARTS & INSIGHTS (FIXED & ENHANCED) */
/* ============================================ */
.dashboard-chart-box {
    position: relative;
    width: 100%;
    height: 260px; /* تكبير ارتفاع الرسم البياني */
    padding: 0 10px 0 0; /* إزالة المسافات العلوية والسفلية لمنع الفراغ الأبيض */
    overflow: hidden;
}
.dashboard-chart-box canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}
.revenue-chart-box { height: 260px; } /* تكبير الرسم البياني للإيرادات */

.dashboard-insights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.insight-card {
    position: relative;
    min-height: 92px;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-color, #e9ecef);
    border-radius: 16px;
    background: var(--card-bg, #fff);
    box-shadow: 0 4px 16px rgba(0,0,0,.045);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.insight-card::after {
    content: "";
    position: absolute;
    inset-inline-end: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 16px 16px 0;
    background: currentColor;
    opacity: .8;
}
.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.insight-sessions { color: #f39c12; }
.insight-debts { color: #e74c3c; }
.insight-payroll { color: #27ae60; }

.insight-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    background: currentColor;
    color: #fff;
    opacity: .95;
}

.insight-content {
    min-width: 0; /* يسمح للنص بالالتفاف بشكل صحيح */
    flex: 1;
}

.insight-label {
    display: block;
    color: var(--text-secondary, #6c757d);
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.insight-value-row {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    flex-wrap: wrap; /* السماح للنص بالالتفاف لمنع الانقطاع */
}

.insight-value-row strong {
    color: var(--text-primary, #212529);
    font-size: 1.2rem;
    line-height: 1.15;
    font-weight: 800;
}

.insight-value-row span {
    color: var(--text-secondary, #6c757d);
    font-size: .7rem;
    font-weight: 500;
    white-space: normal; /* منع النص من القطع */
}

.insight-arrow {
    color: currentColor;
    opacity: .45;
    font-size: .8rem;
}

/* ============================================ */
/* TABLES & ACTIONS (Fixed Alignment & Row Colors) */
/* ============================================ */
.table-card { background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--border-color); transition: all var(--transition-base); }
.table-card:hover { box-shadow: var(--shadow-lg); }
.table-card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: var(--bg-tertiary); }
.table-card-header h5 { margin: 0; font-weight: 700; font-size: var(--font-size-lg); color: var(--text-primary); display: flex; align-items: center; gap: 0.625rem; }
.table-card-header h5 i { color: var(--primary-color); font-size: var(--font-size-xl); }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; margin-bottom: 0; border-collapse: separate; border-spacing: 0; }
.data-table thead th { background: var(--bg-tertiary); border-bottom: 2px solid var(--border-color); padding: 0.875rem 0.75rem; font-weight: 700; font-size: var(--font-size-xs); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.025em; white-space: nowrap; position: sticky; top: 0; z-index: 10; }
.data-table tbody td { padding: 0.875rem 0.75rem; vertical-align: middle !important; border-bottom: 1px solid var(--border-color); font-size: var(--font-size-sm); color: var(--text-primary); }
.data-table tbody tr { transition: all var(--transition-fast); }
.data-table tbody tr:hover { background: var(--bg-tertiary); }
.table-actions { display: flex; align-items: center; justify-content: center; gap: 0.375rem; }

/* Row Colors for Paid/Unpaid Students */
.row-unpaid {
    background-color: #fde2e2 !important;
    transition: background-color 0.3s ease;
}
.row-unpaid:hover {
    background-color: #f8c8c8 !important;
}

.row-paid {
    background-color: #dcfce7 !important;
    transition: background-color 0.3s ease;
}
.row-paid:hover {
    background-color: #bbf7d0 !important;
}

.avatar-circle { width: 36px; height: 36px; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--font-size-sm); }
.avatar-img { width: 36px; height: 36px; border-radius: var(--radius-full); object-fit: cover; border: 2px solid var(--border-color); }
.badge { padding: 0.3rem 0.75rem; border-radius: var(--radius-full); font-weight: 600; font-size: var(--font-size-xs); display: inline-flex; align-items: center; gap: 0.3rem; }
.status-active, .bg-success { background: var(--success-light) !important; color: var(--success-color) !important; }
.status-inactive, .bg-secondary { background: var(--gray-200) !important; color: var(--gray-700) !important; }
.status-pending, .bg-warning { background: var(--warning-light) !important; color: #92400e !important; }
.bg-danger { background: var(--danger-light) !important; color: var(--danger-color) !important; }
.bg-info { background: var(--info-light) !important; color: #0e7490 !important; }
.bg-primary { background: var(--primary-lighter) !important; color: var(--primary-color) !important; }

/* ============================================ */
/* BUTTONS & FORMS */
/* ============================================ */
.btn { border-radius: var(--radius-md); font-weight: 600; padding: 0.5rem 1rem; transition: all var(--transition-base); border: none; font-size: var(--font-size-sm); display: inline-flex; align-items: center; gap: 0.375rem; box-shadow: var(--shadow-sm); }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); color: var(--white); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary-color)); box-shadow: 0 6px 12px rgba(99, 102, 241, 0.3); }
.btn-success { background: linear-gradient(135deg, var(--success-color), #059669); color: var(--white); }
.btn-success:hover { box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3); }
.btn-warning { background: linear-gradient(135deg, var(--warning-color), #d97706); color: var(--white); }
.btn-danger { background: linear-gradient(135deg, var(--danger-color), #dc2626); color: var(--white); }
.btn-info { background: linear-gradient(135deg, var(--info-color), #0891b2); color: var(--white); }
.btn-outline-primary { background: transparent; border: 2px solid var(--primary-color); color: var(--primary-color); }
.btn-outline-primary:hover { background: var(--primary-color); color: var(--white); }
.btn-outline-secondary { background: transparent; border: 2px solid var(--gray-300); color: var(--text-primary); }
.btn-outline-secondary:hover { background: var(--gray-300); }
.btn-sm { padding: 0.4rem 0.875rem; font-size: var(--font-size-xs); border-radius: var(--radius-sm); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); }
.form-label { font-weight: 600; color: var(--text-primary); margin-bottom: 0.375rem; font-size: var(--font-size-sm); }
.form-control, .form-select { border-radius: var(--radius-md); border: 2px solid var(--border-color); padding: 0.625rem 0.875rem; transition: all var(--transition-base); background: var(--bg-primary); color: var(--text-primary); font-size: var(--font-size-sm); }
.form-control:focus, .form-select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); outline: none; }
.input-group-text { background: var(--bg-tertiary); border: 2px solid var(--border-color); color: var(--text-secondary); font-size: var(--font-size-sm); }

/* ============================================ */
/* MODALS & PAGINATION */
/* ============================================ */
.modal-content { border-radius: var(--radius-2xl); border: none; box-shadow: var(--shadow-2xl); background: var(--card-bg); animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(40px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { background: linear-gradient(135deg, var(--primary-lighter), var(--bg-tertiary)); border-bottom: 1px solid var(--border-color); border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; padding: 1.25rem 1.5rem; }
.modal-title { font-weight: 800; font-size: var(--font-size-lg); color: var(--text-primary); display: flex; align-items: center; gap: 0.625rem; }
.modal-title i { color: var(--primary-color); font-size: var(--font-size-xl); }
.modal-body { padding: 1.5rem; }
.modal-footer { background: var(--bg-tertiary); border-top: 1px solid var(--border-color); padding: 1rem 1.5rem; border-radius: 0 0 var(--radius-2xl) var(--radius-2xl); }
.pagination { margin-top: 1.25rem; display: flex; gap: 0.375rem; }
.page-link { color: var(--text-primary); border-radius: var(--radius-md); border: 2px solid var(--border-color); padding: 0.4rem 0.75rem; transition: all var(--transition-base); background: var(--bg-primary); font-size: var(--font-size-sm); }
.page-link:hover { background: var(--primary-color); color: var(--white); border-color: var(--primary-color); transform: translateY(-2px); }
.page-item.active .page-link { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); border-color: var(--primary-color); color: var(--white); box-shadow: 0 3px 6px rgba(99, 102, 241, 0.3); }

/* ============================================ */
/* LOADING, TOASTS & MISC */
/* ============================================ */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.spinner-border { width: 3rem; height: 3rem; border-width: 0.3rem; }
.toast { border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); border: none; backdrop-filter: blur(10px); animation: toastSlideIn 0.3s ease-out; }
@keyframes toastSlideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast-header { background: var(--bg-tertiary); border-bottom: 1px solid var(--border-color); border-radius: var(--radius-lg) var(--radius-lg) 0 0; font-size: var(--font-size-sm); }
.toast-body { font-size: var(--font-size-sm); }
.toast-success { border-right: 3px solid var(--success-color); }
.toast-error { border-right: 3px solid var(--danger-color); }
.toast-warning { border-right: 3px solid var(--warning-color); }
.toast-info { border-right: 3px solid var(--info-color); }
.progress { height: 0.625rem; border-radius: var(--radius-full); background: var(--gray-200); overflow: hidden; }
.progress-bar { border-radius: var(--radius-full); transition: width 0.6s ease; }
.chart-container { position: relative; height: 300px; margin-top: 1rem; }
.hover-card { cursor: pointer; transition: all var(--transition-base); }
.hover-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.empty-state { text-align: center; padding: 3rem 2rem; }
.empty-state i { font-size: 3.5rem; color: var(--gray-400); margin-bottom: 1.25rem; }
.empty-state h5 { color: var(--text-secondary); font-weight: 600; font-size: var(--font-size-base); }

/* ============================================ */
/* STUDENT ID CARD PROFESSIONAL DESIGN */
/* ============================================ */
.pro-id-card {
    width: 350px;
    height: 230px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 5px 15px rgba(0,0,0,0.05);
    background: #ffffff;
    display: flex;
    flex-direction: column;
    font-family: 'Cairo', sans-serif;
    position: relative;
    border: 1px solid #f1f5f9;
}
.pro-id-header {
    background: linear-gradient(135deg, #1e293b, #4f46e5);
    height: 85px;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    z-index: 2;
}
.pro-id-header .school-info { display: flex; flex-direction: column; align-items: center; }
.pro-id-header .school-name { font-size: 18px; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 4px; }
.pro-id-header .school-meta { font-size: 10px; color: rgba(255,255,255,0.9); }
.pro-id-body {
    flex: 1;
    display: flex;
    padding: 0 16px;
    z-index: 2;
    align-items: center;
}
.pro-id-left {
    width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pro-id-qr {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    padding: 4px;
    background: white;
}
.pro-id-right {
    flex: 1;
    padding-right: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.pro-id-name {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px;
    line-height: 1.2;
}
.pro-id-reg-badge {
    font-size: 9px;
    font-weight: 700;
    color: #4f46e5;
    background: #eef2ff;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 8px;
    align-self: flex-start;
}
.pro-id-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    padding: 3px 0;
    border-bottom: 1px solid #f1f5f9;
}
.pro-id-info-row:last-child { border-bottom: none; }
.pro-id-info-label { color: #94a3b8; font-weight: 600; }
.pro-id-info-value { color: #1e293b; font-weight: 700; text-align: left; }
.pro-id-footer {
    height: 30px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 2;
}
.pro-id-card::before {
    content: '';
    position: absolute;
    top: 50px;
    right: -20px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.05), transparent 70%);
    border-radius: 50%;
    z-index: 1;
}

/* ============================================ */
/* RESPONSIVE & PRINT */
/* ============================================ */
@media (max-width: 768px) {
    .container-fluid { padding: 1rem; }
    .stat-card { margin-bottom: 0.875rem; }
    .table-card-header { flex-direction: column; align-items: flex-start; gap: 0.875rem; }
    .search-box { width: 100%; }
    .chart-container { height: 240px; }
    .navbar-brand span { display: none; }
    :root { --font-size-xs: 0.7rem; --font-size-sm: 0.775rem; --font-size-base: 0.8125rem; }
}
@media print {
    .navbar, .sidebar, .btn, .table-actions, .search-box, .dropdown { display: none !important; }
    .main-content { margin: 0 !important; }
    .table-card { box-shadow: none; border: 1px solid #ddd; }
}
/* Student profile - dynamic enrollment/attendance cards */
.student-attendance-grid { align-items: stretch; }
.student-group-attendance-card {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 14px;
    padding: 18px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,.04);
}
.student-group-attendance-card h5 { font-weight: 700; }
.attendance-stat {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px 6px;
    min-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.attendance-stat strong { font-size: 1.25rem; line-height: 1.2; }
.attendance-stat small { color: #6c757d; margin-top: 3px; }


/* ========================================================================
   MOBILE-FIRST RESPONSIVE HARDENING
   Covers Android phones, iPhones, tablets and narrow landscape viewports.
   ======================================================================== */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-width: 320px;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

#contentArea,
#contentArea > *,
#mainContent,
#mainContent > .container-fluid,
#mainContent .row > [class*="col-"] {
    min-width: 0;
}

#contentArea .form-control,
#contentArea .form-select,
#contentArea .input-group {
    max-width: 100%;
}

#contentArea .d-flex.justify-content-between.align-items-center,
#contentArea .table-card-header,
#contentArea .card-header.d-flex {
    min-width: 0;
    flex-wrap: wrap;
    row-gap: .75rem;
}

#contentArea .d-flex.justify-content-between.align-items-center > *,
#contentArea .table-card-header > *,
#contentArea .card-header.d-flex > * {
    min-width: 0;
}

.table-responsive {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.table-responsive > table {
    margin-bottom: 0;
}

.table-card-header .btn-group,
.table-card-header > .d-flex,
.card-header.d-flex > .d-flex {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.sidebar-overlay {
    position: fixed;
    inset: var(--navbar-height) 0 0;
    z-index: 1090;
    background: rgba(15, 23, 42, .58);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-base), visibility var(--transition-base);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (max-width: 991.98px) {
    :root {
        --navbar-height: 60px;
        --sidebar-width: min(86vw, 300px);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .navbar {
        padding-inline: .5rem;
        height: var(--navbar-height);
    }

    .navbar .container-fluid {
        gap: .35rem;
    }

    .navbar-brand {
        min-width: 0;
        margin-inline: .25rem !important;
    }

    .search-box {
        display: none !important;
    }

    .navbar-brand span {
        display: inline-block;
        max-width: min(38vw, 180px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navbar > .container-fluid > .d-flex {
        min-width: 0;
        gap: .15rem;
        margin-inline-start: auto;
    }

    .navbar .dropdown-toggle {
        padding-inline: .45rem !important;
    }

    .navbar .dropdown-toggle::after {
        display: none;
    }

    .sidebar {
        top: var(--navbar-height);
        right: 0;
        width: var(--sidebar-width);
        max-width: 300px;
        height: calc(100dvh - var(--navbar-height));
        transform: translateX(110%);
        transition: transform var(--transition-slow), width var(--transition-slow);
        z-index: 1100;
        box-shadow: -12px 0 32px rgba(15, 23, 42, .28);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width);
    }

    .sidebar.collapsed .sidebar-header h5,
    .sidebar.collapsed .menu-item span,
    .sidebar.collapsed .menu-label {
        opacity: 1;
        width: auto;
        height: auto;
        padding: revert;
        overflow: visible;
    }

    .sidebar.collapsed .menu-item {
        justify-content: flex-start;
        padding: .75rem 1rem;
    }

    .sidebar.collapsed .menu-item i {
        margin-left: .75rem;
    }

    .main-content,
    .sidebar.collapsed ~ .main-content {
        width: 100%;
        margin-right: 0 !important;
    }

    .main-content > .container-fluid {
        width: 100%;
        padding: 1rem;
    }

    .dropdown-menu {
        max-width: min(92vw, 360px);
    }

    .notification-dropdown {
        max-height: min(60dvh, 380px);
    }

    .table-card-header {
        align-items: stretch;
        padding: 1rem;
    }

    .table-card-header h5 {
        width: 100%;
    }

    .table-card-header > .btn,
    .table-card-header > .d-flex > .btn,
    .table-card-header .btn-group > .btn {
        min-height: 42px;
    }

    .dashboard-insights {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-chart-box,
    .revenue-chart-box,
    .chart-container {
        height: 230px;
    }

    .modal-dialog {
        width: auto;
        max-width: calc(100% - 1rem);
        margin: .5rem auto;
    }

    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        max-height: calc(100dvh - 150px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem;
    }

    .modal-footer .btn {
        flex: 1 1 140px;
        margin: 0 !important;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .container-fluid,
    .main-content > .container-fluid {
        padding: .75rem;
    }

    .row {
        --bs-gutter-x: .75rem;
        --bs-gutter-y: .75rem;
    }

    .stat-card {
        padding: 1rem;
        margin-bottom: 0;
    }

    .stat-card-value {
        font-size: 1.55rem;
    }

    .dashboard-insights {
        grid-template-columns: minmax(0, 1fr);
    }

    .insight-card {
        min-height: 82px;
        padding: .85rem .9rem;
    }

    .dashboard-chart-box,
    .revenue-chart-box,
    .chart-container {
        height: 210px;
    }

    .table-card,
    .card {
        max-width: 100%;
    }

    .table-card-header .btn,
    .table-card-header > .d-flex,
    .table-card-header > .d-flex > .btn,
    .card-header.d-flex > .d-flex {
        width: 100%;
    }

    .table-card-header > .d-flex,
    .card-header.d-flex > .d-flex {
        flex-direction: column;
        align-items: stretch;
    }

    .table-card-header .btn,
    .card-header.d-flex .btn {
        justify-content: center;
    }

    .table-actions {
        flex-wrap: wrap;
        gap: .35rem;
    }

    .table-actions .btn,
    .btn-icon {
        min-width: 40px;
        min-height: 40px;
    }

    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        min-height: 44px;
    }

    .input-group > .form-control,
    .input-group > .form-select,
    .input-group > .btn {
        min-height: 44px;
    }

    .btn {
        min-height: 42px;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

    .toast-container {
        left: .75rem !important;
        right: .75rem !important;
        bottom: max(.75rem, env(safe-area-inset-bottom)) !important;
        width: auto;
        padding: 0 !important;
    }

    .toast-container .toast {
        width: 100%;
        max-width: none;
    }

    .pro-id-card {
        width: min(350px, 100%);
        height: auto;
        aspect-ratio: 350 / 230;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand span {
        display: none;
    }

    #currentUserName {
        display: none;
    }

    .navbar .dropdown-toggle {
        width: 40px;
        min-width: 40px;
        justify-content: center;
        padding: .35rem !important;
    }

    .navbar .dropdown-toggle i {
        margin: 0 !important;
    }

    .main-content > .container-fluid {
        padding: .625rem;
    }

    .login-page {
        min-height: 100dvh;
        align-items: flex-start;
        padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
        overflow-y: auto;
    }

    .login-container {
        max-width: 100%;
        padding-top: .5rem;
    }

    .login-card {
        padding: 1.25rem;
        border-radius: 1.25rem;
    }

    .login-header {
        margin-bottom: 1.25rem;
    }

    .logo-circle {
        width: 64px;
        height: 64px;
        margin-bottom: .875rem;
    }

    .logo-circle i {
        font-size: 1.65rem;
    }

    .login-header h2 {
        font-size: 1.35rem;
    }

    .login-info {
        margin-top: 1rem;
    }

    .table-card-header,
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-inline: .875rem;
    }

    .table-card-header h5 {
        font-size: .95rem;
    }

    .modal-dialog,
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        max-width: calc(100% - .75rem);
        margin: .375rem auto;
    }

    .modal-content {
        border-radius: 1rem;
    }

    .modal-header {
        border-radius: 1rem 1rem 0 0;
    }

    .modal-title {
        font-size: .95rem;
    }

    .pro-id-left {
        width: 82px;
    }

    .pro-id-qr {
        width: 68px;
        height: 68px;
    }

    .pro-id-right {
        padding-right: 8px;
    }

    .pro-id-name {
        font-size: 14px;
    }
}

@media (hover: none) {
    .btn:hover,
    .stat-card:hover,
    .hover-card:hover,
    .insight-card:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .sidebar-overlay {
        display: none !important;
    }
}


/* Keep long API/network messages inside the viewport on narrow screens. */
.toast,
.toast-body,
.alert {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 575.98px) {
    .toast-container .toast {
        max-width: 100%;
    }
}


/* iPhone notch/status-bar safe area support. */
@supports (padding: max(0px)) {
    :root {
        --safe-area-top: env(safe-area-inset-top, 0px);
        --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    }

    .navbar {
        height: calc(var(--navbar-height) + var(--safe-area-top));
        padding-top: var(--safe-area-top);
    }

    .sidebar {
        top: calc(var(--navbar-height) + var(--safe-area-top));
        height: calc(100dvh - var(--navbar-height) - var(--safe-area-top));
    }

    .main-content {
        margin-top: calc(var(--navbar-height) + var(--safe-area-top));
        min-height: calc(100dvh - var(--navbar-height) - var(--safe-area-top));
    }

    .sidebar-overlay {
        inset: calc(var(--navbar-height) + var(--safe-area-top)) 0 0;
    }
}


@media (max-width: 767.98px) {
    /* Inline desktop limits used by a few dynamically-rendered panels. */
    #contentArea [style*="max-width: 48%"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    #contentArea [style*="min-height: 400px"] {
        min-height: 220px !important;
    }

    #contentArea .avatar-circle[style*="width: 150px"],
    #contentArea img[style*="width: 150px"] {
        width: 112px !important;
        height: 112px !important;
        line-height: 112px !important;
    }

    #contentArea .avatar-circle[style*="width: 120px"],
    #contentArea img[style*="width: 120px"] {
        width: 96px !important;
        height: 96px !important;
        line-height: 96px !important;
    }
}


/* Teacher portal attendance/payroll matrix.
   The student and amount columns are fixed on the RTL right edge;
   session/date columns remain in the horizontal scrolling area. */
:root {
    --teacher-student-col-width: 160px;
    --teacher-amount-col-width: 120px;
}

.teacher-attendance-scroll {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    isolation: isolate;
    scrollbar-width: thin;
}

.teacher-attendance-table {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: fixed;
    border-collapse: separate !important;
    border-spacing: 0;
}

.teacher-attendance-table thead {
    position: sticky;
    top: 0;
    z-index: 7;
}

.teacher-attendance-table th,
.teacher-attendance-table td {
    box-sizing: border-box;
    vertical-align: middle !important;
}

.teacher-attendance-table .teacher-sticky-student {
    position: sticky;
    right: 0;
    width: var(--teacher-student-col-width);
    min-width: var(--teacher-student-col-width);
    max-width: var(--teacher-student-col-width);
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.teacher-attendance-table .teacher-sticky-amount {
    position: sticky;
    right: var(--teacher-student-col-width);
    width: var(--teacher-amount-col-width);
    min-width: var(--teacher-amount-col-width);
    max-width: var(--teacher-amount-col-width);
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.teacher-attendance-table .teacher-sticky-head {
    z-index: 9;
    background: #f8f9fa !important;
    box-shadow: -2px 0 4px rgba(15, 23, 42, .12);
}

.teacher-attendance-table .teacher-sticky-body {
    z-index: 6;
    background: #fff !important;
    box-shadow: -2px 0 4px rgba(15, 23, 42, .08);
}

.teacher-attendance-table .teacher-session-date {
    width: 62px;
    min-width: 62px;
    max-width: 62px;
    white-space: nowrap;
    padding-inline: .35rem !important;
    text-align: center;
}

.teacher-session-date-text {
    display: inline-block;
    direction: ltr;
    white-space: nowrap;
    line-height: 1.2;
}

@media (max-width: 767.98px) {
    :root {
        --teacher-student-col-width: 100px;
        --teacher-amount-col-width: 76px;
    }

    .teacher-attendance-scroll {
        margin-inline: -.25rem;
        max-width: calc(100% + .5rem);
    }

    .teacher-attendance-table th,
    .teacher-attendance-table td {
        padding: .35rem .25rem !important;
    }

    .teacher-attendance-table .teacher-sticky-student {
        width: var(--teacher-student-col-width);
        min-width: var(--teacher-student-col-width);
        max-width: var(--teacher-student-col-width);
        font-size: .69rem !important;
    }

    .teacher-attendance-table .teacher-sticky-student strong {
        display: inline;
        font-size: .72rem !important;
        line-height: 1.25;
    }

    .teacher-attendance-table .teacher-sticky-student .badge {
        padding: .1rem .3rem;
        font-size: .62rem;
    }

    .teacher-attendance-table .teacher-sticky-amount {
        right: var(--teacher-student-col-width);
        width: var(--teacher-amount-col-width);
        min-width: var(--teacher-amount-col-width);
        max-width: var(--teacher-amount-col-width);
        font-size: .68rem;
    }

    .teacher-attendance-table .teacher-session-date {
        width: 54px;
        min-width: 54px !important;
        max-width: 54px;
        font-size: .68rem;
    }
}


.teacher-attendance-table-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    margin: 0 0 .65rem;
    padding: .55rem .75rem;
    border: 1px solid rgba(99, 102, 241, .18);
    border-radius: .65rem;
    background: var(--primary-lighter);
    color: var(--primary-dark);
    font-size: .78rem;
    line-height: 1.6;
}

.teacher-attendance-table-toolbar i {
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .teacher-attendance-table-toolbar {
        align-items: flex-start;
        font-size: .72rem;
    }
}


/* Smart attendance scanner panel */
.smart-scanner-panel {
    width: 100%;
    min-width: 0;
}

.smart-scanner-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: .75rem;
}

.smart-qr-reader {
    position: relative;
    width: min(100%, 360px) !important;
    height: 130px !important;
    min-height: 0 !important;
    aspect-ratio: 2.77 / 1;
    margin: 0 auto;
    border: 3px solid var(--success-color);
    border-radius: 1rem;
    overflow: hidden;
    background: #0f172a;
}

/* html5-qrcode creates an internal wrapper; keep it inside the horizontal frame. */
.smart-qr-reader > div,
.smart-qr-reader video,
.smart-qr-reader canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

.smart-qr-reader video {
    object-fit: cover;
    border-radius: .75rem;
}

.smart-qr-reader::after {
    content: 'ضع الخطوط السوداء للـ Barcode أفقياً داخل الإطار';
    position: absolute;
    inset-inline: 0;
    bottom: .45rem;
    z-index: 5;
    padding: .25rem .5rem;
    color: #fff;
    background: rgb(15 23 42 / 72%);
    font-size: .72rem;
    text-align: center;
    pointer-events: none;
}

.smart-scanner-status {
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.scan-result-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 42px;
    margin: .8rem auto .35rem;
    padding: .55rem .75rem;
    border: 1px solid #cbd5e1;
    border-radius: .65rem;
    background: #f8fafc;
    color: #475569;
    font-size: .9rem;
    transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.scan-result-box i {
    color: #64748b;
}

.scan-result-box.scan-detected {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
    box-shadow: 0 0 0 4px rgb(34 197 94 / 18%);
    transform: scale(1.02);
}

.scan-result-box.scan-detected i {
    color: #16a34a;
}

.smart-qr-reader.barcode-detected {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 5px rgb(34 197 94 / 22%), 0 0 22px rgb(34 197 94 / 45%);
}

body.dark-mode .scan-result-box {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

body.dark-mode .scan-result-box.scan-detected {
    background: #14532d;
    border-color: #4ade80;
    color: #dcfce7;
}

#attCameraFallback[hidden] {
    display: none !important;
}

@media (max-width: 767.98px) {
    .smart-qr-reader {
        width: min(100%, 330px) !important;
        height: 110px !important;
        aspect-ratio: 3 / 1;
    }

    .smart-qr-reader::after {
        font-size: .65rem;
    }

    #attStatusBox {
        min-height: 52px !important;
        font-size: .78rem;
    }
}

/* Keep shared table action buttons on one compact line instead of stacking. */
.table-actions,
.table-actions > div,
.data-table td:last-child > .d-flex,
.table-responsive td:last-child > .d-flex {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap !important;
    gap: .25rem;
    white-space: nowrap;
}

.table-actions .btn,
.data-table td:last-child .btn,
.table-responsive td:last-child .btn {
    flex: 0 0 auto;
    margin: 0 !important;
}

@media (max-width: 767.98px) {
    .table-actions .btn,
    .data-table td:last-child .btn,
    .table-responsive td:last-child .btn {
        width: 32px;
        min-width: 32px;
        height: 32px;
        min-height: 32px;
        padding: 0 !important;
        justify-content: center;
        border-width: 1px;
        font-size: .72rem;
    }

    .table-actions .btn i,
    .data-table td:last-child .btn i,
    .table-responsive td:last-child .btn i {
        margin: 0 !important;
    }
}


/* Compact data tables: keep action buttons in one row and preserve readable columns. */
.actions-cell,
.table-actions {
    white-space: nowrap;
    vertical-align: middle !important;
}

.actions-cell > .d-flex,
.table-actions > .d-flex {
    flex-wrap: nowrap !important;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    /* A deliberate horizontal table viewport prevents names and statuses
       from wrapping into very tall rows on narrow screens. */
    #studentsTableContainer .data-table,
    #teachersTableContainer .data-table,
    #parentsTableContainer .data-table,
    #paymentsTableContainer table {
        min-width: 700px;
    }

    #studentsTableContainer .data-table th,
    #studentsTableContainer .data-table td,
    #teachersTableContainer .data-table th,
    #teachersTableContainer .data-table td,
    #parentsTableContainer .data-table th,
    #parentsTableContainer .data-table td,
    #paymentsTableContainer table th,
    #paymentsTableContainer table td {
        padding: .55rem .5rem;
        white-space: nowrap;
    }

    #studentsTableContainer .data-table td:nth-child(2),
    #teachersTableContainer .data-table td:first-child,
    #parentsTableContainer .data-table td:first-child,
    #paymentsTableContainer table td:nth-child(2) {
        white-space: normal;
        min-width: 150px;
    }

    .actions-cell,
    .table-actions {
        min-width: 150px;
    }

    .actions-cell .btn,
    .table-actions .btn {
        width: 32px;
        min-width: 32px;
        height: 32px;
        min-height: 32px;
        padding: 0 !important;
        justify-content: center;
        border-width: 1px;
        font-size: .72rem;
    }

    .actions-cell .btn i,
    .table-actions .btn i {
        margin: 0 !important;
    }

    /* Do not let dashboard cards shrink to a narrow column on phones. */
    .teacher-card,
    .mini-stat-card,
    .action-card {
        width: 100%;
        max-width: none !important;
        min-width: 0;
        padding: 1rem !important;
    }

    .teacher-card h5,
    .teacher-card h6,
    .mini-stat-card,
    .action-card span {
        overflow-wrap: anywhere;
    }
}


/* Dark mode: override Bootstrap table defaults and hard-coded sticky-cell colors. */
body.dark-mode .table-card,
body.dark-mode .table-card-header,
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .list-group-item,
body.dark-mode .bg-light {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .table,
body.dark-mode .table > :not(caption) > * > *,
body.dark-mode .data-table,
body.dark-mode .data-table thead,
body.dark-mode .data-table tbody,
body.dark-mode .teacher-attendance-table {
    --bs-table-bg: var(--card-bg);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .data-table thead th,
body.dark-mode .table-light,
body.dark-mode .teacher-attendance-table thead th,
body.dark-mode .teacher-attendance-table .teacher-sticky-head {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .data-table tbody td,
body.dark-mode .teacher-attendance-table tbody td,
body.dark-mode .teacher-attendance-table .teacher-sticky-body {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .data-table tbody tr:hover,
body.dark-mode .table-hover > tbody > tr:hover > *,
body.dark-mode .teacher-attendance-table tbody tr:hover td {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .row-unpaid {
    background-color: #4a2931 !important;
}

body.dark-mode .row-paid {
    background-color: #183d31 !important;
}

body.dark-mode .row-unpaid:hover {
    background-color: #61323d !important;
}

body.dark-mode .row-paid:hover {
    background-color: #20513f !important;
}

body.dark-mode .teacher-attendance-table .bg-success-subtle,
body.dark-mode .teacher-attendance-table .bg-success {
    color: #d1fae5 !important;
}

body.dark-mode .teacher-attendance-table .bg-danger-subtle,
body.dark-mode .teacher-attendance-table .bg-danger {
    color: #fee2e2 !important;
}

body.dark-mode .teacher-attendance-table .bg-warning-subtle,
body.dark-mode .teacher-attendance-table .bg-warning {
    color: #fef3c7 !important;
}

body.dark-mode .table-card-header h5,
body.dark-mode .table-card-header small,
body.dark-mode .table-card-header label,
body.dark-mode .data-table small,
body.dark-mode .data-table .text-muted,
body.dark-mode .teacher-attendance-table .text-muted {
    color: var(--text-secondary) !important;
}


body.dark-mode .data-table tbody tr.row-unpaid > *,
body.dark-mode .data-table tbody tr.row-unpaid:hover > * {
    background-color: #4a2931 !important;
}

body.dark-mode .data-table tbody tr.row-paid > *,
body.dark-mode .data-table tbody tr.row-paid:hover > * {
    background-color: #183d31 !important;
}


/* PWA install prompt */
.pwa-install-banner {
    position: fixed;
    z-index: 2000;
    inset-inline: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: .75rem;
    max-width: 680px;
    margin-inline: auto;
    padding: .75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 1rem 3rem rgba(15, 23, 42, .28);
}

.pwa-install-icon {
    flex: 0 0 auto;
}

.pwa-install-icon img {
    display: block;
    border-radius: .75rem;
}

.pwa-install-copy {
    display: grid;
    min-width: 0;
    gap: .1rem;
    flex: 1;
}

.pwa-install-copy strong,
.pwa-install-copy span {
    overflow-wrap: anywhere;
}

.pwa-install-copy span {
    color: var(--text-secondary);
    font-size: .78rem;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .pwa-install-banner {
        align-items: flex-start;
        inset-inline: .65rem;
        bottom: calc(.65rem + env(safe-area-inset-bottom));
        padding: .65rem;
    }

    .pwa-install-copy span {
        font-size: .7rem;
    }

    .pwa-install-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pwa-install-actions .btn {
        white-space: nowrap;
    }
}


/* Student card: preserve desktop dimensions on phones so no field is clipped. */
#studentCardContainer {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .25rem;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    #studentCardContainer .pro-id-card {
        width: 350px;
        min-width: 350px;
        max-width: 350px;
        height: 230px;
        min-height: 230px;
        max-height: 230px;
        aspect-ratio: auto;
        flex: 0 0 350px;
    }
}

@media (max-width: 575.98px) {
    #studentCardContainer .pro-id-left {
        width: 100px;
    }

    #studentCardContainer .pro-id-qr {
        width: 80px;
        height: 80px;
    }

    #studentCardContainer .pro-id-right {
        padding-right: 12px;
    }

    #studentCardContainer .pro-id-name {
        font-size: 16px;
    }
}


/* Student card modal: avoid RTL centering from clipping the right edge. */
.student-card-modal-body {
    overflow-x: hidden;
}

#studentCardContainer {
    direction: ltr;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 575.98px) {
    .student-card-modal-body {
        display: block !important;
        padding-inline: .35rem !important;
    }

    #studentCardContainer {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding: .25rem 0;
        scrollbar-width: thin;
    }
}


/* Keep the existing Arabic card appearance while the outer viewport uses LTR scroll coordinates. */
#studentCardContainer .pro-id-card {
    direction: rtl;
}


/* Restore global quick search on tablets and phones without squeezing the navbar. */
@media (max-width: 991.98px) {
    .navbar .search-box {
        display: block !important;
        position: absolute;
        top: calc(var(--navbar-height) - .15rem);
        inset-inline: .75rem;
        width: auto;
        margin: 0 !important;
        z-index: 1095;
    }

    .navbar .search-box input {
        width: 100%;
        height: 36px;
        background: var(--card-bg) !important;
        color: var(--text-primary) !important;
        border: 1px solid var(--border-color);
        box-shadow: 0 .2rem .7rem rgba(15, 23, 42, .12);
    }

    .navbar .search-box input::placeholder {
        color: var(--text-secondary);
    }

    .navbar .search-box > i {
        color: var(--text-secondary);
    }

    .main-content {
        padding-top: 52px;
    }

    .search-dropdown {
        width: 100%;
        max-height: min(55vh, 360px);
        overflow-y: auto;
    }
}

@media (max-width: 575.98px) {
    .navbar .search-box {
        inset-inline: .6rem;
    }

    .navbar .search-box input {
        height: 34px;
        font-size: .74rem;
    }

    .main-content {
        padding-top: 50px;
    }
}


/* Final unified navbar order: menu, school name, quick search, notifications and account on one row. */
@media (max-width: 991.98px) {
    .navbar .container-fluid { flex-wrap: nowrap; gap: .25rem; }
    .navbar > .container-fluid > #sidebarToggle { order: 1; flex: 0 0 auto; }
    .navbar > .container-fluid > .navbar-brand { order: 2; min-width: 0; flex: 0 1 auto; margin-inline: 0 !important; }
    .navbar > .container-fluid > .d-flex.align-items-center { order: 3; flex: 0 0 auto; min-width: 0; }
    .navbar > .container-fluid > .d-flex.align-items-center > .search-box { order: 1; }
    .navbar > .container-fluid > .d-flex.align-items-center > .dropdown { order: 2; }
    .navbar > .container-fluid > .d-flex.align-items-center > .dropdown:last-child { order: 3; }
    .navbar-brand span { display: inline-block; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
    .navbar .search-box { display: block !important; position: relative; inset: auto; width: clamp(115px, 30vw, 185px); flex: 0 1 clamp(115px, 30vw, 185px); min-width: 0; margin-inline: .25rem !important; }
    .navbar .search-box input { width: 100%; height: 32px; padding-inline: 2rem .5rem !important; font-size: .75rem; }
    .navbar .search-box > i { left: .65rem !important; font-size: .7rem; }
    .navbar .search-dropdown { position: absolute; top: calc(100% + .35rem); right: 0; left: auto; width: min(320px, calc(100vw - 1rem)); max-height: 60vh; overflow-y: auto; }
}
@media (max-width: 575.98px) {
    .navbar-brand span { max-width: 68px; }
    .navbar .search-box { width: clamp(112px, 31vw, 150px); flex-basis: clamp(112px, 31vw, 150px); margin-inline: .15rem !important; }
}

/* ========================================================================
   STUDENT CARD PRINT COLORS
   Force browser printers to preserve the card colors and gradients.
   ======================================================================== */
@media print {
    .pro-id-card,
    .pro-id-card *,
    .pro-id-header,
    .pro-id-footer,
    .pro-id-reg-badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .pro-id-header {
        background: linear-gradient(135deg, #1e293b, #4f46e5) !important;
        color: #ffffff !important;
    }

    .pro-id-footer {
        background: #f8fafc !important;
    }

    .pro-id-reg-badge {
        background: #eef2ff !important;
        color: #4f46e5 !important;
    }
}
/* ==========================================
   عداد طلبات التسجيل في القائمة الجانبية
   ========================================== */
.registration-menu-badge {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    margin-inline-start: 10px;
    margin-inline-end: 0;
    
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    
    box-sizing: border-box;
}