/* Header nav dropdowns — أقسام المجلة / عن المجلة */

.nav-item-dropdown {
    position: relative;
}

.nav-link-parent .nav-caret {
    font-size: 10px;
    margin-inline-start: 6px;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.nav-item-dropdown:hover .nav-caret,
.nav-item-dropdown.is-open .nav-caret {
    transform: rotate(180deg);
}

.header .nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 280px;
    width: max-content;
    max-width: min(360px, 90vw);
    white-space: normal;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 61, 107, 0.16);
    padding: 10px;
    margin: 0;
    z-index: 400;
    border: 1px solid rgba(0, 91, 154, 0.08);
    list-style: none;
    overflow: visible;
}

.header .nav-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 28px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-top: 1px solid rgba(0, 91, 154, 0.08);
    border-right: 1px solid rgba(0, 91, 154, 0.08);
    transform: rotate(-45deg);
}

/* Open only with .is-open (JS). Mouse leave removes it so the menu hides. */
.header .nav-item-dropdown.is-open > .nav-dropdown {
    display: block;
    animation: aboutNavIn 0.18s ease;
}

@keyframes aboutNavIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.header .nav-dropdown li {
    list-style: none;
    margin: 0;
}

.header .nav-dropdown a {
    display: block;
    padding: 11px 14px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-radius: 8px;
    text-decoration: none;
}

.header .nav-dropdown a:hover {
    background: linear-gradient(135deg, rgba(0, 91, 154, 0.08), rgba(201, 163, 78, 0.12));
    color: #005B9A;
}

/* Page section dropdown */
.about-dropdown {
    position: relative;
    max-width: 320px;
    margin: 0 0 28px;
    z-index: 20;
}

.about-dropdown-toggle {
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid rgba(0, 91, 154, 0.15);
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 4px 14px rgba(0, 61, 107, 0.08);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #005B9A;
    transition: all 0.25s ease;
}

.about-dropdown-toggle:hover,
.about-dropdown.is-open .about-dropdown-toggle {
    border-color: #005B9A;
    box-shadow: 0 8px 20px rgba(0, 61, 107, 0.12);
}

.about-dropdown-toggle i {
    font-size: 12px;
    color: #C9A34E;
    transition: transform 0.2s ease;
}

.about-dropdown.is-open .about-dropdown-toggle i {
    transform: rotate(180deg);
}

.about-dropdown-menu {
    display: none !important;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    margin: 0;
    padding: 8px;
    list-style: none;
    background: #fff !important;
    border-radius: 12px;
    border: 1px solid rgba(0, 91, 154, 0.1);
    box-shadow: 0 14px 34px rgba(0, 61, 107, 0.16);
    z-index: 30;
}

.about-dropdown.is-open .about-dropdown-menu {
    display: block !important;
    animation: aboutNavIn 0.18s ease;
}

.about-dropdown-menu a {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
}

.about-dropdown-menu a:hover {
    background: #F7F3EC;
    color: #005B9A;
}

.about-dropdown-menu a.is-active {
    background: linear-gradient(135deg, #005B9A, #003D6B);
    color: #fff !important;
}

/* Nested accordion under السياسات وأخلاقيات النشر */
.header .nav-has-sub {
    position: relative;
}

.header .nav-sub-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header .nav-sub-row > .nav-sub-link {
    flex: 1;
}

.header .nav-sub-toggle {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header .nav-sub-toggle:hover {
    background: rgba(0, 91, 154, 0.08);
    color: #005B9A;
}

.header .nav-sub-toggle i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.header .nav-submenu {
    display: none !important;
    position: absolute;
    top: 0;
    /* بجانب السهم (يسار في العربي / يمين في الإنجليزي) — مو تحت */
    inset-inline-start: calc(100% + 4px);
    inset-inline-end: auto;
    min-width: 220px;
    width: max-content;
    max-width: min(300px, 70vw);
    list-style: none;
    margin: 0;
    padding: 8px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 61, 107, 0.16);
    border: 1px solid rgba(0, 91, 154, 0.08);
    z-index: 450;
}

/* جسر صغير عشان الماوس ما يقطع الـ hover بين السهم والقائمة */
.header .nav-submenu::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-end: 100%;
    width: 10px;
}

/* Show on hover or when JS sets .is-open */
.header .nav-has-sub:hover > .nav-submenu,
.header .nav-has-sub.is-open > .nav-submenu {
    display: block !important;
}

.header .nav-has-sub:hover > .nav-sub-row .nav-sub-toggle i,
.header .nav-has-sub.is-open > .nav-sub-row .nav-sub-toggle i {
    transform: rotate(-90deg);
}

.header .nav-submenu a {
    padding-inline-start: 14px !important;
    font-size: 13px;
    color: #555;
}

.about-has-sub {
    position: relative;
}

.about-sub-parent {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.about-sub-parent i {
    font-size: 11px;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.about-submenu {
    display: none;
    list-style: none;
    margin: 4px 8px 0 0;
    padding: 0;
    border-inline-start: 2px solid rgba(0, 91, 154, 0.18);
}

.about-has-sub:hover > .about-submenu,
.about-has-sub.is-open > .about-submenu {
    display: block;
}

.about-has-sub:hover > .about-sub-parent i,
.about-has-sub.is-open > .about-sub-parent i {
    transform: rotate(180deg);
}

.about-submenu a {
    font-size: 14px !important;
    padding-inline-start: 18px !important;
}

@media (max-width: 768px) {
    .header .nav-menu.active .nav-item-dropdown.is-open > .nav-dropdown {
        display: block;
        position: static;
        box-shadow: none;
        border: none;
        padding: 4px 0 8px;
        min-width: 0;
        width: 100%;
        max-width: none;
    }

    .header .nav-menu.active .nav-dropdown::before {
        display: none;
    }

    .header .nav-menu.active .nav-submenu {
        position: static;
        inset: auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        box-shadow: none;
        border: 0;
        padding: 0 0 4px 0;
        background: transparent;
    }
}
