/* ملف: css/style.css - النسخة الكاملة والنهائية مع لوحة الألوان الخضراء */

/* إعادة تعيين بسيطة لضمان التوافق بين المتصفحات */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 
  المتغيرات الديناميكية - هذه القيم الافتراضية سيتم تجاوزها
  بواسطة المتغيرات التي يتم إنشاؤها في ملف temp.php 
  من ملف إعدادات الألوان (JSON).
  تم توحيد الأسماء لاستخدام الشرطة السفلية (_) لتتوافق مع ملف JSON.
*/
:root {
    /* الألوان الأساسية */
    --primary_color: #2a6f97;
    --primary_dark_color: #013a63; /* درجة أغمق للهوفر والتدرجات */
    --secondary_color: #014f86;
    --background_color: #f8fafc;
    --border_color: #e2e8f0;
    --white_color: #ffffff;

    /* ألوان النصوص والروابط */
    --text_color: #14213d;
    --secondary_text_color: #4a5568;
    --light_text_color: #a0aec0;
    --link_color: #014f86;
    --link_hover_color: #013a63;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    background-color: var(--background_color);
    color: var(--text_color);
    direction: rtl;
    text-align: right;
    padding-bottom: 0px;
}

a {
    color: var(--link_color);
    text-decoration: none;
}

a:hover {
    color: var(--link_hover_color);
    text-decoration: underline;
}

.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--white_color);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
}

/* Header Styles */
.main-header {
    background-color: var(--primary_color);
    text-align: center;
    padding: 0;
}

.header-banner {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
}

/* Navigation Styles المحسنة */
.main-nav {
    background-color: var(--primary_dark_color);
    padding: 10px 0;
    position: relative;
}

.main-nav ul {
    list-style: none;
    text-align: center;
}

.main-nav ul li {
    display: inline-block;
    margin: 0 6px;
}

/* --- 1. الأزرار الرئيسية في الشريط --- */
.main-nav ul li a {
    color: var(--white_color);
    text-decoration: none;
    font-size: 0.8em;
    font-family: 'El Messiri', sans-serif;
    font-weight: bold;
    padding: 6px 18px;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    margin: 0 1px;
    /* اللون الأزرق الافتراضي للزر */
    background-color: #29aae1; 
}

/* --- 2. تأثير التمرير (Hover) للأزرار الرئيسية --- */
.main-nav ul li a:hover {
    /* تغيير الخلفية إلى الأبيض لإبراز قوي جداً */
    background-color: var(--white_color);
    /* تغيير لون النص إلى الأزرق الداكن ليظل واضحاً */
    color: var(--primary_dark_color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* --- 3. العنصر النشط (لا تغيير هنا) --- */
.main-nav ul li.active a {
    background-color: var(--white_color);
    color: var(--primary_dark_color);
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* --- 4. إعادة تنسيق روابط القائمة المنسدلة --- */
.main-nav ul li.has-dropdown .dropdown-menu li a {
    background-color: transparent;
    color: var(--text_color);
    font-family: 'El Messiri', sans-serif !important; /* <<<<<< تم إضافة !important هنا */
    font-weight: 500 !important; /* من الأفضل إضافتها هنا أيضاً لضمان تطبيق الوزن الصحيح */
}

/* --- 5. تأثير التمرير لروابط القائمة المنسدلة --- */
.main-nav ul li.has-dropdown .dropdown-menu li a:hover {
    background-color: #f0f4f8; 
    color: var(--primary_dark_color);
}

.mobile-menu-toggle {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: var(--primary_dark_color); /* استخدم لونًا ثابتًا من المتغيرات */
    border: none; /* إزالة الحدود */
    border-radius: 4px; /* جعلها مربعة بحواف دائرية خفيفة */
    color: var(--white_color);
    font-size: 1.3em;
    cursor: pointer;
    z-index: 1001;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    box-shadow: none; /* إزالة الظل */
    backdrop-filter: none; /* إزالة تأثير الفلتر */
    display: none;
}

.mobile-menu-toggle:hover {
    background: var(--primary_color); /* لون hover أبسط */
    border-color: none;
    transform: translateY(-50%) scale(1.05); /* تأثير تكبير بسيط */
    box-shadow: none;
}

/* إعدادات الاستجابة للقائمة */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .main-nav ul {
        display: none;
    }
	
	    .main-nav {
        background-color: transparent; /* لجعل خلفية الشريط شفافة على الهاتف */
        padding: 0; /* لإزالة أي حشوة تسبب ظهور مساحة غير مرئية */
    }

}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }

    .main-nav ul {
        display: block;
    }
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.mobile-nav-sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--primary_dark_color);
    z-index: 1001;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-nav-sidebar.active {
    right: 0;
}

