/* ==========================================================================
   Custom Header – Valdrin Sahiti
   Desktop:  [            Logo (center)            ] [Search Account Cart]
   Mobile:   [Hamburger Search] [Logo (center)] [Account Cart]
   ========================================================================== */

/* ── Outer shell ── */
.custom-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 30px 40px 30px;

    /* Default: frosted glass blur */
    background: #ffffff40 !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
}

/* ── Scrolled: solid white, dark text ── */
.custom-header.is-scrolled {
    background: #fff !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: #111;
    border-bottom: 1px solid #e8e8e8;
}

/* ── Always solid on product / cart / checkout / search pages ── */
body.single-product .custom-header,
body.woocommerce-cart .custom-header,
body.woocommerce-checkout .custom-header,
body.search-results .custom-header {
    background: #fff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #111 !important;
    border-bottom: 1px solid #e8e8e8 !important;
}

body.single-product .custom-header .header-cart-badge,
body.woocommerce-cart .custom-header .header-cart-badge,
body.woocommerce-checkout .custom-header .header-cart-badge,
body.search-results .custom-header .header-cart-badge {
    background: #111;
    color: #fff;
}

/* ══════════════════════════════════════════════════════
   ROW 1 — Desktop: flex + absolutely-positioned right
   Logo stays perfectly centered via justify-content: center.
   ══════════════════════════════════════════════════════ */
.custom-header-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* ── Left slot (mobile only — hidden on desktop) ── */
.custom-header-left {
    display: none;
    align-items: center;
    gap: 16px;
}

/* ── Logo (centered via flex parent) ── */
.custom-header-logo {
    text-align: center;
}

.custom-header-logo a {
    display: inline-block;
    color: currentColor;
    text-decoration: none;
}

/* Text logo */
.custom-header-site-name {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-family: inherit;
    white-space: nowrap;
}

/* Desktop: name on one line */
.site-name-line { display: inline; }
.site-name-line:first-child::after { content: '\00a0'; } /* non-breaking space between words */

.custom-header-logo a {
    color: currentColor;
    text-decoration: none;
}

/* ── Right slot (desktop: absolutely positioned right / mobile: grid end) ── */
.custom-header-right {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 18px;
}

/* ── Icon buttons ── */
.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
    cursor: pointer;
    padding: 0 !important;
    color: inherit !important;
    text-decoration: none;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.header-icon-btn:hover {
    opacity: 0.55;
}

.header-icon-btn svg {
    display: block;
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

/* ── Hamburger: hidden on desktop ── */
.header-hamburger {
    display: none !important;
}

/* ── Mobile search: hidden on desktop ── */
.header-search-mobile {
    display: none !important;
}

/* ── Desktop search: visible on desktop ── */
.header-search-desktop {
    display: flex;
}

/* ── Cart badge ── */
.header-cart-badge {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 17px;
    height: 17px;
    padding: 0 3px;
    border-radius: 50px;
    background: #fff;
    color: #111;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    pointer-events: none;
}

.custom-header.is-scrolled .header-cart-badge {
    background: #111;
    color: #fff;
}

.header-cart-badge.is-hidden {
    display: none;
}

/* ══════════════════════════════════════════
   ROW 2 — Navigation (desktop, centered)
   ══════════════════════════════════════════ */
.custom-header-nav {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.custom-header-nav .custom-nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 32px;
    flex-wrap: nowrap;
}

.custom-header-nav .custom-nav-list li {
    margin: 0;
    padding: 0;
}

.custom-header-nav .custom-nav-list a {
    color: currentColor;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.custom-header-nav .custom-nav-list a:hover {
    opacity: 0.55;
}

/* ── Submenus (dropdown on hover) ── */
.custom-header-nav .custom-nav-list > li {
    position: relative;
}

.custom-header-nav .custom-nav-list .sub-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 180px;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    z-index: 10000;
}

.custom-header-nav .custom-nav-list > li:hover > .sub-menu {
    display: block;
}

.custom-header-nav .custom-nav-list .sub-menu li {
    margin: 0;
    padding: 0;
}

.custom-header-nav .custom-nav-list .sub-menu a {
    display: block;
    padding: 9px 20px;
    color: #111 !important;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 1;
    transition: background 0.15s ease;
}

.custom-header-nav .custom-nav-list .sub-menu a:hover {
    background: #f5f5f5;
    opacity: 1;
}

/* ══════════════════════════════════════════
   RESPONSIVE — ≤1024px: mobile layout
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .custom-header {
        padding: 14px 20px;
        /* Single row only — no nav row */
        flex-direction: row;
        align-items: center;
    }

    /* Switch to 3-column grid for true centering on mobile */
    .custom-header-top {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        position: static;
    }

    /* Show left slot */
    .custom-header-left {
        display: flex !important;
        justify-self: start;
        gap: 14px;
    }

    /* Logo stays in middle column */
    .custom-header-logo {
        justify-self: center;
    }

    /* Break site name into two lines: Valdrin / Sahiti */
    .custom-header-site-name {
        font-size: 18px;
        white-space: normal;
        text-align: center;
        line-height: 1.0;
    }

    .site-name-line {
        display: block;
    }

    .site-name-line:first-child::after {
        content: none;
    }

    /* Reset right slot: back in grid flow, no absolute positioning */
    .custom-header-right {
        position: static;
        transform: none;
        justify-self: end;
        gap: 14px;
    }

    /* Show hamburger + mobile search */
    .header-hamburger {
        display: flex !important;
    }

    .header-search-mobile {
        display: flex !important;
    }

    /* Hide desktop search */
    .header-search-desktop {
        display: none !important;
    }

    /* Hide nav row entirely on mobile */
    .custom-header-nav {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .custom-header {
        padding: 12px 16px;
    }
}

/* ══════════════════════════════════════════
   Search overlay — covers the header bar
   ══════════════════════════════════════════ */
.custom-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* height is set dynamically by JS to match the header */
    z-index: 100000;
    background: #fff;
    color: #111;           /* override the header's color: #fff inheritance */
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    padding: 0 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    pointer-events: none;
}

.custom-search-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Inner row: [search-icon] [input] [close] */
.custom-search-inner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* The form just wraps the input — no border of its own */
.custom-search-form {
    flex: 1;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.custom-search-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 18px;
    font-family: inherit;
    background: transparent;
    color: #111;
    letter-spacing: 0.02em;
    padding: 0;
}

.custom-search-input::placeholder {
    color: #aaa;
}

.custom-search-submit,
.custom-search-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
    line-height: 1;
}

.custom-search-submit:hover,
.custom-search-close:hover {
    opacity: 0.5;
}

/* Visually hidden label for accessibility */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1024px) {
    .custom-search-overlay {
        padding: 0 20px;
    }

    .custom-search-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .custom-search-overlay {
        padding: 0 16px;
    }
}
