/* assets/css/style.css */
/* النسخة النهائية: تصميم متجاوب (Mobile Responsive) + تحسينات الواجهة 📱 */

/* === 1. استيراد الخطوط والمتغيرات === */
@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&display=swap');

:root {
    --primary: #2FAAE1;        
    --primary-hover: #2286B5;
    --dark: #1D3557;           
    --white: #FFFFFF;
    --bg-main: #F8FAFC;        
    --bg-input: #F1F5F9;
    --bg-card: #FFFFFF;
    --border-color: #E2EDF7;
    --text-dark: #1E293B;
    --text-grey: #64748B;
    --icon-bg: #F1F5F9;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --status-success: #10B981;
    --status-warning: #F59E0B;
    
    /* متغيرات الأبعاد */
    --sidebar-width: 260px;
    --header-height: 70px;
}

[data-theme="dark"] {
    --bg-main: #0F172A; --bg-card: #1E293B; --bg-input: #334155;
    --border-color: #334155; --white: #1E293B; --text-dark: #F1F5F9;
    --text-grey: #94A3B8; --dark: #FFFFFF; --icon-bg: #334155;
    --danger-bg: rgba(220, 38, 38, 0.2);
}

/* === 2. الإعدادات العامة === */
body {
    font-family: 'Almarai', sans-serif !important; margin: 0; padding: 0; box-sizing: border-box;
    direction: rtl; text-align: right; background-color: var(--bg-main); color: var(--text-dark);
    overflow-x: hidden; transition: background-color 0.3s, color 0.3s;
}
* { box-sizing: border-box; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mt-50 { margin-top: 50px; }
.bg-slate-50 { background-color: #f8fafc; }

/* === 3. صفحة تسجيل الدخول (محسنة للجوال) === */
.split-screen { display: flex; flex-direction: row; min-height: 100vh; width: 100%; background-color: var(--bg-card); }
.visual-panel { width: 50%; position: relative; background-color: #1D3557; background-image: url('../images/bg.jpg'); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(29, 53, 87, 0.95), rgba(47, 170, 225, 0.85)); z-index: 1; }
.brand-content { position: relative; z-index: 2; color: #FFFFFF; padding: 60px; }
.brand-big-icon { font-size: 80px; margin-bottom: 20px; opacity: 0.9; }
.brand-title { font-size: 36px; font-weight: 800; margin-bottom: 15px; }
.brand-desc { font-size: 16px; line-height: 1.8; opacity: 0.9; max-width: 500px; margin: 0 auto; }
.login-panel { width: 50%; background-color: var(--bg-card); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; position: relative; z-index: 2; }
.login-content { width: 100%; max-width: 420px; }
.brand-logo-img { max-width: 200px; height: auto; margin-bottom: 25px; display: block; margin-left: auto; margin-right: auto; }
.welcome-title { font-size: 28px; font-weight: 800; color: var(--text-dark); margin: 0 0 10px 0; text-align: center; }
.welcome-subtitle { color: var(--text-grey); font-size: 15px; margin-bottom: 40px; text-align: center; }
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 700; color: var(--text-dark); }
.input-container { position: relative; }
.form-input { width: 100%; padding: 16px 16px 16px 45px; background-color: var(--bg-input); border: 1px solid var(--border-color); border-radius: 12px; font-family: 'Almarai', sans-serif; font-size: 15px; color: var(--text-dark); transition: all 0.3s; }
.form-input:focus { outline: none; border-color: var(--primary); background-color: var(--bg-card); box-shadow: 0 0 0 4px rgba(47, 170, 225, 0.15); }
.input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-grey); font-size: 18px; }
.form-input:focus + .input-icon { color: var(--primary); }
.btn-primary { width: 100%; padding: 18px; background-color: var(--primary); color: #FFFFFF; border: none; border-radius: 12px; font-family: 'Almarai', sans-serif; font-size: 16px; font-weight: 700; cursor: pointer; transition: background 0.3s; margin-top: 15px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; text-decoration: none;}
.btn-primary:hover { background-color: var(--primary-hover); }
.login-options { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; align-items: center; }
.login-remember-label { color: var(--text-grey); cursor: pointer; }
.login-forgot-link { color: var(--primary); text-decoration: none; font-weight: bold; }
.login-footer { text-align: center; margin-top: 30px; font-size: 13px; color: var(--text-grey); }
.theme-toggle-absolute { position: absolute; top: 30px; left: 30px; z-index: 10; }

/* === 4. تخطيط لوحة التحكم (Layout & Sidebar) === */
.dashboard-layout { display: flex; min-height: 100vh; position: relative; }

/* القائمة الجانبية */
.sidebar { 
    width: var(--sidebar-width); 
    background-color: var(--bg-card); 
    border-left: 1px solid var(--border-color); 
    display: flex; flex-direction: column; 
    position: fixed; top: 0; bottom: 0; right: 0; 
    z-index: 1000; padding: 20px 0; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.sidebar-brand { text-align: center; padding: 0 20px 30px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.sidebar-brand img { max-width: 140px; height: auto; }
.sidebar-menu { flex-grow: 1; padding: 0 15px; display: flex; flex-direction: column; }
.menu-item { margin-bottom: 5px; }
.menu-link { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 10px; color: var(--text-grey); font-weight: 700; font-size: 14px; }
.menu-link:hover, .menu-link.active { background-color: rgba(47, 170, 225, 0.1); color: var(--primary); }
.menu-link i { font-size: 18px; width: 20px; text-align: center; }
.menu-link[href*="logout.php"]:hover { background-color: var(--danger-bg) !important; color: var(--danger) !important; }

/* المحتوى الرئيسي */
.main-content { 
    flex-grow: 1; 
    margin-right: var(--sidebar-width); 
    padding: 30px; 
    background-color: var(--bg-main); 
    transition: margin-right 0.3s;
    width: 100%;
}

.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 35px; flex-wrap: wrap; gap: 15px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--text-dark); margin: 0; }
.theme-toggle-btn { background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-grey); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.3s; font-size: 18px; }
.theme-toggle-btn:hover { color: var(--primary); border-color: var(--primary); }

/* أزرار وعناصر الجوال (مخفية في الديسك توب) */
.menu-toggle-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-dark); cursor: pointer; padding: 5px; margin-left: 15px; }
.close-sidebar-btn { display: none; position: absolute; top: 15px; left: 15px; background: none; border: none; color: var(--text-grey); font-size: 1.2rem; cursor: pointer; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 900; backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.3s; }

