/* 
 * تطوير وتصميم: عماد سعيد محمّد 0507825450
 * ملف الهوية البصرية المطور (V3 - إصدار متكامل)
 */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --primary: #1e3a8a;       
    --primary-hover: #172554;
    --secondary: #d97706;     
    --secondary-hover: #b45309;
    --bg-body: #f8fafc;       
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
    --radius: 12px;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    direction: rtl;
    line-height: 1.6;
}

/* =========================================
   شاشة تسجيل الدخول
========================================= */
.login-container {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    margin: 5vh auto;
    text-align: center;
    border-top: 5px solid var(--secondary);
}

.platform-title { color: var(--primary); font-size: 28px; font-weight: 800; margin-bottom: 5px; }

.login-tabs { display: flex; background: #f1f5f9; border-radius: 8px; padding: 5px; margin-bottom: 25px; }
.tab-btn { flex: 1; padding: 10px; border: none; background: transparent; font-family: inherit; font-weight: 700; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: 0.3s; }
.tab-btn.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* =========================================
   تنسيقات النماذج
========================================= */
.form-group { margin-bottom: 20px; text-align: right; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 700; color: var(--text-main); font-size: 14px; }
input, select, textarea { width: 100%; padding: 14px; border: 1px solid var(--border-color); border-radius: 8px; background-color: #f8fafc; font-family: inherit; font-size: 14px; color: var(--text-main); box-sizing: border-box; transition: all 0.3s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); background-color: var(--bg-surface); outline: none; box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1); }

.submit-btn, .btn-export, .logout-btn { display: inline-block; width: 100%; padding: 14px; border: none; border-radius: 8px; font-family: inherit; font-weight: 700; font-size: 15px; cursor: pointer; transition: all 0.3s ease; text-align: center; }
.submit-btn { background: var(--primary); color: white; }
.submit-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }
.btn-export { background: var(--secondary); color: white; width: auto; padding: 10px 20px;}
.btn-export:hover { background: var(--secondary-hover); }

/* أزرار الإجراءات في الجداول */
.action-btn { padding: 6px 10px; border: none; border-radius: 6px; color: white; font-family: inherit; font-weight: 700; font-size: 12px; cursor: pointer; margin-right: 5px; transition: 0.2s; }
.btn-del { background: #ef4444; } .btn-del:hover { background: #dc2626; }
.btn-edit { background: #f59e0b; } .btn-edit:hover { background: #d97706; }
.btn-card { background: #10b981; } .btn-card:hover { background: #059669; }
.btn-view { background: var(--primary); } .btn-view:hover { background: var(--primary-hover); }

/* =========================================
   لوحة التحكم (Admin Dashboard)
========================================= */
.admin-body { display: flex; height: 100vh; overflow: hidden; background: var(--bg-body); }
.sidebar { width: 280px; background: var(--bg-surface); border-left: 1px solid var(--border-color); display: flex; flex-direction: column; box-shadow: var(--shadow-sm); z-index: 10; }
.sidebar-header { padding: 30px 20px; text-align: center; border-bottom: 1px solid var(--border-color); }
.sidebar-header h3 { color: var(--primary); font-weight: 800; margin: 0; font-size: 22px;}
.sidebar-header p { color: var(--text-muted); font-size: 13px; margin: 5px 0 0 0; font-weight: 500;}

.nav-links { list-style: none; padding: 15px 0; margin: 0; flex-grow: 1; }
.nav-links li a { display: block; padding: 16px 25px; color: var(--text-muted); text-decoration: none; font-weight: 700; border-right: 4px solid transparent; transition: 0.2s; }
.nav-links li.active a, .nav-links li a:hover { background: #f1f5f9; color: var(--primary); border-right-color: var(--secondary); }

.main-content { flex-grow: 1; padding: 30px 40px; overflow-y: auto; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.top-bar h2 { margin: 0; color: var(--primary); font-size: 24px; font-weight: 800;}
.dev-credit { font-size: 12px; color: var(--text-muted); background: var(--bg-surface); padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border-color); font-weight: 700; }

.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.card { background: var(--bg-surface); padding: 25px; border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--border-color); text-align: right; border-right: 4px solid var(--primary); }
.card h4 { color: var(--text-muted); margin: 0 0 10px 0; font-size: 15px; }
.card span { font-size: 32px; font-weight: 800; color: var(--primary); }

.admin-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; }
@media (max-width: 1100px) { .admin-grid { grid-template-columns: 1fr; } }

.admin-card { background: var(--bg-surface); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--border-color); }
.admin-card h4 { margin: 0 0 25px 0; color: var(--primary); font-size: 18px; font-weight: 800; }

.admin-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.admin-table th, .admin-table td { padding: 15px; text-align: right; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.admin-table th { color: var(--text-muted); font-weight: 700; background: #f8fafc; }
.admin-table tbody tr:hover { background: #f1f5f9; }

.code-badge { background: #e0f2fe; color: #0369a1; padding: 6px 12px; border-radius: 20px; font-weight: 800; font-family: monospace; font-size: 15px; }

/* =========================================
   بوابة الطالب والنافذة المنبثقة (إصلاح الخلل)
========================================= */
.student-header { background: var(--bg-surface); padding: 20px 40px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); margin-bottom: 30px; }
.lesson-card { background: var(--bg-surface); padding: 30px 20px; border-radius: var(--radius); box-shadow: var(--shadow-md); text-align: center; border: 1px solid var(--border-color); transition: all 0.3s ease; cursor: pointer; }
.lesson-card:hover { border-color: var(--secondary); transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.9); backdrop-filter: blur(5px); overflow-y: auto; }
.modal-content { background-color: var(--bg-surface); margin: 3% auto; padding: 30px; border-radius: var(--radius); width: 90%; max-width: 800px; position: relative; border-top: 5px solid var(--secondary); animation: fadeInDown 0.4s; }
.close-btn { position: absolute; top: 15px; left: 20px; color: #94a3b8; font-size: 28px; font-weight: bold; cursor: pointer; transition: 0.3s; z-index: 10; }
.close-btn:hover { color: #ef4444; }

.content-section { display: none; animation: fadeIn 0.4s ease; }
.content-section.active { display: block; }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* إخفاء قالب الشهادة وبطاقة الترحيب */
.hidden-template { position: absolute; left: -9999px; top: -9999px; background: #fff; box-sizing: border-box; direction: rtl; font-family: 'Tajawal', sans-serif; }