/* ===================================
   AFCAF SHARED HEADER
=================================== */

#header {
    position: relative;
    z-index: 1000;

    width: 100%;

    background-color: var(--color-charcoal);
    border-bottom: 4px solid var(--color-teal);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;

    width: 100%;
    min-height: 105px;

    padding: 12px 30px;
}

/* Brand section */
.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;

    flex-shrink: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 180px;
    height: 84px;

    padding: 8px 12px;

    background-color: var(--color-cream);
    color: var(--color-black);

    border: 1px solid var(--color-border);
    border-radius: 4px;

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);

    transition:
        background-color 0.3s ease,
        transform 0.3s ease;
}

.brand-logo img {
    width: 155px;
    height: 58px;

    object-fit: contain;
}

.brand-logo:hover {
    background-color: var(--color-cream-light);
    transform: translateY(-2px);
}

.brand-title {
    max-width: 210px;
}

.brand-title p {
    margin: 0;

    color: var(--color-cream);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
}

/* Desktop navigation */
.desktop-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.desktop-navigation a,
.dropdown-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;

    padding: 9px 11px;

    background: transparent;
    color: var(--color-cream);

    border: 0;
    border-radius: 4px;

    font-size: 15px;
    white-space: nowrap;
    cursor: pointer;

    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.desktop-navigation a:hover,
.dropdown-button:hover {
    background-color: var(--color-dark-soft);
    color: var(--color-cream-light);
}

/* Language and mobile controls */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;

    flex-shrink: 0;
}

.language-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 78px;
    min-height: 42px;

    padding: 8px 14px;

    background-color: var(--color-teal);
    color: var(--color-cream-light);

    border: 1px solid transparent;
    border-radius: 4px;

    font-size: 15px;
    font-weight: 600;

    transition:
        background-color 0.3s ease,
        border-color 0.3s ease;
}

.language-button:hover {
    background-color: var(--color-teal-dark);
    border-color: var(--color-cream);
}

/* Hidden until mobile styling is added */
.menu-button {
    display: none;
}
/* Desktop dropdown menus */
.dropdown {
    position: relative;
}

.dropdown-button {
    gap: 6px;
}

.dropdown-arrow {
    font-size: 13px;
    transition: transform 0.3s ease;
}

.dropdown-menu {
    position: absolute;
    top: calc(100%);
    left: 0;

    display: none;

    width: 245px;
    padding: 8px;

    background-color: var(--color-dark-soft);

    border: 1px solid var(--color-teal);
    border-radius: 4px;

    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.35);
}

.dropdown-menu a {
    display: block;

    width: 100%;
    min-height: auto;
    padding: 10px 12px;

    border-radius: 3px;

    text-align: left;
    white-space: normal;
}

.dropdown-menu a:hover {
    background-color: var(--color-teal);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    display: block;
}

.dropdown:hover .dropdown-arrow,
.dropdown:focus-within .dropdown-arrow {
    transform: rotate(180deg);
}
/* Persian dropdown alignment */
html[dir="rtl"] .dropdown-menu {
    right: 0;
    left: auto;
}

