/* أنماط عامة للجسم */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    direction: rtl; /* لتوجيه النص من اليمين لليسار */
    text-align: right;
}

/* أنماط الهيدر */
.header {
    background-color: #007bff;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.header .logo {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    text-decoration: none;
}
.header .nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-size: 1.1em;
    transition: color 0.3s ease;
}
.header .nav-links a:hover {
    color: #e0e0e0;
}
.header .auth-links a {
    color: white;
    text-decoration: none;
    margin-left: 15px;
    padding: 8px 15px;
    border: 1px solid white;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.header .auth-links a:hover {
    background-color: white;
    color: #007bff;
}
.header .auth-links span {
    color: white;
    margin-left: 15px;
}

/* أنماط المحتوى الرئيسي للصفحة */
.main-content {
    padding: 20px;
    min-height: calc(100vh - 120px); /* تقريبي: لتغطية الشاشة قبل الفوتر والهيدر */
    max-width: 1200px;
    margin: 20px auto; /* لتوسيط المحتوى الرئيسي في الصفحة */
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* أنماط الفوتر */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9em;
    width: 100%;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    margin-top: 20px; /* لإعطاء مسافة بين المحتوى والفوتر */
}

/* أنماط النماذج الأساسية (للتسجيل والدخول) */
.wrapper {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 350px;
    margin: 20px auto; /* تم تعديله ليتوسط داخل main-content */
    max-width: 90%; /* إضافة لمرونة التجاوبية على الشاشات الصغيرة */
}
.wrapper h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: calc(100% - 22px); /* 100% - (2*padding + 2*border) */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* للحفاظ على العرض ثابتًا مع البادينغ والحدود */
}
.help-block {
    color: red;
    font-size: 0.9em;
    margin-top: 5px;
    display: block; /* لجعل رسائل الخطأ تظهر في سطر خاص بها */
}
.btn {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 1em;
}
.btn:hover {
    background-color: #0056b3;
}
.wrapper p {
    text-align: center;
    margin-top: 20px;
}
.wrapper p a {
    color: #007bff;
    text-decoration: none;
}
.wrapper p a:hover {
    text-decoration: underline;
}
.alert {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
}

/* أنماط صفحة الترحيب */
.welcome-container {
    max-width: 800px;
    margin: 20px auto; /* تم تعديله ليتوسط داخل main-content */
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
}
.welcome-container h2 {
    color: #333;
    margin-bottom: 20px;
}
.welcome-container p {
    color: #555;
    line-height: 1.6;
}
.welcome-message {
    font-size: 1.2em;
    color: #007bff;
    margin-bottom: 25px;
}
.logout-btn {
    background-color: #dc3545;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
}
.logout-btn:hover {
    background-color: #c82333;
}
/* --- أنماط خاصة بصفحة إدارة الدروس (manage_lessons.php) --- */

/* حاوية الفلاتر الرئيسية */
.filters-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

/* النموذج داخل حاوية الفلاتر */
.filters-section form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* زيادة المسافة بين العناصر */
    align-items: flex-end; /* لمحاذاة الأزرار مع أسفل حقول الإدخال */
}

/* كل مجموعة فلتر (ليبل + حقل) */
.filter-group {
    flex: 1 1 200px; /* السماح للعنصر بالنمو والانكماش، مع عرض أساسي 200 بكسل */
    min-width: 200px; /* ضمان عدم انضغاط العنصر أقل من هذا العرض */
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
}

/* مجموعة الأزرار */
.filter-group.actions {
    flex-basis: auto; /* لا تنمو مثل باقي الحقول */
    display: flex;
    gap: 10px;
}

/* جدول عرض الدروس */
.lessons-table-container {
    overflow-x: auto; /* إضافة شريط تمرير أفقي عند الحاجة على الشاشات الصغيرة */
}

.lessons-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    border: 1px solid #dee2e6;
}

.lessons-table th, .lessons-table td {
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    vertical-align: middle; /* محاذاة المحتوى عمودياً في المنتصف */
}

.lessons-table thead tr {
    background-color: #e9ecef;
}

.lessons-table tbody tr:nth-of-type(even) {
    background-color: #f8f9fa; /* تلوين الصفوف الزوجية لتحسين القراءة */
}

.lessons-table .lesson-tags {
    font-size: 0.9em;
    color: #555;
    line-height: 1.6;
}

.btn-action {
    color: #007bff;
    text-decoration: none;
    margin: 0 5px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}

.btn-action.delete {
    color: #dc3545;
}
/* --- حاوية عريضة للصفحات الإدارية --- */
.wrapper-full-width {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    width: 95%; /* استخدم نسبة مئوية لتكون مرنة مع حجم الشاشة */
    max-width: 1600px; /* يمكنك تحديد عرض أقصى إذا أردت */
}
/* --- شريط التنقل داخل صفحات الإدارة --- */
.admin-nav {
    background-color: #e9ecef;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    border: 1px solid #dee2e6;
}

.admin-nav a {
    text-decoration: none;
    color: #0056b3;
    font-weight: bold;
    font-size: 1.1em;
}

.admin-nav a:hover {
    text-decoration: underline;
}
/* --- أنماط رسائل التنبيه --- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 5px;
    text-align: center;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
/* --- أنماط صفحة عرض الدروس للطلاب --- */

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.lesson-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.lesson-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lesson-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #eee;
}

.lesson-card-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.lesson-title {
    font-size: 1.3em;
    margin: 0 0 10px 0;
    color: #333;
}

.lesson-description {
    font-size: 0.95em;
    color: #666;
    line-height: 1.5;
    flex-grow: 1;
    margin-bottom: 15px;
}

.lesson-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto; /* Push tags to the bottom */
}

.tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
}
/* --- أنماط صفحة عرض الدرس الواحد (view_lesson.php) --- */


.lesson-view-container {
    max-width: 1200px; /* تم زيادة العرض من 1000px إلى 1200px */
    margin: 0 auto;
    padding: 20px;
}

