/**
 * nav.css
 * تنسيقات شريط التنقل — القائمة الرئيسية والموبايل
 * بوابة الوحدة العربية للأخبار
 * =========================================
 * الأقسام:
 *  1. شريط التنقل الرئيسي (Navbar)
 *  2. القائمة الرئيسية — ديسكتوب
 *  3. القوائم الفرعية — ديسكتوب
 *  4. زر الهامبرجر (Hamburger)
 *  5. القائمة الجانبية — موبايل
 *  6. القوائم الفرعية — موبايل
 *  7. طبقة التغطية (Overlay)
 *  8. أزرار الدخول والتسجيل
 *  9. أنيميشن وتأثيرات
 * =========================================
 */


/* =========================================
   1. شريط التنقل الرئيسي
   ========================================= */
   .navbar {
    background: linear-gradient(135deg, #1a0000 0%, #cc0000 40%, #960000 100%);
    padding: 0;
    position: relative;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
    border-bottom: 3px solid #d4af37;
    z-index: 1000;
}

.navbar .container {
    padding-left: 15px;
    padding-right: 15px;
}

.navbar-container {
    min-height: 54px;
}


/* =========================================
   2. القائمة الرئيسية — ديسكتوب
   ========================================= */
.menu-container {
    width: 100%;
}

.main-menu {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;
    align-items: stretch;
}

.main-menu > li {
    position: relative;
}

.main-menu > li > a,
.main-menu > li > a.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 14px;
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.25s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.main-menu > li > a:hover,
.main-menu > li.active > a {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-bottom-color: #d4af37;
}

/* أيقونة السهم للقوائم الفرعية */
.main-menu .has-children > a .fa-angle-down {
    font-size: 11px;
    opacity: 0.75;
    transition: transform 0.25s ease;
    margin-right: 2px;
}

.main-menu .has-children:hover > a .fa-angle-down {
    transform: rotate(180deg);
    opacity: 1;
}

/* أيقونة التلفزيون */
.main-menu .nav-item a .fa-tv {
    color: #d4af37;
}


/* =========================================
   3. القوائم الفرعية — ديسكتوب
   ========================================= */
.sub-menu {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1100;
    list-style: none;
    padding: 6px 0;
    margin: 0;
    border-top: 3px solid #cc0000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

/* جسر شفاف يمنع اختفاء القائمة عند التحريك */
.main-menu > li.has-children::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 10px;
    background: transparent;
}

@media (min-width: 992px) {
    .main-menu .has-children:hover > .sub-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* القائمة الفرعية الثانية */
    .sub-menu .sub-menu {
        top: -6px;
        right: 100%;
        border-top: none;
        border-right: 3px solid #cc0000;
        border-radius: 8px 0 8px 8px;
        transform: translateX(6px);
    }

    .sub-menu .has-children:hover > .sub-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    /* جسر شفاف للقائمة الفرعية الثانية */
    .sub-menu .has-children::after {
        content: '';
        position: absolute;
        top: 0;
        right: -10px;
        width: 10px;
        height: 100%;
        background: transparent;
    }

    /* سهم القائمة الفرعية الثانية */
    .sub-menu .has-children > a .fa-angle-left {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 11px;
        opacity: 0.6;
        transition: opacity 0.2s, transform 0.2s;
    }

    .sub-menu .has-children:hover > a .fa-angle-left {
        opacity: 1;
        transform: translateY(-50%) translateX(-3px);
    }
}

.sub-menu > li {
    position: relative;
}

.sub-menu > li > a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
}

.sub-menu > li > a:hover,
.sub-menu > li.active > a {
    background: rgba(204,0,0,0.05);
    color: #cc0000;
    border-right-color: #cc0000;
    padding-right: 20px;
}

/* فاصل خفيف بين عناصر القائمة الفرعية */
.sub-menu > li:not(:last-child) > a {
    border-bottom: 1px solid rgba(0,0,0,0.04);
}


/* =========================================
   4. زر الهامبرجر (Hamburger)
   ========================================= */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    transition: all 0.25s ease;
    flex-shrink: 0;
    z-index: 10;
}

.navbar-toggle:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.45);
}

.navbar-toggle .fa-bars {
    color: #fff;
    font-size: 18px;
    transition: transform 0.3s ease;
}

/* عندما تكون القائمة مفتوحة */
.navbar-toggle.is-open .fa-bars {
    transform: rotate(90deg);
}