/* === 5. البطاقات والشبكات (Grids) === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 25px; margin-bottom: 35px; }
.stat-card { background: var(--bg-card); padding: 25px; border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 2px 15px rgba(0,0,0,0.02); display: flex; justify-content: space-between; align-items: center; transition: transform 0.2s, background-color 0.3s, border-color 0.3s; }
.stat-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.stat-info h3 { font-size: 14px; color: var(--text-grey); margin: 0 0 8px 0; }
.stat-info .stat-number { font-size: 26px; font-weight: 800; color: var(--text-dark); margin: 0; }
.stat-icon { width: 55px; height: 55px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.icon-primary { background: rgba(47, 170, 225, 0.1); color: var(--primary); }
.icon-success { background: rgba(16, 185, 129, 0.1); color: var(--status-success); }
.icon-warning { background: rgba(245, 158, 11, 0.1); color: var(--status-warning); }
.icon-danger  { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* === 6. الجداول (Tables) === */
.table-container { background: var(--bg-card); padding: 25px; border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 2px 15px rgba(0,0,0,0.02); transition: background-color 0.3s, border-color 0.3s; overflow-x: auto; /* مهم للتجاوب */ }
.table-header { margin-bottom: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.table-title { font-size: 18px; font-weight: 800; color: var(--text-dark); margin: 0; }
.custom-table, .data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: 8px; overflow: hidden; min-width: 600px; /* لمنع انكماش الجدول */ }
.custom-table th, .data-table th { padding: 16px; text-align: right; border-bottom: 1px solid var(--border-color); color: var(--text-grey); font-size: 13px; font-weight: 700; background: var(--bg-input); white-space: nowrap; }
.custom-table td, .data-table td { padding: 16px; text-align: right; border-bottom: 1px solid var(--border-color); color: var(--text-dark); font-weight: 600; font-size: 14px; white-space: nowrap; }
.custom-table tr:hover, .data-table tr:hover { background-color: var(--bg-input); transform: scale(1.002); transition: 0.2s; }
.status-badge { padding: 6px 14px; border-radius: 50px; font-size: 12px; font-weight: 800; display: inline-block; }
.btn-details { background-color: var(--bg-input); color: var(--text-grey); padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; display: inline-block; }
.btn-details:hover { background-color: var(--primary); color: #FFFFFF; }

.systems-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px; }
.system-card { background: var(--white); padding: 25px; border-radius: 12px; border: 1px solid var(--border-color); display: flex; align-items: center; gap: 15px; text-decoration: none; transition: 0.3s; position: relative; overflow: hidden; }
.system-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.system-icon-box { width: 55px; height: 55px; background: rgba(47, 170, 225, 0.1); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--primary); transition: 0.3s; flex-shrink: 0; }
.system-card:hover .system-icon-box { background: var(--primary); color: #fff; }
.system-info h3 { margin: 0 0 5px; font-size: 16px; color: var(--text-dark); font-weight: 800; }
.system-info p { margin: 0; font-size: 12px; color: var(--text-grey); }

.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 30px; }
.module-card { background: var(--bg-card); padding: 25px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); text-align: center; transition: 0.3s; cursor: pointer; text-decoration: none; color: var(--text-dark); border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; gap: 15px; }
.module-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); border-color: var(--primary); }
.module-icon { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; background: rgba(47, 170, 225, 0.1); color: var(--primary); }
.module-title { font-weight: bold; font-size: 1.1rem; }