.lesson-header {
    border-bottom: 2px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.lesson-header h1 {
    font-size: 2.5em;
    margin: 0 0 15px 0;
}

.lesson-meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lesson-meta-tags .tag-type {
    background-color: #007bff;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
}

.lesson-content {
    margin-bottom: 40px;
}

.lesson-description-full {
    font-size: 1.1em;
    line-height: 1.8;
    color: #333;
}

.lesson-description-section {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
}

.lesson-description-section h2 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.download-link {
    text-align: center;
    margin-top: 20px;
}

.download-link a {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
}
/* --- أنماط الصفحة الرئيسية (index.php) --- */
.hero-section {
    text-align: center;
    padding: 60px 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 40px;
}

.hero-section h1 {
    font-size: 2.8em;
    margin-bottom: 15px;
    color: #343a40;
}

.hero-section p {
    font-size: 1.2em;
    color: #6c757d;
    margin-bottom: 30px;
}

.btn-hero {
    background-color: #007bff;
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn-hero:hover {
    background-color: #0056b3;
}

.homepage-section {
    margin-bottom: 40px;
}

.homepage-section h2 {
    text-align: center;
    font-size: 2em;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}
/* --- أنماط بطاقات الصفحة الرئيسية --- */

/* --- أنماط المراحل الدراسية --- */
.stages-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.stage-card { background-color: #fff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.05); padding: 40px 20px; text-align: center; text-decoration: none; color: #343a40; transition: all 0.3s ease; border: 1px solid #eee; }
.stage-card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); border-color: #007bff; }
.stage-card h3 { margin: 0; font-size: 1.5em; }

/* --- أنماط بطاقات الدروس --- */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}
.lesson-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.lesson-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.lesson-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #eee;
}
.lesson-card-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.lesson-title {
    font-size: 1.3em;
    margin: 0 0 10px 0;
    color: #333;
}
.lesson-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}
.tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
}

/* --- أنماط بطاقات الاختبارات --- */
.quizzes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.quiz-card { display: block; background-color: #fff; border: 1px solid #eee; border-radius: 8px; padding: 20px; text-decoration: none; color: inherit; transition: all 0.3s ease; }
.quiz-card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); border-color: #28a745; }
.quiz-card h4 { margin: 0 0 15px 0; font-size: 1.2em; }
/* --- أنماط قسم التعليقات --- */
.comments-section {
    margin-top: 40px;
}
.comments-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.comment-form {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}
.comments-list {
    margin-top: 20px;
}
.comment {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}
.comment:last-child {
    border-bottom: none;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}
.comment-author {
    font-weight: bold;
    color: #0056b3;
}
.comment-date {
    font-size: 0.85em;
    color: #6c757d;
}
.comment-body {
    line-height: 1.7;
    color: #343a40;
}
/* --- أنماط حاوية عرض الدرس --- */
/* هذا النمط يتحكم في عرض صفحة الدرس بالكامل */
.lesson-view-container {
    max-width: 1200px; /* تم زيادة العرض من 1000px إلى 1200px */
    margin: 0 auto;
    padding: 20px;
}