@media (max-width: 991px) {
    .navbar-toggle {
        display: flex;
    }
}


/* =========================================
   5. القائمة الجانبية — موبايل
   ========================================= */
@media (max-width: 991px) {

    .main-menu {
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;           /* مخفية خارج الشاشة — RTL */
        left: auto;
        width: min(300px, 85vw);
        height: 100dvh;         /* dynamic viewport height */
        background: linear-gradient(180deg, #0d0d0d 0%, #1a0000 100%);
        z-index: 1200;
        overflow-y: auto;
        overflow-x: hidden;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 70px;      /* مساحة لزر الإغلاق */
        padding-bottom: 30px;
        scrollbar-width: thin;
        scrollbar-color: #cc0000 transparent;
        box-shadow: -6px 0 24px rgba(0,0,0,0.5);
        border-left: 1px solid rgba(212,175,55,0.2);
    }

    .main-menu::-webkit-scrollbar {
        width: 3px;
    }

    .main-menu::-webkit-scrollbar-thumb {
        background: #cc0000;
        border-radius: 3px;
    }

    /* القائمة مفتوحة — RTL */
    .main-menu.active {
        right: 0;
        left: auto;
    }

    /* LTR — القائمة تيجي من الشمال */
    [dir="ltr"] .main-menu {
        right: auto;
        left: -100%;
    }

    [dir="ltr"] .main-menu.active {
        left: 0;
        right: auto;
    }

    /* الشعار المصغر أعلى القائمة — LTR */
    [dir="ltr"] .main-menu::before {
        right: auto;
        left: 0;
    }

    /* زر الإغلاق — LTR */
    [dir="ltr"] .nav-close {
        left: auto;
        right: 12px;
    }

    /* شعار مصغر أعلى القائمة */
    .main-menu::before {
        content: '';
        position: fixed;
        top: 0;
        right: 0;
        width: min(300px, 85vw);
        height: 60px;
        background: linear-gradient(135deg, #1a0000 0%, #cc0000 100%);
        border-bottom: 2px solid #d4af37;
        z-index: 1;
        pointer-events: none;
    }

    /* زر الإغلاق */
    .nav-close {
        position: fixed;
        top: 12px;
        left: 12px;
        width: 36px;
        height: 36px;
        background: rgba(255,255,255,0.15);
        border: 1px solid rgba(255,255,255,0.3);
        border-radius: 50%;
        color: #fff;
        font-size: 15px;
        cursor: pointer;
        z-index: 1300;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.25s ease;
    }

    .nav-close:hover {
        background: #cc0000;
        border-color: #cc0000;
        transform: rotate(90deg);
    }

    /* عناصر القائمة الرئيسية على الموبايل */
    .main-menu > li {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .main-menu > li:last-of-type {
        border-bottom: none;
    }

    .main-menu > li > a,
    .main-menu > li > a.nav-link {
        padding: 15px 20px;
        color: rgba(255,255,255,0.88);
        font-size: 15px;
        font-weight: 600;
        border-bottom: none;
        border-right: 3px solid transparent;
        justify-content: space-between;
        transition: all 0.2s ease;
    }

    .main-menu > li > a:hover,
    .main-menu > li.active > a {
        background: rgba(204,0,0,0.2);
        color: #fff;
        border-right-color: #d4af37;
        padding-right: 26px;
    }

    /* السهم على اليسار للقوائم ذات الأبناء */
    .main-menu .has-children > a .fa-angle-down {
        position: static;
        font-size: 13px;
        opacity: 0.6;
        margin-right: 0;
        transition: transform 0.3s ease;
    }

    .main-menu .has-children.sub-open > a .fa-angle-down {
        transform: rotate(180deg);
        opacity: 1;
        color: #d4af37;
    }
}


/* =========================================
   6. القوائم الفرعية — موبايل
   ========================================= */
@media (max-width: 991px) {

    .main-menu .sub-menu {
        position: static;
        width: 100%;
        min-width: unset;
        box-shadow: none;
        background: rgba(0,0,0,0.25);
        border-radius: 0;
        border-top: none;
        border-right: none;
        padding: 4px 0;
        margin: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        transition: none;
        overflow: hidden;
    }

    /* القائمة الفرعية مفتوحة */
    .main-menu .sub-menu.sub-menu-open {
        display: block;
        animation: slideDown 0.25s ease forwards;
    }

    /* القائمة الفرعية الثانية */
    .sub-menu .sub-menu {
        background: rgba(0,0,0,0.2);
        border-right: none;
        border-radius: 0;
    }

    /* روابط المستوى الأول من القائمة الفرعية */
    .main-menu > li > .sub-menu > li > a {
        padding: 12px 32px;
        color: rgba(255,255,255,0.75);
        font-size: 14px;
        font-weight: 500;
        border-bottom: 1px solid rgba(255,255,255,0.04);
        border-right: none;
        white-space: normal;
        line-height: 1.4;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .main-menu > li > .sub-menu > li > a:hover,
    .main-menu > li > .sub-menu > li.active > a {
        background: rgba(204,0,0,0.15);
        color: #d4af37;
        border-right: none;
        padding-right: 38px;
    }

    /* روابط المستوى الثاني */
    .sub-menu .sub-menu > li > a {
        padding: 10px 46px;
        color: rgba(255,255,255,0.6);
        font-size: 13px;
        border-right: none;
        white-space: normal;
        line-height: 1.4;
    }

    .sub-menu .sub-menu > li > a:hover {
        background: rgba(204,0,0,0.1);
        color: rgba(255,255,255,0.9);
        border-right: none;
        padding-right: 52px;
    }

    /* السهم للقوائم الفرعية ذات الأبناء */
    .sub-menu .has-children > a .fa-angle-left {
        position: static;
        font-size: 12px;
        transform: none;
        opacity: 0.5;
        transition: transform 0.25s ease;
    }

    .sub-menu .has-children.sub-open > a .fa-angle-left {
        transform: rotate(-90deg);
        opacity: 1;
        color: #d4af37;
    }
}


/* =========================================
   7. طبقة التغطية (Overlay)
   ========================================= */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}


/* =========================================
   8. أزرار الدخول والتسجيل
   ========================================= */
.navbar-actions .btn-outline-light {
    border-color: rgba(255,255,255,0.5);
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    padding: 5px 14px;
    transition: all 0.25s ease;
}

.navbar-actions .btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
    color: #fff;
}

.navbar-actions .btn-primary {
    background: #d4af37;
    border-color: #d4af37;
    color: #111;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 14px;
    transition: all 0.25s ease;
}

.navbar-actions .btn-primary:hover {
    background: #c49b2a;
    border-color: #c49b2a;
    transform: translateY(-1px);
}

/* أزرار الموبايل داخل القائمة */
@media (max-width: 991px) {
    .navbar-actions.d-block.d-lg-none {
        padding: 16px 20px;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 8px;
        display: flex;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }
}


/* =========================================
   9. أنيميشن وتأثيرات
   ========================================= */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* منع scroll الصفحة لما القائمة مفتوحة */
body.nav-open {
    overflow: hidden;
}


/* =========================================
   10. أيقونات روابط القائمة
   ========================================= */

/* أيقونة موحدة لكل الروابط */
.main-menu > li > a .fa-home,
.main-menu > li > a .fa-newspaper,
.main-menu > li > a .nav-icon {
    font-size: 13px;
    opacity: 0.75;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.main-menu > li > a:hover .fa-home,
.main-menu > li > a:hover .fa-newspaper,
.main-menu > li > a:hover .nav-icon,
.main-menu > li.active > a .fa-home,
.main-menu > li.active > a .fa-newspaper,
.main-menu > li.active > a .nav-icon {
    opacity: 1;
    color: #d4af37;
}

/* أيقونة fa-tv بنفس نمط الباقي */
.main-menu > li > a .fa-tv {
    color: inherit;
    opacity: 0.75;
    font-size: 13px;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.main-menu > li > a:hover .fa-tv,
.main-menu > li.active > a .fa-tv {
    opacity: 1;
    color: #d4af37;
}

/* على الموبايل الأيقونات أكبر شوية */
@media (max-width: 991px) {
    .main-menu > li > a .fa-home,
    .main-menu > li > a .fa-newspaper,
    .main-menu > li > a .nav-icon,
    .main-menu > li > a .fa-tv {
        font-size: 14px;
        width: 20px;
        text-align: center;
    }
}

/* LTR — عكس اتجاه أيقونة chevron */
[dir="ltr"] .main-menu > li > a .nav-icon.fa-chevron-left {
    transform: rotate(180deg);
}