.mobile-nav-header {
    background: var(--primary_color);
    padding: 10px;
    text-align: center;
    color: var(--white_color);
    font-family: 'El Messiri', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.2;
}

.mobile-nav-close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: none;
    border: none;
    color: var(--white_color);
    font-size: 1.3em;
    cursor: pointer;
}

.mobile-nav-menu {
    list-style: none;
    padding: 15px 0;
}

.mobile-nav-menu li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-nav-menu li a {
    display: block;
    padding: 12px 18px;
    color: var(--white_color);
    text-decoration: none;
    font-family: 'Cairo', sans-serif;
    font-weight: 500;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.mobile-nav-menu li a:hover {
    background: rgba(255,255,255,0.1);
}

/* Main Content Area */
.main-content-area {
    display: flex;
    flex-grow: 1;
    flex-wrap: wrap;
    padding: 20px;
}

/* Sidebar Styles */
.sidebar {
    flex: 1;
    min-width: 250px;
    background-color: #f0f0f0; /* يمكنك ربط هذا بالمتغير --right_bg_color */
    padding: 18px;
    margin-inline-end: 18px;
}

.sidebar h3 {
    color: var(--primary_dark_color);
    margin-bottom: 12px;
    border-bottom: 2px solid var(--primary_color);
    padding-bottom: 6px;
    font-family: 'El Messiri', sans-serif;
    font-size: 1.2em;
    font-weight: 600;
}

.sidebar ul {
    list-style: none;
    margin-bottom: 18px;
}

.sidebar ul li {
    margin-bottom: 6px;
}

.sidebar ul li a {
    text-decoration: none;
    color: var(--secondary_text_color);
    padding: 6px 0;
    display: block;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9em;
    border-radius: 4px;
    padding-right: 8px;
}

.sidebar ul li a:hover {
    color: var(--primary_color);
    background: rgba(96, 125, 107, 0.1); /* ظل أخضر خفيف */
    transform: translateX(-3px);
}

/* Social Icons محسنة */
.social-icons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary_color) 0%, var(--primary_dark_color) 100%);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(96, 125, 107, 0.3);
}

.social-icons a {
    transition: transform 0.3s ease;
    border-radius: 50%;
    overflow: hidden;
}

.social-icons a:hover {
    transform: scale(1.05) rotate(3deg);
}

.social-icons img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