/* --- أنماط قسم التعليقات --- */
.comments-section {
    margin-top: 40px;
}
.comments-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.comment-form {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

/* --- التعديلات الجديدة هنا --- */
.comment-form textarea {
    width: 100%; /* اجعل صندوق النص يملأ العرض */
    box-sizing: border-box; /* لمنع تجاوز الحدود */
    margin-bottom: 10px;
}

.comment-form .btn {
    display: block;
    margin-right: auto; /* لدفع الزر إلى اليسار */
    margin-left: 0;
    width: auto; /* اجعل عرض الزر تلقائياً */
}
/* ------------------------- */

.comments-list {
    margin-top: 20px;
}
.comment {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}
.comment:last-child {
    border-bottom: none;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}
.comment-author {
    font-weight: bold;
    color: #0056b3;
}
.comment-date {
    font-size: 0.85em;
    color: #6c757d;
}
.comment-body {
    line-height: 1.7;
    color: #343a40;
}
/* --- أنماط شارة الدرس المكتمل --- */
.lesson-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.completed-badge {
    background-color: #28a745;
    color: white;
    font-size: 0.7em;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: normal;
    white-space: nowrap; /* لمنع التفاف النص داخل الشارة */
}
/* --- أنماط قسم التقدم في لوحة التحكم --- */
.progress-stats {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 25px;
    border-radius: 8px;
}
.progress-stats p {
    margin-top: 0;
    font-size: 1.2em;
    text-align: center;
    margin-bottom: 15px;
}
.progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 25px;
    height: 30px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.progress-bar {
    height: 100%;
    background-color: #28a745;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1em;
    transition: width 0.8s ease-in-out;
}
/* --- أنماط خاصة بلوحة تحكم الطالب (dashboard.php) --- */

/* --- أنماط بطاقات الوصول السريع --- */
.dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.dashboard-card.admin-card {
    background-color: #fffbe6; /* لون مميز لبطاقة الإدارة */
    border-color: #ffe58f;
}
.dashboard-card h3 {
    margin-top: 0;
    font-size: 1.5em;
}
.dashboard-card p {
    flex-grow: 1;
    color: #666;
}
.card-btn {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    margin-top: 15px;
    display: block;
}
.admin-card .card-btn {
    background-color: #ffc107;
    color: #212529;
}

/* --- أنماط شارة نتيجة الاختبار --- */
.score-badge {
    padding: 5px 12px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    font-size: 0.9em;
}
.score-success {
    background-color: #28a745; /* أخضر للنجاح */
}
.score-fail {
    background-color: #dc3545; /* أحمر للفشل */
}
/* --- أنماط إضافية للردود على التعليقات --- */
.comment-footer {
    margin-top: 10px;
    text-align: left;
}
.reply-btn {
    background-color: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
    padding: 4px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    transition: all 0.2s ease;
}
.reply-btn:hover {
    background-color: #6c757d;
    color: white;
}
.reply-form {
    margin-top: 15px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}
/* --- التعديلات الجديدة هنا --- */
.reply-form textarea.form-control {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}
.reply-form .btn {
    display: block;
    margin-right: auto;
    margin-left: 0;
    width: auto;
}
/* --- أنماط نظام الإشعارات (محدث) --- */
.notifications-container {
    position: relative;
    display: inline-block;
}
.notification-bell {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    position: relative;
    color: white;
    padding: 0 10px;
}
.notification-badge {
    position: absolute;
    top: -5px;
    right: 0;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.6em;
    font-weight: bold;
    border: 1px solid white;
}
.notifications-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    width: 350px;
    z-index: 1000;
    overflow: hidden;
    text-align: right;
}
.notifications-header {
    padding: 10px 15px;
    font-weight: bold;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
.notifications-body {
    max-height: 400px;
    overflow-y: auto;
}
.notification-item {
    display: block;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background-color: #f8f9fa;
}
.notification-item.unread {
    background-color: #e6f2ff;
}
.notification-item p {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    font-weight: bold;
    color: #007bff; /* تم تغيير لون الخط هنا ليصبح أزرق دائماً */
}
.notification-item small {
    font-size: 0.8em;
    color: #6c757d;
    font-weight: normal; /* التأكد من أن التاريخ ليس عريضاً */
}

/* --- أنماط الأزرار الصغيرة للإجراءات --- */
.btn-sm {
    padding: 5px 12px;
    font-size: 0.9em;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
    text-decoration: none; /* لضمان تطبيقه على الروابط أيضاً */
    display: inline-block; /* لضمان العرض الصحيح */
}

/* الأخضر (للنجاح والتفعيل) */
.btn-success { 
    background-color: transparent;
    border-color: #28a745;
    color: #28a745;
}
.btn-success:hover {
    background-color: #28a745; 
    color: white;
}

/* الأحمر (للحذف) */
.btn-danger { 
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
}
.btn-danger:hover {
    background-color: #dc3545; 
    color: white;
}

/* البرتقالي (للتحذير والتعطيل) */
.btn-warning {
    background-color: transparent;
    border-color: #ffc107;
    color: #ffc107;
}
.btn-warning:hover {
    background-color: #ffc107;
    color: #212529;
}

/* الأزرق (للمعلومات والتفعيل اليدوي) */
.btn-info {
    background-color: transparent;
    border-color: #17a2b8;
    color: #17a2b8;
}
.btn-info:hover {
    background-color: #17a2b8;
    color: white;
}
/* --- أنماط إضافية لزر الإبلاغ --- */
.comment-footer {
    display: flex;
    justify-content: flex-end; /* يبدأ من اليمين في RTL */
    align-items: center;
    gap: 15px; /* مسافة بين الأزرار */
    margin-top: 10px;
}

.report-form {
    margin: 0; /* إزالة الهوامش الافتراضية للنموذج */
}

.report-btn {
    background-color: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.8em;
    text-decoration: underline;
    padding: 0;
}

.report-btn:hover {
    color: #dc3545;
}
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}
.report-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
}
.report-card.full-width {
    grid-column: 1 / -1;
}
.report-card h3 {
    margin-top: 0;
    font-size: 1.5em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.report-description {
    color: #6c757d;
    margin-bottom: 20px;
}
.report-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.report-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.report-list li:last-child {
    border-bottom: none;
}
.report-value {
    font-weight: bold;
    color: #007bff;
}
/* --- أنماط شريط الإعلان النصي --- */
.ad-banner {
    background-color: #007bff;
    color: white;
    text-align: center;
    padding: 12px;
    font-size: 1.1em;
    font-weight: bold;
}
.ad-banner a, .ad-banner span {
    color: white;
    text-decoration: none;
}
.ad-banner a:hover {
    text-decoration: underline;
}
/* --- أنماط خاصة بنموذج إدارة الإعلانات --- */
.form-section textarea.form-control {
    width: 100%;
    box-sizing: border-box; /* لضمان عدم تجاوز الحدود */
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 25px; /* مسافة عمودية وأفقية بين الخيارات */
    align-items: center;
    background-color: #fff;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.checkbox-group input[type="checkbox"] {
    margin-left: 8px;
    transform: scale(1.2); /* تكبير مربع الاختيار قليلاً */
}

.checkbox-group label {
    margin-bottom: 0; /* لإلغاء الهامش السفلي الافتراضي */
    font-weight: normal;
    cursor: pointer;
}
/* --- أنماط خاصة بنموذج إدارة الإعلانات --- */
.form-section textarea.form-control {
    width: 100%;
    box-sizing: border-box; /* لضمان عدم تجاوز الحدود */
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; /* لدفع "تفعيل" إلى اليسار */
    align-items: center;
    background-color: #fff;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.checkbox-group .page-options {
    display: flex;
    gap: 20px; /* مسافة بين خيارات الصفحات */
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px; /* مسافة بين مربع الاختيار والنص */
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    transform: scale(1.2);
}

.activation-option {
    background-color: #e6f2ff;
    padding: 5px 10px;
    border-radius: 5px;
}

.form-actions {
    display: flex;
    justify-content: flex-start; /* يبدأ من اليمين */
    gap: 10px;
    margin-top: 20px;
}

.form-actions .btn {
    width: auto; /* يجعل عرض الزر تلقائياً */
}
/* --- أنماط شريط الإعلان النصي (محدث) --- */
.ad-banner {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    text-align: center;
    padding: 12px;
    font-size: 1.1em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.ad-banner a, .ad-banner span {
    color: white;
    text-decoration: none;
}
.ad-banner a:hover {
    text-decoration: underline;
}

/* --- إصلاح تنسيق أزرار الإجراءات --- */
.actions-cell {
    display: flex;
    justify-content: center; /* توسيط الأزرار */
    align-items: center;
    gap: 10px; /* مسافة بين الأزرار */
    flex-wrap: wrap; /* للسماح بالالتفاف على الشاشات الصغيرة */
}
.action-form {
    margin: 0; /* إزالة الهوامش الافتراضية للنموذج */
}
/* --- أنماط شريط الإعلان النصي (محدث) --- */
.ad-banner {
    background: #e9ecef; /* تم تغيير لون الخلفية إلى لون رمادي فاتح */
    color: #343a40; /* تم تغيير لون الخط إلى داكن ليتناسب مع الخلفية */
    text-align: center;
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px; /* إضافة حواف دائرية */
    max-width: 1200px; /* تحديد عرض أقصى */
    margin: 20px auto; /* لتوسيط الشريط وإضافة مسافة علوية وسفلية */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #dee2e6;
}
.ad-banner a, .ad-banner span {
    color: #0056b3; /* تغيير لون الرابط إلى أزرق داكن */
    text-decoration: none;
}
.ad-banner a:hover {
    text-decoration: underline;
}

/* --- إصلاح تنسيق أزرار الإجراءات --- */
.actions-cell {
    display: flex;
    justify-content: center; /* توسيط الأزرار */
    align-items: center;
    gap: 10px; /* مسافة بين الأزرار */
    flex-wrap: wrap; /* للسماح بالالتفاف على الشاشات الصغيرة */
}
.action-form {
    margin: 0; /* إزالة الهوامش الافتراضية للنموذج */
}

/* --- أنماط خاصة بصفحات مكتبة الملفات --- */

/* --- أنماط بطاقات الفئات (مستخدمة من لوحة التحكم) --- */
.management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.management-card {
    display: block;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}
.management-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transform: translateY(-3px);
}
.management-card h4 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
}
.management-card p {
    margin: 0;
    color: #6c757d;
}

