/* ==========================================================================
   Header Styles - Al-Tawajud Corporate
   ========================================================================== */

/* Full-width shells — backgrounds edge to edge; content uses standard container width */
.top-bar,
.site-header,
.header__main,
.header__nav-bar {
    width: 100%;
}

.top-bar .container,
.site-header .container {
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: var(--space-6);
}

/* ── Top Bar ── */
.top-bar {
    background: #B22B8F;
    color: var(--text-inverse);
    padding: 0.55rem 0;
    font-size: 0.8125rem;
    border-bottom: 2px solid var(--primary-500);
}

.top-bar__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse;
    gap: var(--space-4);
}

.top-bar__contact {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.top-bar__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.82);
    transition: color 0.25s ease;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.top-bar__item--static {
    cursor: default;
}

.top-bar__item:hover {
    color: var(--primary-300);
}

.top-bar__item--static:hover {
    color: rgba(255, 255, 255, 0.82);
}

.top-bar__item svg {
    width: 15px;
    height: 15px;
    color: var(--primary-400);
    flex-shrink: 0;
}

.top-bar__social-icons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.top-bar__social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.25s ease;
}

.top-bar__social:hover {
    background: var(--primary-500);
    border-color: var(--primary-500);
    transform: translateY(-1px);
}

.top-bar__menu {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    list-style: none;
    margin: 0;
    padding: 0 var(--space-3) 0 0;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.top-bar__menu li a {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8125rem;
    transition: color 0.25s ease;
}

.top-bar__menu li a:hover {
    color: var(--primary-300);
}

/* ── Main Header Shell ── */
.site-header {
    --header-nav-inline-padding: 1.15rem;
    --header-nav-font-size: 1.125rem;
    --header-nav-sub-font-size: 0.9375rem;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

.site-header.scrolled {
    box-shadow: 0 4px 24px rgba(18, 37, 65, 0.12);
}

/* ── Brand Row (white) ── */
.header__main {
    background: #fff;
    border-bottom: 3px solid var(--primary-500);
}

.header__brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0.75rem 0;
    min-height: 72px;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
    margin-inline-end: 0;
    padding-inline-start: var(--header-nav-inline-padding);
    text-decoration: none;
    transition: opacity 0.25s ease;
}

.header__brand:hover {
    opacity: 0.92;
}

.header__brand-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    line-height: 0;
}

.header__brand-logo a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    line-height: 0;
}

.header__brand-logo img,
.header__brand-logo .custom-logo {
    max-height: 56px;
    max-width: min(220px, 42vw);
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    object-position: inline-start center;
}

.header__brand-mark {
    display: none;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 169, 224, 0.25);
}

.header__brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.header__brand-name {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--primary-500);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

/* ── Header Actions ── */
.header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: auto;
    margin-left: var(--space-4);
    direction: ltr;
}

.header__cta {
    height: 51px;
    min-height: 51px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-lg);
    gap: 0.45rem;
    padding: 0 1.35rem;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    direction: rtl;
    background: var(--primary-500);
    border: 2px solid var(--primary-500);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 169, 224, 0.35);
}

.header__cta:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: #fff;
    box-shadow: 0 6px 20px rgba(37, 169, 224, 0.45);
    transform: translateY(-1px);
}

.header__cta--contact {
    background: #2E5DA9;
    border-color: #2E5DA9;
    box-shadow: 0 4px 14px rgba(46, 93, 169, 0.35);
}

.header__cta--contact:hover {
    background: #254a87;
    border-color: #254a87;
    box-shadow: 0 6px 20px rgba(46, 93, 169, 0.45);
}

/* ── Navigation Bar (menu strip) ── */
.header__nav-bar {
    background: #fff;
}

