/* ==========================================================================
   Smart Sticky Header
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--wp--preset--color--neutral, #fff);
    transition: transform 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.site-header.scroll-up {
    transform: translateY(0);
}

/* Hide Top and Bottom bars when scrolling up (only Middle is visible) */
.site-header.scroll-up .header-top-bar,
.site-header.scroll-up .header-bottom {
    display: none;
}

/* ==========================================================================
   1. Top Bar
   ========================================================================== */
.header-top-bar {
    background-color: rgb(243 243 243);
    /* color: #fff; */
    font-size: 0.875rem;
    text-align: center;
    font-weight: 500;
    padding: 7px 0;
    overflow: hidden;
}

.top-bar-slider {
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

/* Desktop layout (default) */
.top-bar-slide {
    display: inline-block;
    padding: 0 15px;
}

.top-bar-slide:not(:last-child) {
    border-right: 1px solid rgba(1, 1, 1, 0.9);
}

/* Mobile slider layout (controlled via JS/inline CSS) */
.top-bar-slider.is-mobile {
    position: relative;
    height: 20px;
    display: block;
}

.top-bar-slider.is-mobile .top-bar-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    border: none;
    padding: 0;
}

.top-bar-slider.is-mobile .top-bar-slide.active {
    opacity: 1;
}

/* ==========================================================================
   2. Main Header (Middle)
   ========================================================================== */
.header-main {
    padding: 16px 0;
    border-bottom: 1px solid var(--wp--preset--color--tertiary, #EDEBE4);
}

.header-main-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-branding img {
    max-height: 50px;
    width: auto;
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.site-title a {
    color: var(--wp--preset--color--secondary);
    text-decoration: none;
}

/* Search Bar */
.header-search {
    flex-grow: 1;
    max-width: 700px;
    position: relative;
}

.search-form {
    display: flex;
    position: relative;
}

.search-field {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: 1px solid #ccc;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.search-field:focus {
    outline: none;
    border-color: var(--wp--preset--color--primary);
}

.search-submit {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--wp--preset--color--primary);
    cursor: pointer;
    padding: 5px 10px;
}

/* AJAX Search Results Dropdown */
.ajax-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fdfbf7;
    /* Cream background matching the image */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    margin-top: 5px;
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

.ajax-search-results.active {
    display: block;
}

/* Predictive Search Layout (2 columns) */
.predictive-search-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    padding: 20px;
}

@media (max-width: 768px) {
    .predictive-search-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.predictive-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #666;
    margin: 0 0 10px 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.predictive-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.predictive-suggestion-item,
.predictive-page-item {
    display: block;
    padding: 4px 0;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
}

.predictive-suggestion-item:hover,
.predictive-page-item:hover {
    text-decoration: underline;
}

.predictive-products-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.predictive-product-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: opacity 0.2s;
}

.predictive-product-item:hover {
    opacity: 0.8;
}

.predictive-product-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
    background: #eee;
}

.predictive-product-info {
    display: flex;
    flex-direction: column;
}

.predictive-product-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 3px;
}

.predictive-product-price {
    font-size: 0.9rem;
    color: #666;
}

.predictive-search-footer {
    background: #f4f2eb;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
}

.predictive-search-submit {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
}

.predictive-search-submit .icon-arrow {
    width: 14px;
    height: 10px;
    fill: currentColor;
}

.search-result-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Action Icons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-icon {
    position: relative;
    color: var(--wp--preset--color--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-icon:hover {
    background: var(--wp--preset--color--tertiary);
}

.cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--wp--preset--color--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    /* Handled by inline CSS in header.php */
    background: none;
    border: none;
    color: var(--wp--preset--color--secondary);
    padding: 5px;
    cursor: pointer;
}

/* ==========================================================================
   3. Bottom Bar (Navigation)
   ========================================================================== */
.header-bottom {
    /* background: var(--wp--preset--color--secondary); */
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 8px 0
        /* justify-content: center; */
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    display: block;
    /* padding: 6px 14px; */
    /* color: #fff; */
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.main-navigation a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Off-Canvas Menu (Mobile)
   ========================================================================== */
.offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.offcanvas-overlay.active {
    opacity: 1;
    visibility: visible;
}

.offcanvas-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    max-width: 90%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.offcanvas-drawer.active {
    left: 0;
}

.offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--wp--preset--color--tertiary);
}

.offcanvas-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--wp--preset--color--black);
}

.offcanvas-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.mobile-navigation ul {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
}

.mobile-navigation a {
    display: block;
    padding: 12px 0;
    color: var(--wp--preset--color--secondary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid var(--wp--preset--color--tertiary);
}

@media (max-width: 768px) {

    .site-branding img {
        width: 100px;
    }

    .header-top-bar {
        font-size: 12px;
        padding: 8px 0;
    }
}

@media (max-width: 576px) {

    .header-actions {
        gap: 15px;
    }

    .main-navigation {
        display: none;
        /* Hide desktop menu on mobile */
    }

    .menu-toggle {
        display: block;
    }

    .site-branding img {
        width: 80px;
    }

}