/* --- أنماط قسم الفلاتر (محدثة بنظام Grid) --- */
.filters-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

/* التخطيط الافتراضي للهواتف (عمودي) */
.filters-section form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* التخطيط الشبكي للشاشات العريضة (أفقي وثابت) */
@media (min-width: 1200px) { /* تم تقليل العرض المطلوب لتطبيق التخطيط */
    .filters-section form {
        display: grid;
        /* تقسيم المساحة: البحث(ضعف العرض)، 4 فلاتر(عرض عادي)، الأزرار(تلقائي) */
        grid-template-columns: 2fr repeat(4, 1fr) auto;
        gap: 15px;
        align-items: flex-end;
    }
}

.filter-group {
    /* إلغاء الأنماط القديمة التي قد تتعارض */
    flex: initial;
    min-width: initial;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
}

.filter-group.actions {
    display: flex;
    gap: 10px;
}

/* تنسيق زر إعادة التعيين والأزرار الأخرى في الفلتر */
.filter-group.actions .btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 15px;
    white-space: nowrap; /* لمنع التفاف النص داخل الزر */
}
/* --- أنماط بطاقات الوصول السريع في لوحة التحكم --- */
.dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}


.dashboard-card {
    background-color: #fff;
    border-radius: 0.75rem; /* rounded-xl */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-lg */
    border: 1px solid #e5e7eb; /* border */
    padding: 1.5rem; /* p-6 */
    text-align: center; /* This is the key change */
}

.dashboard-card h3 {
    margin-top: 0;
    font-size: 1.5em;
}

.dashboard-card p {
    flex-grow: 1;
    color: #666;
}

.card-btn {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    margin-top: 15px;
    display: block;
}
/* --- أنماط نظام المراسلات --- */
.messaging-nav {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
    align-items: center;
}
.messaging-nav a {
    padding: 10px 20px;
    text-decoration: none;
    color: #6c757d;
    font-weight: bold;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.messaging-nav a.active {
    color: #007bff;
    border-bottom-color: #007bff;
}
.messaging-nav a.new-message-btn {
    margin-right: auto; /* لدفع الزر إلى اليسار */
    background-color: #28a745;
    color: white !important;
    border-radius: 5px;
    border-bottom: none;
    padding: 8px 15px;
}
.messaging-nav a.new-message-btn:hover {
    background-color: #218838;
}

.unread-message td {
    font-weight: bold;
}
.conversation-view {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    max-height: 500px;
    overflow-y: auto;
}
.message-bubble {
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 10px;
    max-width: 80%;
}
.message-bubble p {
    margin: 5px 0 0 0;
}
.message-bubble small {
    font-size: 0.75em;
    color: #666;
}
.user-bubble {
    background-color: #e9ecef;
    margin-left: auto;
}
.admin-bubble {
    background-color: #d1ecf1;
    margin-right: auto;
}
.reply-form {
    margin-top: 20px;
}
.reply-form textarea {
    margin-bottom: 10px;
}

.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.announcement-item {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-right: 5px solid #007bff;
    padding: 20px;
    border-radius: 5px;
}
.announcement-item h3 {
    margin: 0 0 10px 0;
}
.announcement-item p {
    margin: 0 0 15px 0;
}
.announcement-item small {
    color: #6c757d;
}
/* --- أنماط إضافية لقائمة الرسائل المنسدلة --- */
.notifications-footer {
    display: block;
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}
.notifications-footer:hover {
    background-color: #e9ecef;
}
/* --- أنماط الصفحات الثابتة --- */
.static-page-container {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 8px;
}
.static-page-container h1 {
    font-size: 2.2em;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
}
.page-content-body {
    font-size: 1.1em;
    line-height: 1.8;
    color: #343a40;
}

/* --- أنماط روابط الفوتر --- */
.footer-links {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 25px;
}
.footer-links a {
    color: #f8f9fa;
    text-decoration: none;
    font-size: 1.1em;
}
.footer-links a:hover {
    text-decoration: underline;
}
/* --- أنماط صفحة قالوا عنا --- */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}
.testimonial-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-left: 5px solid #007bff;
    padding: 25px;
    border-radius: 5px;
}
.testimonial-text {
    font-size: 1.1em;
    line-height: 1.7;
    margin: 0 0 20px 0;
    font-style: italic;
    color: #343a40;
}
.testimonial-author {
    font-weight: bold;
    color: #6c757d;
    text-align: left;
    display: block;
}
/* --- أنماط إضافية لصفحة قالوا عنا --- */
.testimonial-author span {
    font-weight: normal;
    font-style: italic;
}