/* Search Form Sidebar محسنة */
.search-form-sidebar {
    margin-bottom: 12px;
    background: white;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.search-form-sidebar input[type="text"] {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.8em;
    transition: all 0.3s ease;
    background: #fafafa;
}

.search-form-sidebar input[type="text"]:focus {
    border-color: var(--primary_color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(96, 125, 107, 0.1);
}

.search-form-sidebar input[type="submit"] {
    width: 100%;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary_color) 0%, var(--primary_dark_color) 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.8em;
    transition: all 0.3s ease;
    margin-bottom: 6px;
}

.search-form-sidebar input[type="submit"]:hover {
    background: linear-gradient(135deg, var(--primary_dark_color) 0%, var(--primary_color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(96, 125, 107, 0.4);
}

.search-form-sidebar select {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 0.8em;
    transition: all 0.3s ease;
}

.search-form-sidebar select:focus {
    border-color: var(--primary_color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(96, 125, 107, 0.1);
}

/* Latest / Mixed Articles Sidebar */
.latest-articles-sidebar,
.mixed-articles-sidebar {
    margin-bottom: 20px;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.latest-articles-sidebar ul,
.mixed-articles-sidebar ul {
    margin: 0;
}

.latest-articles-sidebar li,
.mixed-articles-sidebar li {
    padding: 0px 0;
    border-bottom: 1px solid #f0f0f0;
}

.latest-articles-sidebar li:last-child,
.mixed-articles-sidebar li:last-child {
    border-bottom: none;
}

/* Statistics List */
.stats-list {
    list-style: none;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.stats-list li {
    font-size: 0.9em;
    color: var(--secondary_text_color);
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-right: 3px solid var(--primary_color);
    font-family: 'Cairo', sans-serif;
    font-weight: 500;
}

/* Sidebar Banners محسنة */
.sidebar-banner {
    text-align: center;
    margin-bottom: 18px;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    transition: transform 0.3s ease;
}

.sidebar-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.sidebar-banner img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    transition: all 0.3s ease;
    filter: brightness(0.95);
}

.sidebar-banner:hover img {
    filter: brightness(1);
    transform: scale(1.01);
}

/* Content Section Styles */
.content-section {
    flex: 3;
    min-width: 300px;
    background-color: #fff;
    padding: 18px;
    border: 1px solid #eee;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.content-section h1,
.content-section h2 {
    color: var(--primary_dark_color);
    margin-bottom: 18px;
    font-family: 'El Messiri', sans-serif;
}

/* Separator Lines */
.separator-line {
    border-top: 1px dashed #ddd;
    margin: 15px 0;
}

.search-line-separator {
    border-top: 1px solid #ccc;
    margin: 12px 0;
    height: 1px;
}

/* Footer Styles */
.main-footer {
    background-color: var(--primary_dark_color);
    color: #fff;
    text-align: center;
    padding: 15px;
    margin-top: auto;
    margin-bottom: 0;
    flex-shrink: 0;
}

.main-footer a {
    color: #fff;
    text-decoration: none;
}

.main-footer a:hover {
    text-decoration: underline;
}

/* تحسينات للصفحات الجديدة */
.main-section-header h1,
.section-header h1 {
    font-family: 'El Messiri', sans-serif;
    font-size: 1.6em;
    margin: 18px 0;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.subsections-container {
    margin: 25px 0;
}

.subsections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 18px 0;
}

.subsection-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.subsection-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

.subsection-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.2em;
}

.subsection-card h3 a {
    color: #333;
    text-decoration: none;
    font-family: 'Amiri', serif;
}

.subsection-card h3 a:hover {
    color: var(--primary_color);
}

.subsection-meta {
    color: var(--light_text_color);
    font-size: 0.85em;
}

.article-count {
    background: var(--primary_color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75em;
}

.section-summary {
    text-align: center;
    margin: 25px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    color: var(--light_text_color);
}

.no-content {
    text-align: center;
    padding: 30px 18px;
    color: var(--light_text_color);
    background: #f8f9fa;
    border-radius: 6px;
    margin: 18px 0;
}

.error-message {
    background: #ffe0e0;
    color: #d8000c;
    border: 1px solid #d8000c;
    padding: 18px;
    border-radius: 6px;
    text-align: center;
    margin: 18px 0;
}

/* تحسين الـ Pagination */
.pagination {
    margin: 30px 0;
    text-align: center;
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.pagination-link,
.pagination-current {
    display: inline-block;
    padding: 6px 10px;
    margin: 0 1px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.pagination-link {
    color: #333;
    background: #fff;
}

.pagination-link:hover {
    background: var(--primary_color);
    color: white;
    border-color: var(--primary_color);
}

.pagination-current {
    background: var(--primary_color);
    color: white;
    border-color: var(--primary_color);
    font-weight: bold;
}

.pagination-ellipsis {
    padding: 6px 3px;
    color: var(--light_text_color);
}

.pagination-info {
    color: var(--light_text_color);
    font-size: 0.85em;
    margin-top: 8px;
}

/* أنماط نموذج إضافة التعليق */
.addnote-container {
    width: 100%;
    font-family: 'Cairo', sans-serif;
    font-size: 10pt;
    padding: 8px;
}

.comment-form {
    max-width: 600px;
    margin: 15px auto;
    border: 1px solid #eee;
    box-shadow: 0 0 6px rgba(0,0,0,0.1);
    background-color: #fff;
    padding: 0;
    direction: rtl;
}

.form-title {
    text-align: center;
    padding: 8px;
    font-size: 11pt;
    font-weight: bold;
    margin-bottom: 12px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 6px 12px;
    margin-bottom: 8px;
}

.form-row.full-width {
    flex-direction: column;
    align-items: flex-start;
}

.form-label {
    flex: 0 0 110px;
    padding-inline-end: 8px;
    font-weight: bold;
    color: #333;
    font-size: 0.9em;
}

.form-input,
.form-textarea {
    flex: 1;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: 'Cairo', sans-serif;
    font-size: 9pt;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    width: 100%;
    margin-top: 4px;
}

.form-input[type="text"] {
    max-width: calc(100% - 120px);
}

.form-row.full-width .form-label {
    flex: none;
    width: 100%;
    margin-bottom: 4px;
    text-align: right;
}

.form-actions {
    text-align: center;
    padding: 12px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

.form-button {
    padding: 8px 20px;
    background-color: var(--primary_color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 10pt;
    transition: background-color 0.3s ease;
}

.form-button:hover {
    background-color: var(--primary_dark_color);
}

.message {
    padding: 15px;
    margin: 15px auto;
    text-align: center;
    border-radius: 4px;
    font-family: 'Cairo', sans-serif;
    font-size: 10pt;
    max-width: 600px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.success-message {
    background-color: #e0ffe0;
    color: #008000;
    border: 1px solid #008000;
}

/* Responsive Design */
@media (max-width: 992px) {
    .main-content-area {
        padding: 12px;
    }

    .sidebar {
        min-width: 180px;
        margin-inline-end: 12px;
    }

    .content-section {
        padding: 12px;
    }

    .main-nav ul li {
        margin: 0 8px;
    }
}

@media (max-width: 768px) {
    .main-content-area {
        flex-direction: column;
    }

    .sidebar {
        margin-inline-end: 0;
        margin-bottom: 15px;
        width: 100%;
        min-width: unset;
        order: 2;
    }

    .content-section {
        width: 100%;
        min-width: unset;
        order: 1;
    }

    .subsections-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pagination-container {
        flex-direction: column;
        gap: 8px;
    }

    .pagination-link,
    .pagination-current {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 6px 8px;
    }

    .form-label {
        flex: none;
        width: 100%;
        padding-inline-end: 0;
        margin-bottom: 4px;
    }

    .form-input,
    .form-textarea {
        width: 100%;
        max-width: 100%;
    }

    .form-actions {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.85em;
    }

    .sidebar h3 {
        font-size: 1em;
    }

    .content-section h1,
    .content-section h2 {
        font-size: 1.3em;
    }

    .mobile-nav-sidebar {
        width: 260px;
        right: -260px;
    }

    .social-icons {
        flex-wrap: wrap;
        gap: 4px;
    }

    .social-icons img {
        width: 28px;
        height: 28px;
    }

    .addnote-container {
        padding: 4px;
    }

    .comment-form {
        margin: 8px auto;
    }

    .form-title {
        font-size: 10pt;
        padding: 6px;
    }

    .form-input,
    .form-textarea {
        font-size: 8pt;
        padding: 4px;
    }

    .form-button {
        font-size: 9pt;
        padding: 6px 15px;
    }
}
/* Desktop Dropdown Menus - أنماط القوائم المنسدلة للكمبيوتر */
.main-nav ul li.has-dropdown {
    position: relative;
}

.main-nav ul li.has-dropdown .dropdown-menu {
    display: block; /* تغيير للتحكم بالظهور عبر opacity و transform */
    position: absolute;
    top: 120%; /* مسافة صغيرة أسفل الزر الرئيسي */
    right: 0;
    background-color: var(--white_color);
    min-width: 220px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    border-radius: 8px; /* حواف دائرية ناعمة */
    overflow: hidden;
    opacity: 0; /* إخفاء افتراضي */
    transform: translateY(10px); /* تحريك للأسفل قليلاً */
    visibility: hidden; /* إخفاء كامل */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.main-nav ul li.has-dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1; /* إظهار عند التمرير */
    transform: translateY(0); /* إعادة للمكان الأصلي */
    top: 110%; /* تحديث الموضع النهائي */
    visibility: visible;
}

.main-nav ul li.has-dropdown .dropdown-menu li {
    display: block;
    margin: 0;
}

.main-nav ul li.has-dropdown .dropdown-menu li a {
    padding: 10px 20px;
    color: var(--text_color); /* لون نص داكن للوضوح */
    font-size: 0.9em;
    font-family: 'Cairo', sans-serif; /* استخدام خط المحتوى */
    text-align: right;
    display: block;
    border-radius: 0; /* إزالة دائرية الحواف الداخلية */
    font-weight: 500;
}

.main-nav ul li.has-dropdown .dropdown-menu li:last-child a {
    border-bottom: none;
}

.main-nav ul li.has-dropdown .dropdown-menu li a:hover {
    background-color: #f0f4f8; /* لون خلفية خفيف عند التمرير */
    color: var(--primary_dark_color);
    transform: none;
    box-shadow: none;
    padding-right: 25px; /* تأثير حركة للنص لليمين */
}


/* Dropdown Toggle Icon for desktop - أيقونة التبديل للقائمة المنسدلة على الكمبيوتر */
.main-nav ul li.has-dropdown .dropdown-toggle-icon {
    font-size: 0.7em; /* حجم أصغر للأيقونة */
    margin-inline-start: 5px; /* مسافة من النص */
    transition: transform 0.3s ease; /* انتقال ناعم للدوران */
}

.main-nav ul li.has-dropdown:hover .dropdown-toggle-icon {
    transform: rotate(180deg); /* تدوير الأيقونة عند التمرير */
}

/* Mobile Sub-menu Styles (Accordion) - أنماط القوائم الفرعية للهاتف (الأكورديون) */
.mobile-nav-menu .mobile-sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0,0,0,0.1); /* خلفية مختلفة قليلاً للعناصر الفرعية */
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    overflow: hidden; /* لطمس الانتقال عند الطي */
}

.mobile-nav-menu .mobile-sub-menu li a {
    padding: 10px 30px; /* مسافة بادئة للعناصر الفرعية */
    font-size: 0.85em;
    background: rgba(0,0,0,0.05); /* خلفية أغمق قليلاً للعناصر الفرعية الفرعية */
}

.mobile-nav-menu .mobile-sub-menu li a:hover {
    background: rgba(0,0,0,0.15);
}

/* Mobile Toggle Icon (for both main and sidebar for consistency) - أيقونة التبديل للهاتف (للقائمة الرئيسية والقائمة الجانبية للتناسق) */
.mobile-toggle-icon,
.sidebar .toggle-icon {
    float: left; /* محاذاة لليسار في RTL */
    margin-inline-start: 0; /* إعادة تعيين */
    margin-inline-end: auto; /* دفع لليمين */
    font-size: 0.7em;
    transition: transform 0.3s ease;
    line-height: inherit; /* محاذاة مع ارتفاع السطر النصي */
    vertical-align: middle;
    padding-inline-start: 10px; /* مساحة للنقر */
    color: rgba(255,255,255,0.7); /* لون أفتح */
}

.sidebar .toggle-icon {
    color: var(--secondary_text_color); /* لون أيقونة الشريط الجانبي */
    float: right; /* إعادة تعيين المحاذاة لليمين للشريط الجانبي */
    padding-inline-start: 0;
    padding-inline-end: 10px;
}

/* Icon rotation for active/open state - تدوير الأيقونة للحالة النشطة/المفتوحة */
.mobile-toggle-icon.rotated,
.sidebar .toggle-icon.rotated {
    transform: rotate(180deg);
}


/* إضافة مسافة سفلية لصفحة subject.php فقط */
body[class*="subject"], 
.subject-page,
html[data-page="subject"] body {
    padding-bottom: 0px !important;
}


    /* ============================================== */
    /* == أنماط عرض عينة التعليقات في صفحة المقال == */
    /* ============================================== */

    .comments-list-preview {
        margin-top: 30px;
        border-top: 1px solid #e9ecef; /* خط فاصل علوي */
        padding-top: 20px;
text-align: right;
    }

    .comment-item-preview {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 8px;
        border: 1px solid #e0e0e0; /* استخدام إطار بدلاً من الظل ليتناسب مع أي خلفية */
        border-right: 4px solid var(--primary_color, #607d6b);
    }

    .comment-header-preview {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        padding-bottom: 10px;
        margin-bottom: 15px;
        border-bottom: 1px solid #f1f1f1;
    }

    .comment-number-preview {
        background: var(--primary_color, #607d6b);
        color: white;
        min-width: 28px;
        height: 28px;
        border-radius: 50%; /* شكل دائري */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9em;
        font-weight: bold;
    }

    .comment-meta-preview {
        color: #555;
        font-size: 0.9em;
    }

    .comment-author-preview a {
        font-weight: bold;
        color: #111;
        text-decoration: none;
    }
    .comment-author-preview a:hover {
        color: var(--primary_color, #607d6b);
    }

    .comment-subject-preview {
        color: var(--primary_color, #607d6b);
        font-weight: bold;
        font-size: 1.1em;
        margin: 0 0 10px 0;
    }

    .comment-body-preview {
        line-height: 1.7;
        color: #333;
        word-wrap: break-word;
text-align: justify;
    }

 /* ايقونة التشغيل لليوتيوب في الصفحة الرئيسية */
 
 .media-container {
    position: relative;
    overflow: hidden; /* يضمن عدم خروج الصورة من الإطار الدائري */
}

.media-container .play-icon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4em;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.article-preview:hover .media-container .play-icon-overlay {
    opacity: 1;
}


/* === بداية: الحل النهائي لمشكلة فيديو يوتيوب على الهاتف === */

.responsive-iframe-container,
.article-content div[style*="padding-bottom: 56.25%"] {
    position: relative;
    overflow: hidden;
    width: 100%;
    border-radius: 8px; 
    margin-bottom: 1.5em; 
}

.responsive-iframe-container iframe,
.article-content div[style*="padding-bottom: 56.25%"] iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 768px) {
    #article-content {
        padding-left: 5px;
        padding-right: 5px;
    }
}
/* === نهاية: الحل النهائي لمشكلة فيديو يوتيوب === */

/* === بداية: الحل النهائي لقسم التنقل بين المواضيع === */

.improved-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 0px;
    padding-top: 0px;
}

.improved-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 15px; 
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0;
}

.improved-nav .nav-link:hover {
    border-color: var(--primary_color, #607d6b);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}

.improved-nav .nav-thumb {
    width: 180px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0; 
    transition: transform 0.3s ease;
}

.improved-nav .nav-link:hover .nav-thumb {
    transform: scale(1.05); 
}

.improved-nav .nav-text {
    line-height: 1.5;
}

.improved-nav .nav-text strong {
    font-size: 0.9em;
    color: #555;
    display: block;
    margin-bottom: 5px;
}

.improved-nav .nav-text span {
    font-size: 1em;
    font-weight: 500;
    color: #222;
}

.improved-nav .nav-link.next {
    text-align: left;
}

@media (max-width: 768px) {
    .improved-nav {
        flex-direction: column; 
    }

    .improved-nav .nav-thumb {
        width: 140px;
        height: 100px;
    }

    .improved-nav .nav-text span {
        font-size: 0.9em; 
    }
}
/* === نهاية: الحل النهائي لقسم التنقل === */


/* تنسيقات حاوية البحث المرنة الجديدة */
.search-flex-container {
    display: flex;         /* تفعيل نظام Flexbox */
    flex-wrap: wrap;       /* السماح للعناصر بالنزول لسطر جديد عند ضيق المساحة */
    gap: 15px;             /* مسافة ثابتة بين العناصر */
}

/* جعل حقل البحث وقائمة الأقسام ينموان ليملآ المساحة */
.search-flex-container > input[type="text"],
.search-flex-container > select {
    flex-grow: 1;          /* السماح للعنصر بالنمو */
    flex-basis: 200px;     /* تحديد عرض أساسي قبل الالتفاف (مفيد للشاشات الصغيرة) */
}

/* تنسيق زر البحث ليكون متناسقاً */
.search-flex-container > input[type="submit"] {
    flex-shrink: 0;        /* منع الزر من التقلص */
}


/* تنسيق حاوية خيار البحث الدقيق */
.checkbox-wrapper {
    display: flex;         /* لمحاذاة الصندوق والعنوان */
    align-items: center;   /* توسيط عمودي */
    gap: 8px;              /* مسافة بين الصندوق والعنوان */
    flex-shrink: 0;        /* منعه من التقلص ليحافظ على شكله */
    white-space: nowrap;   /* لمنع التفاف النص داخل العنوان */
}

.checkbox-wrapper label {
    margin: 0;             /* إزالة أي هوامش افتراضية من العنوان */
    cursor: pointer;
}


/*
 * تنسيقات تلوين نتائج البحث (نسخة محسنة وأكثر تحديدًا)
 * ========================================================
*/

/* 1. تلوين الكلمة في نص النتيجة */
.search-result-item .search-result-content .search-highlight-body {
    background-color: #FFF9C4 !important; /* لون خلفية أصفر فاتح */
    color: #5D4037 !important;             /* لون نص بني داكن */
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* 2. تلوين الكلمة في عنوان النتيجة (إذا كان رابطًا) */
.search-result-item .search-result-title a .search-highlight-title {
    color: var(--primary_color) !important; /* استخدام اللون الرئيسي للموقع */
    background-color: transparent !important;
    text-decoration: underline;
    font-weight: bold;
}

/* 3. تلوين الكلمة في عنوان النتيجة (إذا لم يكن رابطًا) */
.search-result-item .search-result-title .search-highlight-title {
    color: var(--primary_color) !important;
    background-color: transparent !important;
    font-weight: bold;
}

/* ======================================= */
/* ==   تنسيقات خاصة بالسؤال والجواب   == */
/* ======================================= */

.qa-container {
    margin: 25px 0;
    border: 1px solid #dee2e6; /* إطار خفيف حول الحاوية كلها */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.qa-question {
    background-color: #f8f9fa; /* خلفية بلون رمادي فاتح جدًا للسؤال */
    padding: 20px;
    border-bottom: 1px dashed #ced4da; /* خط فاصل منقط */
}

.qa-answer {
    background-color: #ffffff; /* خلفية بيضاء للجواب */
    padding: 20px;
}

.qa-label {
    display: block;
    font-family: 'El Messiri', sans-serif; /* استخدام خط العناوين المميز */
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 15px;
}

.qa-question .qa-label {
    color: var(--primary_dark_color, #013a63); /* لون أزرق داكن لكلمة "السؤال" */
}

.qa-answer .qa-label {
    color: var(--primary_color, #2a6f97); /* لون أزرق أساسي لكلمة "الجواب" */
}

.qa-content p {
    margin-bottom: 0.5em !important;
    text-indent: 0 !important; /* إلغاء المسافة البادئة للفقرات هنا إذا لزم الأمر */
}

.qa-content {
    font-family: 'Noto Naskh Arabic', serif;
    line-height: 1.8;
    color: #333;
}