@media (min-width: 1025px) {
    .site-header .container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        column-gap: var(--space-4);
        row-gap: 0.85rem;
        align-items: center;
        padding-block: 0.65rem 0.55rem;
    }

    .header__brand-row {
        display: contents;
    }

    .header__brand {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        align-self: center;
        padding-inline-start: var(--header-nav-inline-padding);
        padding-block: 0.35rem 0.55rem;
        min-height: 68px;
        max-width: 100%;
    }

    .header__brand-text {
        min-width: 0;
    }

    .header__brand-name {
        font-size: 1.05rem;
        line-height: 1.35;
        max-width: 22ch;
    }

    .header__brand-logo img,
    .header__brand-logo .custom-logo {
        max-height: 52px;
    }

    .header__actions {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: center;
        margin-right: 0;
        margin-left: 0;
        padding-block: 0.35rem;
    }

    .header__nav-bar {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        width: 100%;
        max-width: 100%;
        margin-top: 0.15rem;
        padding-top: 0.55rem;
        border-top: 1px solid rgba(37, 169, 224, 0.12);
    }

    .header__nav {
        width: 100%;
    }

    .nav-menu {
        flex-wrap: wrap;
        row-gap: 0.15rem;
    }
}

.header__nav {
    display: flex;
    justify-content: flex-start;
    width: 100%;
}

.nav-menu {
    display: flex;
    align-items: stretch;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 100%;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem var(--header-nav-inline-padding);
    font-weight: 600;
    font-size: var(--header-nav-font-size);
    color: var(--text-primary);
    transition: all 0.22s ease;
    position: relative;
    white-space: nowrap;
    border-left: 1px solid rgba(37, 169, 224, 0.08);
}

.nav-menu > li:first-child > a {
    border-left: none;
}

.nav-menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: var(--header-nav-inline-padding);
    left: var(--header-nav-inline-padding);
    height: 3px;
    background: var(--primary-400);
    transform: scaleX(0);
    transition: transform 0.22s ease;
    border-radius: 3px 3px 0 0;
}

.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-ancestor > a {
    color: var(--color-main);
    background: var(--primary-50);
}

.nav-menu > li > a:hover::after,
.nav-menu > li.current-menu-item > a::after,
.nav-menu > li.current-menu-ancestor > a::after {
    transform: scaleX(1);
}

.nav-menu > li.menu-item-has-children > a::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-secondary);
    margin-right: 0.2rem;
    transition: transform 0.22s ease;
}

.nav-menu > li.menu-item-has-children:hover > a::before {
    transform: rotate(180deg);
}

/* Dropdown menus */
.nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 260px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(18, 37, 65, 0.18);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 0.4rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
    z-index: var(--z-dropdown);
    border: 1px solid rgba(37, 169, 224, 0.08);
    border-top: 3px solid var(--primary-500);
}

.nav-menu > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-menu .sub-menu .sub-menu {
    top: -0.4rem !important;
    right: calc(100% + 4px) !important;
    left: auto !important;
    min-width: 240px;
    transform: translateX(8px);
    border-top: 1px solid rgba(37, 169, 224, 0.08);
    border-right: 3px solid var(--accent-500);
    border-radius: var(--radius-lg);
}

.nav-menu .sub-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-menu .sub-menu li.menu-item-has-children::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    width: 10px;
    background: transparent;
}

.nav-menu .sub-menu li {
    position: relative;
    padding: 0;
}

.nav-menu .sub-menu li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    color: var(--color-heading);
    font-size: var(--header-nav-sub-font-size);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.18s ease;
    gap: 0.75rem;
}

.nav-menu .sub-menu li a:hover,
.nav-menu .sub-menu li.current-menu-item > a {
    color: var(--primary-700);
    background: var(--primary-50);
    padding-right: 1.1rem;
}

.nav-menu .sub-menu li.menu-item-has-children > a::after {
    content: '';
    border: none;
    width: 6px;
    height: 6px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(-45deg);
    opacity: 0.45;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-menu .sub-menu li.menu-item-has-children:hover > a::after {
    opacity: 1;
}

/* ── Mobile Toggle ── */
.mobile-menu-toggle {
    display: none;
    padding: 0.55rem;
    background: var(--primary-700);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.hamburger span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.25s ease;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Mobile Navigation ── */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    z-index: var(--z-modal);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav__overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 32, 51, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.mobile-nav.active .mobile-nav__overlay {
    opacity: 1;
}

.mobile-nav__content {
    position: absolute;
    top: 0;
    right: 0;
    width: min(380px, 92%);
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary-500);
}

.mobile-nav.active .mobile-nav__content {
    transform: translateX(0);
}

.mobile-nav__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid rgba(37, 169, 224, 0.1);
    background: var(--primary-50);
}