/* --- أنماط إضافية لصفحة إدارة الصلاحيات --- */
.permission-category-header td {
    background-color: #e9ecef;
    font-weight: bold;
    font-size: 1.1em;
    padding: 12px;
}
/* --- إصلاح مشكلة تداخل محرر النصوص --- */
.tox-tinymce-aux, .tox-notification, .tox-dialog {
    z-index: 99999 !important;
}
/* --- أنماط نظام تقييم الدروس --- */
.lesson-rating-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.stars {
    --percent: calc(var(--rating) / 5 * 100%);
    display: inline-block;
    font-size: 1.5em;
    font-family: Times;
    line-height: 1;
    color: #ccc;
}
.stars::before {
    content: '★★★★★';
    letter-spacing: 3px;
    background: linear-gradient(90deg, #ffc107 var(--percent), #ccc var(--percent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.rating-text {
    font-size: 1.1em;
    color: #6c757d;
}

.lesson-rating-section {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
    text-align: center;
}
.lesson-rating-section h4 {
    margin-top: 0;
}
.user-rating-display {
    font-size: 2em;
}

/* --- تصميم نجوم الإدخال --- */
.rating-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.rate {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    height: 46px;
    padding: 0 10px;
}
.rate:not(:checked) > input {
    display: none;
}
.rate:not(:checked) > label {
    width: 1em;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    font-size: 30px;
    color: #ccc;
}
.rate:not(:checked) > label:before {
    content: '★ ';
}
.rate > input:checked ~ label {
    color: #ffc107;
}
.rate:not(:checked) > label:hover,
.rate:not(:checked) > label:hover ~ label {
    color: #deb217;
}

/* --- أنماط مكتبة الفيديوهات --- */
.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.video-card { background-color: #fff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); overflow: hidden; transition: all 0.3s ease; }
.video-card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); }
.video-card-link { text-decoration: none; color: inherit; }
.video-thumbnail { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background-color: #000; }
.video-card-content { padding: 15px; }
.video-title { font-size: 1.2em; margin: 0 0 10px 0; }
.video-embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; margin-bottom: 20px; border-radius: 8px; }
.video-embed-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* --- أنماط زر المشاركة العائم --- */
.floating-share-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.2s ease;
}

.floating-share-btn:hover {
    transform: scale(1.1);
}

/* رسالة التأكيد (Toast) */
.toast-notification {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 5px;
    padding: 16px;
    position: fixed;
    z-index: 10000;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    font-size: 17px;
    opacity: 0;
    transition: opacity 0.5s, visibility 0.5s;
}

.toast-notification.show {
    visibility: visible;
    opacity: 1;
}
/* --- أنماط زر الواتساب العائم --- */
.floating-whatsapp-btn {
    position: fixed;
    bottom: 25px;
    left: 25px; /* يظهر في الجهة اليسرى */
    width: 60px;
    height: 60px;
    background-color: #25D366; /* لون الواتساب الأخضر */
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.2s ease;
}

.floating-whatsapp-btn:hover {
    transform: scale(1.1);
}
/* --- أنماط حاوية الدرس التفاعلي (محدث) --- */
.interactive-lesson-container {
    width: 100%;
    /* تم إزالة height: 85vh; من هنا */
    background-color: #f1f1f1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.interactive-lesson-container iframe {
    width: 100%;
    /* الارتفاع سيتم تحديده بواسطة JavaScript */
    height: 500px; /* ارتفاع افتراضي أثناء التحميل */
    border: 0;
    display: block; /* لإزالة أي مسافات إضافية */
}
.game-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}
/* --- أنماط الشعار الجديد --- */
.site-logo {
    height: 40px;
    width: auto;
    margin-left: 10px;
}
.header .logo {
    display: flex;
    align-items: center;
}

/* --- أنماط القوائم المنسدلة (محدثة) --- */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    padding: 10px 15px;
    font-family: inherit;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100;
    border-radius: 5px;
    max-height: 300px; /* تحديد أقصى ارتفاع للقائمة (يمكنك تعديل هذا الرقم) */
    overflow-y: auto;  /* إضافة شريط تمرير عمودي تلقائياً عند الحاجة */
    text-align: right;
}
/* *** الإصلاح هنا: تم جعل المحدد أكثر تحديدًا *** */
.header .dropdown-content a {
    color: black; /* الآن سيتم تطبيق هذا اللون الأسود */
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 1em;
    margin: 0 !important;
    transition: background-color 0.2s, color 0.2s;
}
.header .dropdown-content a:hover {
    background-color: #f1f1f1;
    color: #007bff; /* سيتم تطبيق هذا اللون الأزرق عند التمرير */
}
.dropdown:hover .dropdown-content {
    display: block;
}
.dropdown-content hr {
    margin: 5px 0;
    border: 0;
    border-top: 1px solid #eee;
}