html[dir="rtl"] .dropdown-menu a {
    text-align: right;
}
/* Prevent page scrolling while mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Mobile and tablet header */
@media (max-width: 1050px) {
    .site-header {
        min-height: 90px;
        padding: 10px 20px;
    }

    .brand-logo {
        width: 140px;
        height: 68px;
    }

    .brand-logo img {
        width: 120px;
        height: 50px;
    }

    .brand-title {
        max-width: 180px;
    }

    .brand-title p {
        font-size: 15px;
    }

    /* Mobile navigation panel */
    .desktop-navigation {
        position: fixed;
        top: 0;
        right: -330px;
        z-index: 1101;

        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 4px;

        width: 320px;
        height: 100vh;

        padding: 105px 18px 30px;

        background-color: var(--color-charcoal);

        box-shadow: -8px 0 25px rgba(0, 0, 0, 0.4);

        overflow-y: auto;

        transition: right 0.35s ease;
    }

    .desktop-navigation.is-open {
        right: 0;
    }

    /* Persian menu opens from the left */
    html[dir="rtl"] .desktop-navigation {
        right: auto;
        left: -330px;

        box-shadow: 8px 0 25px rgba(0, 0, 0, 0.4);

        transition: left 0.35s ease;
    }

    html[dir="rtl"] .desktop-navigation.is-open {
        left: 0;
    }

    .desktop-navigation > a,
    .desktop-navigation .dropdown-button {
        justify-content: flex-start;

        width: 100%;
        min-height: 48px;

        padding: 11px 14px;

        text-align: start;
    }

    .dropdown {
        width: 100%;
    }

    .dropdown-button {
        justify-content: space-between;
    }

    /* Disable desktop hover opening */
    .dropdown:hover .dropdown-menu {
        display: none;
    }

    /* Opened by JavaScript */
    .dropdown.is-open .dropdown-menu {
        display: block;
    }

    .dropdown-menu {
        position: static;

        width: 100%;
        margin-top: 3px;
        padding: 5px;

        background-color: var(--color-dark-soft);

        border: 0;
        border-left: 3px solid var(--color-teal);
        border-radius: 3px;

        box-shadow: none;
    }

    html[dir="rtl"] .dropdown-menu {
        border-right: 3px solid var(--color-teal);
        border-left: 0;
    }

    .dropdown-menu a {
        min-height: 44px;
        padding: 9px 12px;

        font-size: 14px;
    }

    .dropdown.is-open .dropdown-arrow {
        transform: rotate(180deg);
    }

    /* Hamburger button */
    .menu-button {
        position: relative;
        z-index: 1102;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;

        width: 46px;
        height: 44px;

        padding: 8px;

        background-color: transparent;

        border: 1px solid var(--color-teal);
        border-radius: 4px;

        cursor: pointer;
    }

    .menu-button span {
        display: block;

        width: 24px;
        height: 2px;

        background-color: var(--color-cream);

        transition:
            transform 0.3s ease,
            opacity 0.3s ease;
    }

    .menu-button.is-open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .menu-button.is-open span:nth-child(2) {
        opacity: 0;
    }

    .menu-button.is-open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Dark page overlay */
    .menu-overlay {
        position: fixed;
        inset: 0;
        z-index: 1100;

        background-color: rgba(0, 0, 0, 0.6);

        opacity: 0;
        visibility: hidden;

        transition:
            opacity 0.3s ease,
            visibility 0.3s ease;
    }

    .menu-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }
}

/* Small mobile screens */
@media (max-width: 650px) {
    .site-header {
        gap: 8px;
        min-height: 80px;

        padding: 8px 12px;
    }

    .header-brand {
        gap: 8px;
    }

    .brand-logo {
        width: 100px;
        height: 60px;

        padding: 6px;
    }

    .brand-logo img {
        width: 90px;
        height: 46px;
    }

    .brand-title {
        max-width: 115px;
    }

    .brand-title p {
        font-size: 12px;
        line-height: 1.35;
    }

    .header-actions {
        gap: 6px;
    }

    .language-button {
        min-width: 60px;
        min-height: 40px;

        padding: 6px 8px;

        font-size: 13px;
    }

    .menu-button {
        width: 42px;
        height: 40px;
    }

    .desktop-navigation {
        width: min(310px, 88vw);
    }
}
/* Current page and parent menu */
.desktop-navigation a.active,
.dropdown-button.active {
    background-color: var(--color-teal);
    color: var(--color-cream-light);
}

.dropdown-menu a.active {
    background-color: var(--color-teal);
    color: var(--color-cream-light);
}
/* Wide desktop header refinement */
@media (min-width: 1450px) {
    .brand-title {
        max-width: none;
    }

    .brand-title p {
        font-size: 16px;
        white-space: nowrap;
    }

    .desktop-navigation {
        margin-inline-start: auto;
        margin-inline-end: 45px;
    }
}