.mobile-nav__brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
}

.mobile-nav__brand-name {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--color-heading);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-nav__brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid rgba(37, 169, 224, 0.12);
    box-shadow: 0 2px 8px rgba(18, 37, 65, 0.08);
    overflow: hidden;
}

.mobile-nav__brand-logo img,
.mobile-nav__brand-logo .custom-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.mobile-nav__brand-mark {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    color: #fff;
}

.mobile-nav__logo img {
    max-height: 48px;
}

.mobile-nav__logo .header__brand-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--color-heading);
}

.mobile-nav__close {
    padding: 0.5rem;
    background: #fff;
    border: 1px solid rgba(37, 169, 224, 0.12);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-main);
}

.mobile-nav__menu {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-4);
}

.mobile-menu li a {
    display: block;
    padding: 0.85rem 1rem;
    color: var(--color-heading);
    font-weight: 600;
    font-size: 1.0625rem;
    border-radius: var(--radius-md);
    border-right: 3px solid transparent;
    transition: all 0.2s ease;
}

.mobile-menu li a:hover,
.mobile-menu li.current-menu-item a {
    color: var(--primary-700);
    background: var(--primary-50);
    border-right-color: var(--primary-500);
}

.mobile-menu .sub-menu {
    list-style: none;
    padding-right: var(--space-4);
    margin-top: 0.2rem;
    display: none;
    border-right: 2px solid var(--primary-100);
    margin-right: 0.5rem;
}

.mobile-menu li.open > .sub-menu {
    display: block;
}

.mobile-menu .sub-menu li a {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.mobile-menu li.menu-item-has-children > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu li.menu-item-has-children > a::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--primary-500);
    border: none;
    transform: none;
    width: auto;
    height: auto;
}

.mobile-menu li.menu-item-has-children.open > a::after {
    content: '−';
}

.mobile-nav__actions {
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid rgba(37, 169, 224, 0.1);
}

.mobile-nav__actions .btn {
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 40px;
    line-height: 1.4;
    justify-content: center;
}

.mobile-nav__actions .btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mobile-nav__contact {
    padding: var(--space-4) var(--space-5);
    background: var(--primary-800);
    color: rgba(255, 255, 255, 0.9);
}

.mobile-nav__contact a,
.mobile-nav__contact p {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
}

.mobile-nav__contact svg {
    color: var(--primary-400);
    flex-shrink: 0;
    margin-top: 2px;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .site-header {
        --header-nav-inline-padding: 0.85rem;
        --header-nav-font-size: 1.0625rem;
    }

    .nav-menu > li > a {
        font-size: var(--header-nav-font-size);
        padding-block: 0.75rem;
    }

    @media (min-width: 1025px) {
        .header__brand-name {
            font-size: 0.975rem;
            max-width: 18ch;
        }

        .header__brand-logo img,
        .header__brand-logo .custom-logo {
            max-height: 48px;
        }
    }
}

@media (max-width: 1024px) {
    .header__nav-bar {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header__actions {
        display: none;
    }

    .header__brand-row {
        min-height: 64px;
        padding: 0.65rem 0;
    }

    .header__brand {
        padding-inline-start: 0;
    }

    .header__brand-logo img,
    .header__brand-logo .custom-logo {
        max-height: 52px;
    }
}

@media (max-width: 768px) {
    .top-bar__item span {
        display: none;
    }

    .top-bar__item--static {
        display: none;
    }

    .top-bar__menu {
        display: none;
    }

    .header__brand-name {
        font-size: 0.9375rem;
    }

    .header__brand-text {
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        display: none;
    }

    .header__brand-text {
        display: none;
    }

    .header__brand-row {
        min-height: 56px;
        padding: 0.5rem 0;
    }

    .header__brand-logo img,
    .header__brand-logo .custom-logo {
        max-height: 44px;
    }

    .mobile-nav__content {
        width: min(100%, 380px);
    }
}