/* --- أنماط قائمة المستخدم --- */
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid #ffffff80;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}
.user-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.user-icons {
    display: flex;
    gap: 10px;
}
.icon-wrapper {
    position: relative;
    font-size: 1.2em;
}
.user-dropdown {
    left: 0; /* محاذاة لليسار */
}
/* --- أنماط صفحة الإشعارات --- */
.notifications-page-container {
    max-width: 800px;
    margin: 0 auto;
}
.notification-page-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    border-radius: 5px;
    transition: background-color 0.2s;
}
.notification-page-item:hover {
    background-color: #f8f9fa;
}
.notification-page-item.unread .notification-content p {
    font-weight: bold;
}
.notification-icon {
    font-size: 1.2em;
    color: #007bff;
}
.notification-content p {
    margin: 0 0 5px 0;
}
.notification-content small {
    color: #6c757d;
}
/* --- أنماط حاوية الإعلانات المصورة (محدثة) --- */
.image-ad-container {
    max-width: 1200px;
    margin: 20px auto;
    display: flex; /* استخدام flexbox للتوزيع */
    justify-content: center; /* توسيط الإعلان إذا كان واحدًا */
    gap: 20px; /* مسافة بين الإعلانات */
    flex-wrap: wrap;
}
.ad-slot {
    flex: 1 1 48%; /* السماح للإعلانين بأخذ المساحة المتاحة */
    max-width: 48%;
}
.ad-slot img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.footer-ads {
    margin-top: 40px;
}
/* =============================================== */
/* === أنماط خاصة بلوحة تحكم الطالب (Dashboard) === */
/* =============================================== */

/* تأثير بسيط عند مرور الماوس فوق بطاقات الإحصائيات */
.summary-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* تنسيق عناوين الأقسام الرئيسية في لوحة التحكم */
.dashboard-section h2 {
    border-bottom: 2px solid #f3f4f6; /* bg-gray-100 */
    padding-bottom: 0.75rem; /* pb-3 */
}

/* ===================================== */
/* === أنماط خاصة بمركز الإشعارات === */
/* ===================================== */

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* 8px */
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem; /* 12px */
    border-radius: 0.5rem; /* 8px */
    transition: background-color 0.2s ease-in-out;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e7eb; /* border-gray-200 */
}

.notification-item:hover {
    background-color: #f9fafb; /* bg-gray-50 */
}

/* نمط الإشعارات غير المقروءة */
.notification-item.unread {
    background-color: #eff6ff; /* bg-blue-50 */
    border-color: #dbeafe; /* border-blue-100 */
}

.notification-icon {
    flex-shrink: 0;
    margin-left: 0.75rem; /* 12px */
    color: #3b82f6; /* text-blue-500 */
    font-size: 1.25rem; /* text-xl */
}

.notification-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #1f2937; /* text-gray-800 */
}

.notification-time {
    font-size: 0.75rem; /* text-xs */
    color: #6b7280; /* text-gray-500 */
    margin-top: 0.25rem; /* 4px */
    display: block;
}
/* ===================================== */
/* === أنماط قسم التعليقات الجديد === */
/* ===================================== */

.comment-card {
    background-color: #f9fafb; /* bg-gray-50 */
    border: 1px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.5rem;
    padding: 1rem;
}
.comment-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}
.reply-btn, .report-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280; /* text-gray-500 */
    transition: color 0.2s;
}
.reply-btn:hover, .report-btn:hover {
    color: #1f2937; /* text-gray-800 */
}
.report-form {
    display: inline;
}
.reply-form {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}
.replies-container {
    margin-top: 1rem;
    padding-right: 2.5rem; /* مسافة للردود */
    border-right: 2px solid #e5e7eb;
}
/* ===================================== */
/* === أنماط نظام التقييم بالنجوم === */
/* ===================================== */

.rating-section-container {
    background-color: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow: visible;
}

/* التعديل الجديد لمحاذاة النموذج */
.rating-form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rate {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;

}
.rate:not(:checked) > input {
    position:absolute;
    top:-9999px;
}
.rate:not(:checked) > label {
    float:right;
    width:1em;
    overflow:hidden;
    white-space:nowrap;
    cursor:pointer;
    font-size:2rem;
    color:#ccc;
}
.rate:not(:checked) > label:before {
    content: '★ ';
}
.rate > input:checked ~ label {
    color: #ffc700;
}
.rate:not(:checked) > label:hover,
.rate:not(:checked) > label:hover ~ label {
    color: #deb217;
}
.rate > input:checked + label:hover,
.rate > input:checked + label:hover ~ label,
.rate > input:checked ~ label:hover,
.rate > input:checked ~ label:hover ~ label,
.rate > label:hover ~ input:checked ~ label {
    color: #c59b08;
}

