/* تعديل الـ Body عشان يسمح للهيدر ياخد العرض كامل */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    text-align: right;
    
    /* إعدادات الفوتر والهيدر */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: stretch; /* مهم جداً: بيخلي الهيدر ياخد عرض الشاشة */
}

/* تعديل عشان صفحة اللوجن تفضل في النص */
.login-container {
    margin: auto; /* بيوسطن البوكس في نص الشاشة */
    background-color: #ffffff;
    padding: 3rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    max-width: 450px;
    width: 90%;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
}

main p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 2rem;
}

/* تصميم زر جوجل */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4285F4; /* لون جوجل الأزرق */
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.google-btn:hover {
    background-color: #357ae8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn img {
    width: 20px;
    height: 20px;
    margin-left: 12px; /* في العربي بنعكس الاتجاه */
    background-color: white;
    border-radius: 50%;
    padding: 2px;
}
/*
-----------------------------------
 تنسيقات صفحة الكورس (الجديدة)
-----------------------------------
*/

.course-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 2rem;
}

.course-content h1 {
    font-size: 2.2rem;
    margin-top: 0;
}

.course-content p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
}

/* ده مجرد شكل مؤقت لمكان الفيديو */
.video-placeholder {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* (عشان يديك نسبة 16:9) */
    background-color: #eee;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
}

.video-placeholder p {
    font-size: 1.5rem;
    color: #999;
    font-weight: 500;
}
/*
-----------------------------------
 تنسيقات قائمة الدروس (الجديدة)
-----------------------------------
*/
.lectures-container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 2rem;
}

.lectures-container h2 {
    margin-top: 0;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.lectures-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

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

.lecture-item:hover {
    background-color: #f9f9f9;
}

.lecture-item::before {
    /* (أيقونة تشغيل بسيطة) */
    content: '▶'; 
    font-size: 10px;
    margin-left: 15px; /* (هتبقى يمين في العربي) */
    color: #4285F4;
}

/*
-----------------------------------
 تنسيقات صفحة الدرس (الجديدة)
-----------------------------------
*/
.lecture-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 2rem;
}

.lecture-content h1 {
    font-size: 2.2rem;
    margin-top: 0;
}

/* (جديد) تنسيق الفيديو ليناسب الشاشة */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    margin: 2rem 0;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
/*
-----------------------------------
 تنسيقات أزرار التنقل (الجديدة)
-----------------------------------
*/
.lecture-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 1.5rem;
}

.nav-btn {
    background-color: #f0f0f0;
    color: #333;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.nav-btn:hover {
    background-color: #e0e0e0;
}

.nav-btn.next {
    background-color: #4285F4;
    color: white;
}

.nav-btn.next:hover {
    background-color: #357ae8;
}

/* كلاس عشان نخفي الزرار لو مش موجود */
.nav-btn.hidden {
    visibility: hidden;
}

/*
-----------------------------------
 تنسيقات صفحة الدرس (تعديل) - إضافة قائمة جانبية
-----------------------------------
*/
.lecture-layout {
    display: flex;
    flex-direction: row-reverse; /* (عشان القائمة تبقى يمين في العربي) */
    gap: 2rem;
    align-items: flex-start;
}

.lecture-main {
    flex: 3; /* (الجزء الرئيسي ياخد 3 أجزاء) */
}

.lecture-sidebar {
    flex: 1; /* (القائمة تاخد جزء واحد) */
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    position: sticky; /* (عشان تثبت وإنت بتنزل) */
    top: 2rem;
}

.lecture-sidebar h3 {
    padding: 1rem 1.5rem;
    margin: 0;
    border-bottom: 2px solid #f0f0f0;
}

/* (هنستخدم نفس تصميم قائمة الدروس من صفحة الكورس) */
.lecture-sidebar .lectures-list {
    max-height: 70vh; /* (ارتفاع معين عشان الـ scroll) */
    overflow-y: auto;
}

.lecture-sidebar .lecture-item.active {
    background-color: #e0eafc; /* (لون لتمييز الدرس الحالي) */
    font-weight: bold;
}

/* (تعديل بسيط عشان نشيل البوكس 
 من المحتوى الرئيسي بما إنه بقى في عمود لوحده) 
*/
.lecture-content {
    box-shadow: none;
    padding: 0;
    margin: 0;
}
/*
-----------------------------------
 تنسيق الدرس المكتمل (الجديد)
-----------------------------------
*/
.lecture-item.completed {
    color: #555;
    background-color: #f0fff0; /* (خلفية خضراء فاتحة) */
}

/* (تغيير الأيقونة لعلامة صح) */
.lecture-item.completed::before {
    content: '✔'; 
    color: #4CAF50; /* (أخضر) */
    font-size: 14px;
}

/*
-----------------------------------
 تنسيقات لوحة التحكم (Admin)
-----------------------------------
*/
#coursesTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

#coursesTable th,
#coursesTable td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-align: right;
}

#coursesTable th {
    background-color: #f9f9f9;
    font-weight: 600;
}

#coursesTable tbody tr:hover {
    background-color: #f7f7f7;
}

/* (هندي لأزرار التعديل والحذف نفس شكل أزرار التنقل) */
#coursesTable .nav-btn {
    padding: 5px 10px;
    font-size: 0.9rem;
    text-decoration: none;
}

#coursesTable .delete-btn {
    background-color: #f44336;
    color: white;
    border: none;
    cursor: pointer;
    margin-right: 5px; /* (مسافة بين الأزرار) */
}

#coursesTable .delete-btn:hover {
    background-color: #d32f2f;
}
/*
-----------------------------------
 تنسيق فورم الإضافة (Admin)
-----------------------------------
*/
#addCourseForm {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

#addCourseForm h2 {
    margin-top: 0;
}

#addCourseForm .form-group {
    margin-bottom: 1rem;
}

#addCourseForm .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

#addCourseForm .form-group input[type="text"],
#addCourseForm .form-group input[type="number"],
#addCourseForm .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box; /* (عشان الـ padding ميأثرش على العرض) */
}

#addCourseForm .form-group textarea {
    min-height: 80px;
    resize: vertical;
}

#addCourseForm .submit-btn {
    background-color: #4CAF50; /* (أخضر) */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

#addCourseForm .submit-btn:hover {
    background-color: #45a049;
}

/* ========================================
   Global Layout Fixes
========================================
*/
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* عشان الفوتر ينزل تحت خالص */
}

main, .container {
    flex: 1; /* المحتوى ياخد باقي المساحة */
    width: 100%; /* تأكيد العرض */
    box-sizing: border-box;
}

/* ========================================
   Professional Header (Sticky)
========================================
*/
.main-navbar {
    background-color: rgba(255, 255, 255, 0.95); /* شبه شفاف */
    backdrop-filter: blur(10px); /* تأثير الزجاج */
    padding: 0.8rem 2rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky; /* يلزق فوق */
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #eee;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover, .nav-link.active {
    color: #4285F4;
}

.admin-badge {
    background-color: #ff9800;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 5px;
}

/* ========================================
   Professional Footer
========================================
*/
.main-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 3rem 2rem 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    text-align: right;
}

.footer-section h3 {
    color: #4285F4;
    margin-bottom: 1rem;
}

.footer-section p, .footer-section a {
    color: #bdc3c7;
    font-size: 0.95rem;
    line-height: 1.6;
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #34495e;
    font-size: 0.9rem;
    color: #7f8c8d;
}