/* ═══════════════════════════════════════════════════════════
   زواج تايم — هيدر الموقع (ملف مستقل يُحمَّل آخراً)
   ═══════════════════════════════════════════════════════════ */

#header.site-header {
    position: sticky !important;
    top: 0;
    z-index: 1100 !important;
    padding: 10px 16px 6px !important;
    margin: 0 !important;
    background: linear-gradient(180deg, rgba(253, 248, 245, 0.97) 0%, rgba(253, 248, 245, 0.55) 100%) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

#header.site-header.scrolled {
    background: rgba(253, 248, 245, 0.96) !important;
}

#header.site-header.scrolled .header-shell {
    box-shadow: 0 12px 40px rgba(125, 61, 72, 0.14);
    border-color: rgba(155, 77, 90, 0.16);
}

#header .site-navbar {
    display: block;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0;
}

#header .header-shell {
    display: grid;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 6px 12px 6px 14px;
    background: #fff;
    border: 1px solid rgba(155, 77, 90, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(125, 61, 72, 0.09);
}

/* ── Desktop: 4 أعمدة — شعار | روابط | أزرار | (فارغ) ── */
@media (min-width: 1400px) {
    #header .header-shell {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas: "brand links actions toggle";
    }

    #header .nav-brand { grid-area: brand; }

    #header .nav-panel {
        display: contents !important;
    }

    #header .nav-pages {
        grid-area: links;
        justify-self: center;
        max-width: 100%;
    }

    #header .nav-actions {
        grid-area: actions;
        justify-self: end;
    }

    #header .mobile-menu-toggle {
        grid-area: toggle;
        display: none !important;
    }

    #header .nav-overlay {
        display: none !important;
    }
}

/* ── Brand ── */
#header .nav-brand {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    flex-shrink: 0;
}

#header .logo,
#header .logo img {
    width: 40px !important;
    height: 40px !important;
    max-height: none !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 3px !important;
    border-radius: 10px !important;
    background: #fff;
    box-shadow: 0 1px 4px rgba(125, 61, 72, 0.08);
    object-fit: contain;
}

#header .brand-name {
    font-family: var(--font-heading, 'IBM Plex Sans Arabic', sans-serif);
    font-size: 1.05rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* ── Links pill ── */
#header .nav-pages {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 3px;
    background: rgba(253, 248, 245, 0.95);
    border: 1px solid rgba(155, 77, 90, 0.08);
    border-radius: 999px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

#header .nav-pages::-webkit-scrollbar { display: none; }
#header .nav-pages li { flex-shrink: 0; }

#header .nav-link {
    display: inline-flex !important;
    align-items: center;
    padding: 7px 11px !important;
    border-radius: 999px !important;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--zt-text-muted, #7A5A62) !important;
    text-decoration: none !important;
    white-space: nowrap;
    position: static !important;
}

#header .nav-link::after,
#header .nav-link:after {
    display: none !important;
    content: none !important;
}

#header .nav-link:hover,
#header .nav-link.active {
    color: #fff !important;
    background: var(--gradient-primary) !important;
}

/* ── Actions ── */
#header .nav-actions {
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#header .nav-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    border: 1px solid transparent;
}

#header .nav-action--ghost {
    color: var(--zt-primary, #9B4D5A);
    background: transparent;
    padding-inline: 8px;
}

#header .nav-action--ghost:hover {
    background: rgba(155, 77, 90, 0.08);
}

#header .nav-action--outline {
    color: var(--zt-primary, #9B4D5A);
    background: #fff;
    border-color: rgba(155, 77, 90, 0.2);
}

#header .nav-action--primary {
    color: #fff !important;
    background: var(--gradient-primary) !important;
    box-shadow: 0 2px 8px rgba(125, 61, 72, 0.15);
}

#header .lang-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(155, 77, 90, 0.12);
    background: #fff;
    color: var(--zt-primary, #9B4D5A);
    text-decoration: none !important;
    flex-shrink: 0;
}

#header .lang-toggle:hover {
    border-color: rgba(155, 77, 90, 0.28);
}

/* ── Mobile toggle ── */
#header .mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(155, 77, 90, 0.12);
    border-radius: 12px;
    background: #fff;
    color: var(--zt-primary, #9B4D5A);
    cursor: pointer;
    flex-shrink: 0;
}

#header .mobile-menu-toggle__bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 18px;
}

#header .mobile-menu-toggle__bars span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

#header .mobile-menu-toggle.active .mobile-menu-toggle__bars span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
#header .mobile-menu-toggle.active .mobile-menu-toggle__bars span:nth-child(2) {
    opacity: 0;
}
#header .mobile-menu-toggle.active .mobile-menu-toggle__bars span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

#header .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 16, 20, 0.45);
    z-index: 1090;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

#header .nav-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

body.menu-open { overflow: hidden; }

/* ── Tablet & mobile: شعار + قائمة منسدلة ── */
@media (max-width: 1399px) {
    #header .header-shell {
        grid-template-columns: 1fr auto;
        grid-template-areas: "brand toggle";
    }

    #header .nav-brand { grid-area: brand; }

    #header .mobile-menu-toggle {
        grid-area: toggle;
        display: inline-flex !important;
    }

    #header .nav-panel {
        display: flex;
        flex-direction: column;
        gap: 12px;
        position: fixed;
        top: calc(var(--header-height, 72px) + 4px);
        left: 12px;
        right: 12px;
        padding: 14px;
        background: #fff;
        border: 1px solid rgba(155, 77, 90, 0.12);
        border-radius: 16px;
        box-shadow: 0 16px 48px rgba(125, 61, 72, 0.16);
        z-index: 1105;
        max-height: calc(100dvh - var(--header-height, 72px) - 12px);
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        pointer-events: none;
    }

    #header .nav-panel.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    #header .nav-pages {
        flex-direction: column;
        align-items: stretch;
        border-radius: 12px;
        overflow-x: visible;
    }

    #header .nav-pages li { width: 100%; }

    #header .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 11px 14px !important;
    }

    #header .nav-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(155, 77, 90, 0.1);
    }

    #header .nav-action {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    #header.site-header { padding-inline: 10px !important; }
    #header .brand-name {
        max-width: 8.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