.stars-display {
    --percent: calc(var(--rating) / 5 * 100%);
    display: inline-block;
    font-size: 1.5rem;
    font-family: Times;
    line-height: 1;
    color: #ccc;
    -webkit-text-fill-color: transparent;
    background: linear-gradient(90deg, #ffc700 var(--percent), #ccc var(--percent));
    -webkit-background-clip: text;
    background-clip: text;
}
/* Styling for custom radio button cards */
.styled-radio-group input[type="radio"] {
    display: none; /* Hide the original radio button */
}

.styled-radio-card {
    padding: 1rem;
    border: 2px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.5rem; /* rounded-lg */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* gap-3 */
    font-weight: 600; /* font-semibold */
    color: #4b5563; /* text-gray-600 */
}

.styled-radio-card:hover {
    border-color: #9ca3af; /* border-gray-400 */
}

/* Style for the selected radio card */
.styled-radio-group input[type="radio"]:checked + .styled-radio-card {
    border-color: #3b82f6; /* border-blue-500 */
    background-color: #eff6ff; /* bg-blue-50 */
    color: #2563eb; /* text-blue-600 */
    box-shadow: 0 0 0 2px #bfdbfe; /* ring */
}
/* يمكنك نقل هذه الأنماط إلى ملف style.css الرئيسي */
.btn-sm {
    padding: 5px 12px;
    font-size: 0.9em;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}
.btn-success { 
    background-color: transparent;
    border-color: #28a745;
    color: #28a745;
}
.btn-success:hover {
    background-color: #28a745; 
    color: white;
}
.btn-danger { 
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
}
.btn-danger:hover {
    background-color: #dc3545; 
    color: white;
}
.actions-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.action-form {
    margin: 0;
}
.quick-access-card {
    display: flex;
    /* Changed from column to row */
    flex-direction: row;
    align-items: center;
    justify-content: center;
    /* Reduced padding */
    padding: 1rem;
    border-radius: 0.75rem;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    transition: transform 0.2s ease;
    min-height: 80px; /* Reduced height */
}
.quick-access-card:hover { transform: scale(1.05); }
.quick-access-card i {
    font-size: 1.5rem; /* Adjusted icon size */
    margin-left: 0.75rem; /* Swapped margin-bottom for margin-left */
}
/* Styles for separated icon buttons */
.icon-btn {
    position: relative;
    font-size: 1.5rem;
    padding: 0 0.5rem;
}
.notification-badge {
    position: absolute;
    top: -5px;
    right: 0px;
    background-color: #ef4444; /* red-500 */
    color: white;
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Styles for the new dropdown items */

/* أضف هذا الكود الجديد */
.dropdown {
    position: relative; /* هذا السطر هو أهم تعديل في كل الحل */
    display: inline-block; /* يضمن أن الحاوية تأخذ حجم الزر فقط */
}
/* تعديل لتقليل ارتفاع خلايا القائمة المنسدلة */
.dropdown-item {
    display: block;
    padding: 1rem; /* تقليل الحشوة العمودية إلى النصف تقريباً */
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s; /* إضافة انتقال ناعم عند المرور */
}

.dropdown-item:hover {
    background-color: #f9fafb; /* إضافة لون خلفية خفيف عند المرور */
}

.dropdown-item.unread {
    font-weight: bold;
}
.dropdown-footer {
    display: block;
    padding: 0.5rem 1rem;
    text-align: center;
    font-weight: bold;
    color: #3b82f6; /* blue-500 */
}
/* New styles for separated icon buttons in the header */
.auth-links {
    display: flex;
    align-items: center;
    gap: 1rem; /* Adjust spacing between icons and user menu */
}

.icon-btn {
    position: relative;
    font-size: 1.5rem;
    padding: 0 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: 0px;
    background-color: #ef4444; /* red-500 */
    color: white;
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Styles for the new dropdown items */
.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f3f4f6; /* gray-100 */
    white-space: nowrap;
}
.dropdown-item.unread {
    font-weight: bold;
}
.dropdown-footer {
    display: block;
    padding: 0.5rem 1rem;
    text-align: center;
    font-weight: bold;
    color: #3b82f6; /* blue-500 */
}
/* New class for vertical alignment in tables */
.align-top {
    vertical-align: top;
}
/* --- Student Dashboard Card Styles --- */
.dashboard-card {
    background-color: #fff;
    border-radius: 0.75rem; /* rounded-xl */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-lg */
    border: 1px solid #e5e7eb; /* border */
    padding: 1.5rem; /* p-6 */
    text-align: center;
}
.dashboard-card i {
    font-size: 2.25rem; /* text-4xl */
    color: #3b82f6; /* text-blue-500 */
    margin-bottom: 1rem; /* mb-4 */
}
.dashboard-card h3 {
    font-size: 1.25rem; /* text-xl */
    font-weight: bold;
    color: #1f2937; /* text-gray-800 */
}
.dashboard-card p {
    color: #4b5563; /* text-gray-600 */
    margin-top: 0.5rem; /* my-2 */
    margin-bottom: 1rem;
}
.card-btn {
    display: inline-block;
    margin-top: 1rem; /* mt-4 */
    background-color: #3b82f6; /* bg-blue-600 */
    color: white;
    font-weight: bold;
    padding: 0.5rem 1.5rem; /* py-2 px-6 */
    border-radius: 0.5rem; /* rounded-lg */
    text-decoration: none;
    transition: background-color 0.2s;
}
.card-btn:hover {
    background-color: #2563eb; /* hover:bg-blue-700 */
}
/* =================================== */
/* Global & Body Styles               */
/* =================================== */

/* لا تقم بوضع التصفير (*) هنا إذا كان Tailwind يقوم به بالفعل */
/* يمكنك إزالة هذا الجزء إذا كان يسبب مشاكل */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
}

/* =================================== */
/* Header Layout & Components         */
/* =================================== */

/* الهيدر الرئيسي */
.header-container {
    background: linear-gradient(135deg, #2563eb 0%, #3662daff 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* الشعار */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
}

.site-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
    background: #f3f4f6;
}

/* أزرار الأيقونات */
.icon-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white; /* يحدد لون الأيقونة بداخل الزر */
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 45px;
    min-height: 45px;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* شارة التنبيهات */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* القوائم المنسدلة */
.dropdown {
    position: relative;
}

.dropdown-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.dropdown-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* استبدل الكود الحالي بهذا الكود المطور */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0; /* اجعلها تبدأ من يمين الحاوية */
    top: 100%; /* اجعلها تبدأ مباشرة تحت الزر */
    background-color: white;
    min-width: 260px; /* زيادة العرض قليلاً */
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1001; /* زيادة z-index لضمان ظهورها فوق كل شيء */
    
    /* التحكم في الارتفاع والتمرير */
    max-height: 70vh; /* استخدم vh (ارتفاع الشاشة) ليكون متجاوباً */
    overflow-y: auto;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeInDown 0.3s ease-out;
}

/* استبدل الكود الحالي بهذا الكود */
.dropdown-item {
    color: black;
    padding: 0.6rem 1rem; /* تقليل الحشوة العمودية */
    text-decoration: none;
    display: block;
    text-align: right;
    border-bottom: 1px solid #f1f1f1;
}
.dropdown-item:last-child {
    border-bottom: none; /* إزالة الخط السفلي من آخر عنصر */
}
.dropdown-item:hover {
    background-color: #f9f9f9;
}

.dropdown-item.unread {
    background: #e3f2fd;
    font-weight: bold;
}