.icon-green { background: #f0fdf4; color: #16a34a; }
.icon-orange { background: #fff7ed; color: #ea580c; }
.icon-red { background: #fef2f2; color: #dc2626; }
.icon-blue { background: #f0f9ff; color: #0284c7; }

/* تبويبات */
.tabs-header { display: flex; gap: 20px; border-bottom: 2px solid #e2e8f0; margin-top: 30px; margin-bottom: 20px; overflow-x: auto; white-space: nowrap; padding-bottom: 5px; }
.tab-btn { padding: 10px 20px; font-size: 1rem; font-weight: bold; color: #64748b; background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer; transition: all 0.3s; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--white); }
.tab-content { display: none; animation: fadeIn 0.3s ease-in-out; }
.tab-content.active { display: block; }

/* === 7. تنسيقات المعالج (Wizard) === */
.wizard-container { max-width: 900px; margin: 30px auto; padding: 0 15px; }
.start-screen { text-align: center; padding: 60px; background: var(--white); border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-top: 40px; }
.teacher-select-box { max-width: 400px; margin: 0 auto; }
.criterion-card { background: var(--white) !important; border-radius: 16px; padding: 35px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid var(--border-color); margin-bottom: 25px; position: relative; }
.rating-options { display: flex; justify-content: center; gap: 15px; margin: 25px 0; flex-direction: row-reverse; flex-wrap: wrap; }
.rating-btn { width: 55px; height: 55px; border-radius: 50%; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; color: var(--text-grey); cursor: pointer; transition: 0.3s; border: 2px solid transparent; }
.rating-btn.active { background: var(--primary); color: #fff; transform: scale(1.1); box-shadow: 0 5px 15px rgba(47, 170, 225, 0.3); }
.rubric-box { background: #f8fafc; border-right: 5px solid #cbd5e1; padding: 20px; border-radius: 8px; margin-bottom: 30px; min-height: 80px; display: flex; align-items: center; color: #475569; font-size: 1.05rem; line-height: 1.6; }
.rubric-box.highlight { background: #ecfdf5; border-color: #10b981; color: #065f46; }
.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid #f1f5f9; padding-top: 25px; margin-top: 10px; }
.feedback-item textarea { width: 100%; height: 85px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; resize: none; }
.wizard-footer { margin-top: 40px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.active-teacher-bar { background: var(--dark); color: #fff; padding: 15px 25px; border-radius: 12px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.atb-subject { background: rgba(255,255,255,0.15); padding: 5px 15px; border-radius: 20px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }

/* === 8. إضافات متنوعة === */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-content { background: var(--bg-card); padding: 25px; border-radius: 15px; width: 90%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); animation: slideUp 0.3s ease-out; }
.alert-box { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; display: flex; align-items: center; gap: 10px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.upload-preview-container { border: 2px dashed var(--border-color); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; background-color: var(--bg-input); height: 180px; display: flex; align-items: center; justify-content: center; flex-direction: column; overflow: hidden; }
.upload-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.teacher-history-link { display: inline-flex; align-items: center; gap: 8px; color: #1e293b; text-decoration: none; padding: 4px 10px; border-radius: 6px; transition: all 0.2s ease; border: 1px solid transparent; }
.teacher-history-link:hover { background-color: #f1f5f9; border-color: #cbd5e1; color: var(--primary); }
.history-label { font-size: 0.7rem; background: #dbeafe; color: #1e40af; padding: 2px 6px; border-radius: 4px; font-weight: normal; }
.publish-badge { padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; display: inline-flex; align-items: center; gap: 8px; }
.is-published { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.not-published { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* === 9. تنسيقات التقرير الاحترافي === */
.page-summary { position: relative; min-height: 297mm; padding: 40px; box-sizing: border-box; background: #fff; page-break-after: always; }
.page-details { position: relative; min-height: 297mm; padding: 40px; box-sizing: border-box; background: #fff; height: auto; }
.print-header-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.report-content { position: relative; z-index: 1; margin-top: 140px; margin-bottom: 80px; }
.report-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border: 1px solid #e2e8f0; padding: 15px; background: rgba(255,255,255,0.95); border-radius: 8px; margin-bottom: 30px; }
.report-info-grid div { font-size: 0.95rem; color: var(--text-dark); }
.report-info-grid strong { color: var(--primary); }
.report-score-box { text-align: center; margin: 30px 0; padding: 25px; border-radius: 12px; background: linear-gradient(135deg, var(--dark), #2c3e50); color: #fff; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.score-title { font-size: 1.1rem; opacity: 0.8; margin-bottom: 10px; }
.score-value { font-size: 2.8rem; font-weight: 800; line-height: 1; }
.score-max { font-size: 1.5rem; opacity: 0.6; }
.score-percent { margin-top: 15px; display: inline-block; background: var(--primary); color: #fff; padding: 5px 20px; border-radius: 50px; font-weight: bold; font-size: 1.1rem; }
.score-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score-final-percent { font-size: 1rem; color: #fff; background: rgba(255, 255, 255, 0.15); padding: 4px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.2); }
.score-text-badge { font-size: 1.1rem; background: rgba(255, 255, 255, 0.2); padding: 5px 15px; border-radius: 15px; margin-top: 5px; }
.summary-table { width: 100%; border-collapse: collapse; margin-top: 20px; border: 2px solid var(--dark); }
.summary-table th { background-color: var(--dark); color: #fff; padding: 12px; text-align: center; font-size: 0.9rem; }
.summary-table td { padding: 10px; border: 1px solid #cbd5e1; text-align: center; font-weight: bold; font-size: 0.95rem; }
.summary-table tr:nth-child(even) { background-color: #f8fafc; }
.criterion-detail-card { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 25px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05); overflow: hidden; page-break-inside: avoid; }
.cd-header { background: #f0f9ff; border-bottom: 2px solid var(--primary); padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.cd-title { font-size: 1.1rem; font-weight: 800; color: var(--dark); }
.cd-score-badge { background: var(--primary); color: #fff; padding: 5px 15px; border-radius: 20px; font-weight: bold; }
.cd-body { padding: 20px; }
.cd-rubric { background: #f8fafc; padding: 15px; border-radius: 6px; font-style: italic; color: #475569; margin-bottom: 15px; border-right: 4px solid var(--primary); }
.cd-notes { color: #dc2626; font-size: 0.9rem; margin-top: 10px; }
.cd-notes-block { margin-top: 5px; font-size: 0.85rem; border-top: 1px dashed #ccc; padding-top: 5px; }
.cd-label { font-weight: bold; text-decoration: underline; margin-bottom: 3px; display: block; font-size: 0.85rem; }
.signature-section { margin-top: 50px; display: flex; justify-content: space-between; padding-top: 20px; position: relative; }
.sig-box { text-align: center; width: 220px; position: relative; }
.sig-line { border-top: 1px dashed var(--dark); margin-top: 60px; }
.signature-img { max-width: 150px; max-height: 60px; display: block; margin: 0 auto; position: absolute; bottom: 5px; left: 0; right: 0; }
.stamp-img { position: absolute; top: -20px; left: 450px; width: 120px; height: auto; opacity: 0.8; transform: rotate(-10deg); z-index: 10; }

@media print {
    @page { margin: 0; size: A4; }
    body { background: #fff; margin: 0; padding: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .no-print, .sidebar, .top-header, .tabs-header { display: none !important; }
    .print-header-img { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: -1; }
    .page-summary, .page-details { box-shadow: none; margin: 0; width: 100%; height: auto; min-height: auto; background: transparent !important; }
    h1 { font-size: 1.4rem !important; margin-bottom: 5px !important; }
    .report-content { margin-top: 110px !important; margin-bottom: 30px !important; }
    .report-info-grid { margin-bottom: 10px; padding: 5px; }
    .report-score-box { margin: 10px 0; padding: 10px; background: #1e293b !important; }
    .score-content { flex-direction: row; justify-content: center; gap: 30px; align-items: center; }
    .score-value { font-size: 1.4rem; }
    .score-percent { font-size: 1.2rem; }
    .summary-table { margin-top: 10px; }
    .summary-table th, .summary-table td { padding: 4px; font-size: 0.8rem; }
    .signature-section { margin-top: 15px; }
    .sig-line { margin-top: 50px; }
    .page-summary { page-break-after: always; }
}
@media screen {
    .page-summary, .page-details { max-width: 210mm; margin: 20px auto 40px auto; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 1px solid #e2e8f0; }
}

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

.live-score-badge { background-color: var(--primary); color: var(--white); padding: 6px 20px; border-radius: 50px; font-size: 0.95rem; font-weight: bold; box-shadow: 0 4px 10px rgba(47, 170, 225, 0.2); display: flex; align-items: center; gap: 10px; }

/* === 10. إضافات خاصة بصفحة المعلمين === */
.status-toggle { position: relative; display: inline-block; width: 40px; height: 20px; }
.status-toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }
.search-box { position: relative; max-width: 300px; width: 100%; }
.search-box input { width: 100%; padding: 10px 35px 10px 10px; border-radius: 20px; border: 1px solid #ddd; outline: none; }
.search-box i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #aaa; }

/* === 11. إضافات شريط الفلترة الجديد === */
.filter-bar-container { background: var(--bg-card); padding: 15px 20px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.03); margin-bottom: 25px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0; }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 0.85rem; font-weight: bold; color: var(--text-grey); }
.filter-select { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 6px; min-width: 150px; background-color: var(--bg-input); font-family: inherit; color: var(--text-dark); }
.btn-filter-back { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-grey); margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 8px; font-size: 13px; font-weight: bold; cursor: pointer; }
.btn-filter-back:hover { background: var(--bg-card); color: var(--text-dark); border-color: #cbd5e1; }
.btn-filter-search { margin: 0; padding: 9px 20px; height: 38px; display: inline-flex; align-items: center; gap: 8px; background-color: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; }
.btn-filter-search:hover { background-color: var(--primary-hover); }

/* === 12. إضافات إدارة الخطط (جديد) === */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}
.plan-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}
.plan-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(47, 170, 225, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 20px;
}
.plan-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 10px;
}
.plan-desc {
    color: var(--text-grey);
    font-size: 0.9rem;
    line-height: 1.6;
}
.plan-card.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--bg-input);
}
.plan-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
}
.coming-soon {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #cbd5e1;
    color: #475569;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

/* === 13. تنسيقات صفحة جدول الزيارات === */
.page-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.btn-whatsapp {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-whatsapp:hover {
    background-color: #128C7E;
    color: white;
}

/* تنسيق النافذة المنبثقة (Modal) */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    justify-content: center; align-items: center;
    backdrop-filter: blur(2px);
}
.modal-content {
    background-color: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
    from {transform: translateY(-50px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}
.close-modal {
    position: absolute; top: 15px; left: 15px; font-size: 20px; cursor: pointer; color: var(--text-grey);
}
.close-modal:hover { color: var(--danger); }

.form-row { margin-bottom: 15px; }
.form-row label { display: block; margin-bottom: 5px; font-weight: bold; color: var(--text-dark); }
.form-row select, .form-row input { 
    width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; font-family: inherit; background-color: var(--bg-input); color: var(--text-dark);
}
.form-row select:focus, .form-row input:focus {
    border-color: var(--primary); outline: none;
}

/* === 14. تنسيقات طباعة التقارير (mPDF) === */
.full-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    object-fit: fill;
}
.header-right {
    position: absolute;
    top: 10mm;
    right: 10mm;
    width: 80mm;
    text-align: center;
    color: #000;
    font-size: 10pt;
    line-height: 1.5;
    font-weight: bold;
    direction: rtl;
    font-family: 'almarai', sans-serif;
}
.school-line { margin-top: 4px; }

/* === 15. تنسيقات صفحة الصلاحيات === */
.perm-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 80px; 
}
.role-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-weight: bold;
}
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.checkbox-container:hover { background-color: #f1f5f9; }
.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}
.checkbox-label { font-size: 0.9rem; color: var(--text-color); user-select: none; }
.sticky-save-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 400px;
    justify-content: space-between;
}
.sticky-save-bar .info-text { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.btn-save-action {
    background-color: #10B981;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}
.btn-save-action:hover { background-color: #059669; }

/* === 16. تنسيقات رسائل الخطأ (الصلاحيات) === */
.permission-denied-container {
    font-family: 'Almarai', sans-serif;
    text-align: center;
    padding: 50px;
    background-color: #f8fafc;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0;
}
.permission-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
}
.permission-title { color: #DC2626; margin-top: 0; font-size: 1.5rem; margin-bottom: 15px; }
.permission-text { color: #475569; font-size: 1.1rem; line-height: 1.6; margin-bottom: 15px; }
.permission-code { color: #64748b; font-size: 0.9rem; background: #f1f5f9; padding: 8px 15px; border-radius: 6px; display: inline-block; }
.permission-actions { margin-top: 30px; display: flex; gap: 10px; justify-content: center; }
.btn-back { background-color: #64748b; color: white; text-decoration: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; }
.btn-home { background-color: #334155; color: white; text-decoration: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; }

/* === 17. تنسيقات صفحة سجل المعلم === */
.teacher-profile-header { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.teacher-avatar {
    background: var(--bg-card);
    padding: 10px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.teacher-avatar i { font-size: 1.5rem; color: var(--primary); }
.teacher-name { margin-bottom: 2px; font-size: 1.3rem; margin-top: 0; }
.teacher-meta { color: var(--text-grey); margin: 0; font-size: 0.9rem; }
.teacher-meta span { margin-left: 15px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chart-card { background: #fff; margin-bottom: 30px; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.chart-container { height: 300px; width: 100%; }
.section-title-wrap { margin-bottom: 20px; }
.section-title { color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: 10px; display: inline-block; margin: 0; font-size: 1.2rem; }
.section-title.archive { color: #64748b; border-bottom-color: #cbd5e1; }
.empty-state-box { text-align: center; padding: 30px; background: white; border-radius: 12px; border: 1px solid #e2e8f0; }
.period-card { margin-bottom: 20px; border: 1px solid #bfdbfe; border-radius: 12px; overflow: hidden; padding: 0; background: white; }
.period-card.archive { border-color: #e2e8f0; opacity: 0.95; }
.period-header { background: #eff6ff; padding: 15px 20px; border-bottom: 1px solid #bfdbfe; }
.period-card.archive .period-header { background: #f1f5f9; border-bottom-color: #e2e8f0; }
.period-title { margin: 0; color: #1e40af; font-size: 1.1rem; }
.period-card.archive .period-title { color: #475569; font-size: 1rem; }
.year-badge { font-weight: normal; font-size: 0.9rem; background: #cbd5e1; padding: 2px 8px; border-radius: 4px; margin-left: 10px; }
.eval-row-draft { background-color: #fffbeb; }
.score-high { color: #166534; font-weight: bold; }
.score-mid { color: #d97706; font-weight: bold; }
.score-low { color: #dc2626; font-weight: bold; }
.badge-light { font-size: 0.85rem; background: #f1f5f9; padding: 2px 8px; border-radius: 4px; }
.table-responsive { overflow-x: auto; }
.border-none { border: none !important; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-published { background: #dcfce7; color: #166534; }
.status-review { background: #ffedd5; color: #9a3412; }
.btn-action { padding: 5px 10px; font-size: 0.8rem; width: auto; border: none; border-radius: 4px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; transition: 0.2s; }
.btn-view { background: #e2e8f0; color: #334155; }
.btn-edit { background: #f59e0b; color: white; }
.btn-delete { background: #fee2e2; color: #991b1b; }
.btn-publish { background: #dcfce7; color: #166534; }
.btn-unpublish { background: #fee2e2; color: #991b1b; }
.card-title { margin-top: 0; color: var(--text-dark); font-size: 1.1rem; margin-bottom: 15px; }
.header-controls { display: flex; gap: 10px; align-items: center; background: #fff; padding: 10px 15px; border-radius: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex-wrap: wrap; }
.academic-year-badge { font-size: 0.85rem; background: #e2e8f0; padding: 4px 10px; border-radius: 6px; color: #475569; margin-right: 10px; font-weight: normal; display: inline-block; vertical-align: middle; }

/* ==========================================================================
   📱 قواعد التجاوب (Media Queries) - الأهم للجوال
   ========================================================================== */

/* للأجهزة اللوحية والموبايل (أقل من 992px) */
@media (max-width: 992px) {
    /* إخفاء السايدبار افتراضياً بتحريكه لليمين */
    .sidebar {
        transform: translateX(100%); 
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    }

    /* إلغاء هامش المحتوى ليمتد لكامل الشاشة */
    .main-content {
        margin-right: 0;
        padding: 20px;
    }

    /* إظهار زر القائمة (Hamburger) */
    .menu-toggle-btn {
        display: block;
    }

    /* إظهار زر الإغلاق داخل القائمة */
    .close-sidebar-btn {
        display: block;
    }

    /* حالة التفعيل: إظهار القائمة */
    .sidebar.active {
        transform: translateX(0);
    }

    /* حالة التفعيل: إظهار الخلفية المظللة */
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* تعديل شاشة الدخول */
    .split-screen {
        flex-direction: column;
    }
    .visual-panel {
        width: 100%;
        height: 250px;
        min-height: 250px;
    }
    .login-panel {
        width: 100%;
        padding: 30px 20px;
    }
    .sticky-save-bar {
        width: 90%;
        min-width: auto;
        bottom: 20px;
    }
}

/* للجوالات الصغيرة (أقل من 576px) */
@media (max-width: 576px) {
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .top-header > div:first-child {
        display: flex;
        align-items: center;
        width: 100%;
    }
    .page-title {
        font-size: 20px;
    }
    .stats-grid {
        grid-template-columns: 1fr; /* عمود واحد */
    }
    .modules-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* تصغير البطاقات */
    }
    .module-card {
        padding: 15px;
    }
    .module-icon {
        width: 50px; height: 50px; font-size: 20px;
    }
    .module-title {
        font-size: 0.95rem;
    }
    .filter-bar-container {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group, .filter-select, .btn-filter-search {
        width: 100%;
    }
    .report-info-grid {
        grid-template-columns: 1fr;
    }
    .score-content {
        flex-direction: column;
    }
    .rating-options {
        gap: 8px;
    }
    .rating-btn {
        width: 40px; height: 40px; font-size: 1rem;
    }
    .feedback-grid {
        grid-template-columns: 1fr;
    }
    .active-teacher-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}