.dropdown-footer {
    display: block;
    padding: 1rem;
    background: #f8f9fa;
    color: #2563eb;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
}

/* أزرار تسجيل الدخول والتسجيل */
.auth-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.auth-btn:hover {
    background: white;
    color: #2563eb;
    transform: translateY(-2px);
}


/* =================================== */
/* Responsive Styles (Media Queries)  */
/* =================================== */

/* الشاشات الكبيرة - Desktop فقط */
@media (min-width: 768px) {
    .header-container {
        padding: 1rem 2rem;
    }
    
    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .header-top,
    .header-middle,
    .header-bottom,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .nav-links {
        display: flex;
        gap: 2rem;
        align-items: center;
    }
    
    .auth-links {
        display: flex;
        gap: 1rem;
        align-items: center;
    }
}

/* الشاشات الصغيرة - Mobile فقط */
@media (max-width: 767px) {
    .header-content {
        display: none !important;
    }
    
    .header-container {
        padding: 0;
    }
    
    .header-top {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.2);
    }
    
    .header-middle {
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        padding: 0.75rem;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        background: rgba(255,255,255,0.1);
    }
    
    .header-bottom {
        display: none;
        flex-direction: column;
        background: rgba(255,255,255,0.05);
    }
    
    .header-bottom.active {
        display: flex !important;
        animation: slideDown 0.3s ease-out;
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }
    
    .nav-links > a,
    .nav-links .dropdown {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-links > a {
        padding: 1rem;
        display: block;
        color: white;
        text-decoration: none;
        transition: background-color 0.3s;
    }
    
    .nav-links > a:hover {
        background: rgba(255,255,255,0.1);
    }
    
    .auth-links {
        display: none !important;
    }

    #library-mobile,
    .dropdown-content.mobile-open {
        display: none !important;
    }

    #library-mobile.show,
    .dropdown-content.mobile-open {
        display: block !important;
    }

    .mobile-menu-toggle {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .mobile-menu-toggle span {
        width: 25px;
        height: 3px;
        background: white;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

   /* --- أنماط شبكة الإجراءات السريعة (متجاوبة) --- */

.quick-actions-grid {
    display: grid;
    gap: 20px;
    margin-top: 1rem;

    /* 1. النمط الافتراضي (للشاشات الصغيرة جداً والهواتف) */
    /* عمود واحد يملأ العرض */
    grid-template-columns: repeat(2, 1fr);
}

/* 2. للشاشات المتوسطة (Tablets) وما فوق */
/* (مثلاً، أعرض من 640px) */
@media (min-width: 640px) {
    .quick-actions-grid {
        /* عمودان متساويان */
        grid-template-columns: repeat(2, 1fr); 
    }
}

/* 3. للشاشات الكبيرة (Desktops) وما فوق */
/* (مثلاً، أعرض من 1024px) */
@media (min-width: 1024px) {
    .quick-actions-grid {
        /* أربعة أعمدة متساوية */
        grid-template-columns: repeat(4, 1fr); 
    }
}

}

/* =================================== */
/* Animations & Other shared styles   */
/* =================================== */

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- تنسيق شريط الإعلان النصي المحسّن --- */

.text-ad-bar {
    /* الألوان */
    background-color: #dae9ca; /* خلفية زرقاء فاتحة جداً */
    color: #0c4a6e; /* لون خط أزرق داكن وواضح */

    /* التوسيط والمساحة الداخلية */
    display: flex; /* استخدام Flexbox للتحكم الدقيق */
    justify-content: center; /* توسيط المحتوى أفقيًا */
    align-items: center; /* توسيط المحتوى عموديًا */
    padding: 12px 20px; /* مساحة داخلية (padding) 12px أعلى وأسفل، 20px يمين ويسار */
    
    /* الشكل والحواف */
    border-radius: 12px; /* حواف دائرية بشكل أنعم */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* ظل خفيف لإعطاء عمق */
    
    /* الخط */
    font-weight: 600; /* خط أعرض قليلاً (شبه عريض) */
    font-size: 1rem; /* حجم خط مناسب */
    text-align: center; /* ضمان التوسيط في كل الحالات */
    
    /* تأثيرات إضافية */
    transition: all 0.3s ease; /* حركة ناعمة للتأثيرات */
}

/* عند وجود رابط، اجعل الشريط كله قابلاً للنقر */
.text-ad-bar a {
    color: inherit; /* يرث لون الخط من الأب */
    text-decoration: none; /* إزالة الخط تحت الرابط */
    display: block;
    width: 100%;
}

/* تأثير جميل عند مرور الماوس فوق الإعلان إذا كان رابطاً */
.text-ad-bar:has(a):hover {
    transform: translateY(-2px); /* رفعه للأعلى قليلاً */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* زيادة الظل لجعله بارزاً */
    background-color: #d1ecfd; /* تغميق الخلفية قليلاً */
}
/* ==========================================================================
   FIX: Reduce Spacing in Mobile Menu Dropdown (Final, Simple Fix)
   ========================================================================== */

/* 
 * هذا الكود يستهدف فقط قائمة الموبايل ولن يؤثر على أي شيء آخر في الموقع.
 */
@media (max-width: 767px) {
    
    /* 1. تقليل المسافة في القائمة الرئيسية (الرئيسية، المنتديات، ...) */
    .header-bottom .nav-links > a,
    .header-bottom .nav-links .dropdown-btn {
        padding-top: 0.5rem;    /* تقليل الحشوة العلوية (كانت 1rem) */
        padding-bottom: 0.5rem; /* تقليل الحشوة السفلية (كانت 1rem) */
    }

    /* 2. تقليل المسافة في القائمة الفرعية (الدروس، الاختبارات، ...) */
    .header-bottom .dropdown-content .dropdown-item {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        font-size: 0.7rem; /* تصغير الخط قليلاً لتوفير مساحة أكبر */
    }
}
