/* ==========================================================================
   GoHair Shop Layout — Category Hero, Sidebar Filters, Product Grid
   Redesigned: Bottom sheet mobile, collapsible desktop, active chips
   ========================================================================== */

/* ---- Shop Layout Grid ---- */
.gh-shop-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    padding: 32px 0 60px;
    align-items: start;
}

/* ---- Sidebar ---- */
.gh-shop-sidebar {
    position: sticky;
    top: calc(var(--gh-header-height) + 80px);
    max-height: calc(100vh - var(--gh-header-height) - 100px);
    overflow-y: auto;
    background: var(--gh-white);
    border-radius: var(--gh-radius);
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gh-gray-300) transparent;
}

.gh-shop-sidebar::-webkit-scrollbar { width: 4px; }
.gh-shop-sidebar::-webkit-scrollbar-thumb { background: var(--gh-gray-300); border-radius: 4px; }

.gh-sidebar-header { display: none; }
.gh-sidebar-footer { display: none; }

/* ---- Filter Sections (collapsible) ---- */
.gh-filter-section { border-bottom: 1px solid var(--gh-border); }
.gh-filter-section:last-child { border-bottom: none; }

.gh-filter-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.gh-filter-section-header:hover { background: rgba(196,149,106,0.04); }

.gh-filter-title {
    font-family: var(--gh-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gh-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gh-filter-title i { font-size: 14px; color: var(--gh-accent); width: 16px; text-align: center; }

.gh-filter-chevron {
    font-size: 10px;
    color: var(--gh-gray-400);
    transition: transform 0.3s ease;
}

.gh-filter-section.is-open .gh-filter-chevron { transform: rotate(180deg); }

.gh-filter-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-filter-section.is-open .gh-filter-section-body {
    max-height: 600px;
}

.gh-filter-section-inner {
    padding: 0 12px 16px;
}

/* ---- Filter Lists ---- */
.gh-filter-list { list-style: none; padding: 0; margin: 0; }
.gh-filter-list li { margin-bottom: 2px; }

.gh-filter-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--gh-gray-600);
    border-radius: var(--gh-radius);
    transition: all 0.2s ease;
    text-decoration: none;
}

.gh-filter-list a:hover { background: var(--gh-accent-light, rgba(196,149,106,0.08)); color: var(--gh-primary); }
.gh-filter-list a.active { background: var(--gh-accent-subtle, rgba(196,149,106,0.15)); color: var(--gh-primary); font-weight: 600; }
.gh-filter-list a i { font-size: 12px; margin-right: 4px; color: var(--gh-gray-400); }
.gh-filter-list a.active i { color: var(--gh-accent); }
.gh-filter-count { font-size: 11px; color: var(--gh-gray-400); font-weight: 400; min-width: 24px; text-align: right; }

/* Brand list scrollable */
.gh-filter-list--brands {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gh-gray-300) transparent;
}
.gh-filter-list--brands::-webkit-scrollbar { width: 3px; }
.gh-filter-list--brands::-webkit-scrollbar-thumb { background: var(--gh-gray-300); border-radius: 3px; }

.gh-filter-hidden { display: none; }

.gh-filter-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    font-family: var(--gh-font);
    font-size: 12px;
    font-weight: 600;
    color: var(--gh-accent);
    background: none;
    border: none;
    cursor: pointer;
    transition: gap 0.3s ease;
}

.gh-filter-more:hover { gap: 8px; }
.gh-filter-more i { font-size: 10px; transition: transform 0.3s ease; }
.gh-filter-more.is-expanded i { transform: rotate(180deg); }

/* ---- Price Filter ---- */
.gh-price-form { display: flex; flex-direction: column; gap: 10px; }
.gh-price-inputs { display: flex; align-items: center; gap: 8px; }
.gh-price-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.gh-price-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gh-gray-400); }
.gh-price-field input {
    width: 100%;
    padding: 8px 10px;
    font-family: var(--gh-font);
    font-size: 13px;
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
    background: var(--gh-white);
    color: var(--gh-primary);
    outline: none;
    transition: border-color 0.3s ease;
}
.gh-price-field input:focus { border-color: var(--gh-accent); }
.gh-price-sep { color: var(--gh-gray-300); font-size: 14px; margin-top: 16px; font-weight: 300; }

.gh-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    font-family: var(--gh-font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--gh-primary);
    color: var(--gh-white);
    border: none;
    border-radius: var(--gh-radius);
    cursor: pointer;
    transition: background 0.3s ease;
}

.gh-filter-btn:hover { background: var(--gh-accent); }

/* ---- Active Filter Chips (above product grid) ---- */
.gh-active-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--gh-accent-light, rgba(196,149,106,0.06));
    border-radius: var(--gh-radius);
}

.gh-active-chips-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--gh-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gh-primary);
    margin-right: 4px;
}

.gh-active-chips-label i { font-size: 13px; color: var(--gh-accent); }

.gh-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--gh-white);
    color: var(--gh-primary);
    border-radius: 20px;
    border: 1px solid var(--gh-border);
    transition: border-color 0.3s ease;
    text-decoration: none;
}

.gh-active-tag:hover { border-color: var(--gh-accent); color: var(--gh-accent); }
.gh-active-tag i { font-size: 9px; color: var(--gh-gray-400); }

.gh-clear-filters {
    margin-left: auto;
    font-family: var(--gh-font);
    font-size: 11px;
    font-weight: 600;
    color: var(--gh-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.gh-clear-filters:hover { opacity: 0.7; }

/* ---- Shop Content ---- */
.gh-shop-content { min-width: 0; }

.gh-shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gh-border);
}

.gh-shop-toolbar-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.gh-shop-toolbar-right .woocommerce-result-count { font-size: 12px; color: var(--gh-gray-500); margin: 0; }
.gh-shop-toolbar-right .woocommerce-ordering select {
    font-family: var(--gh-font);
    font-size: 12px;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
    background: var(--gh-white);
    color: var(--gh-primary);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a847c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* No products */
.gh-no-products { text-align: center; padding: 80px 20px; }
.gh-no-products i { font-size: 40px; color: var(--gh-gray-300); margin-bottom: 16px; display: block; }
.gh-no-products h3 { font-family: var(--gh-font-heading); font-size: 20px; margin-bottom: 8px; }
.gh-no-products p { font-size: 14px; color: var(--gh-gray-500); margin-bottom: 20px; }

/* ---- Floating Filter Button (mobile only) ---- */
.gh-filter-fab {
    display: none;
}

/* ---- Bottom Sheet Overlay ---- */
.gh-bottomsheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gh-bottomsheet-overlay.is-visible { opacity: 1; }

/* ---- Category Hero ---- */
.gh-cat-hero { background: var(--gh-gray-100); padding: 48px 0 40px; text-align: center; position: relative; overflow: hidden; }
.gh-cat-hero.has-image { padding: 80px 0 60px; min-height: 200px; }
.gh-cat-hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.35; }
.gh-cat-hero-overlay { position: relative; z-index: 1; }
.gh-cat-hero.has-image .gh-cat-title, .gh-cat-hero.has-image .gh-cat-count, .gh-cat-hero.has-image .gh-breadcrumb, .gh-cat-hero.has-image .gh-breadcrumb a, .gh-cat-hero.has-image .gh-cat-desc { color: var(--gh-white); }
.gh-cat-hero.has-image .gh-breadcrumb-sep { color: rgba(255,255,255,0.4); }
.gh-cat-title { font-family: var(--gh-font-heading); font-size: clamp(28px, 4vw, 42px); font-weight: 400; margin-bottom: 8px; }
.gh-cat-count { font-family: var(--gh-font); font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gh-gray-500); }
.gh-cat-desc { max-width: 600px; margin: 12px auto 0; font-size: 14px; line-height: 1.6; color: var(--gh-gray-500); }
.gh-cat-desc p { margin: 0; }

/* WC Pagination */
.woocommerce nav.woocommerce-pagination { margin-top: 40px; text-align: center; }
.woocommerce nav.woocommerce-pagination ul { display: inline-flex; gap: 4px; border: none; }
.woocommerce nav.woocommerce-pagination ul li { border: none; }
.woocommerce nav.woocommerce-pagination ul li a, .woocommerce nav.woocommerce-pagination ul li span.current { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; font-family: var(--gh-font); font-size: 13px; font-weight: 500; border-radius: var(--gh-radius); border: 1px solid var(--gh-border); color: var(--gh-gray-600); background: var(--gh-white); transition: all 0.3s ease; }
.woocommerce nav.woocommerce-pagination ul li a:hover { border-color: var(--gh-accent); color: var(--gh-accent); }
.woocommerce nav.woocommerce-pagination ul li span.current { background: var(--gh-primary); color: var(--gh-white); border-color: var(--gh-primary); }

/* ================================================================
   MOBILE (<=1024px) — Bottom Sheet
   ================================================================ */
@media (max-width: 1024px) {
    .gh-shop-layout { grid-template-columns: 1fr; gap: 0; }

    /* Hide desktop sidebar, repurpose as bottom sheet */
    .gh-shop-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-height: 65vh;
        height: auto;
        background: var(--gh-white);
        z-index: 9999;
        padding: 0;
        overflow: hidden;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .gh-shop-sidebar.is-open {
        transform: translateY(0);
    }

    /* Bottom sheet header */
    .gh-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid var(--gh-border);
        position: sticky;
        top: 0;
        background: var(--gh-white);
        z-index: 2;
    }

    .gh-sidebar-header-left {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .gh-sidebar-header h3 {
        font-family: var(--gh-font);
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

    .gh-sidebar-header h3 i { color: var(--gh-accent); }

    .gh-sidebar-result-count {
        font-size: 12px;
        color: var(--gh-gray-500);
        font-weight: 400;
    }

    .gh-sidebar-close {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 1px solid var(--gh-border);
        border-radius: 50%;
        cursor: pointer;
        color: var(--gh-gray-500);
        font-size: 14px;
        transition: all 0.3s ease;
    }

    .gh-sidebar-close:hover { border-color: var(--gh-accent); color: var(--gh-accent); }

    /* Drag handle */
    .gh-sidebar-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--gh-gray-300);
        border-radius: 2px;
    }

    /* Scrollable body */
    .gh-sidebar-body {
        overflow-y: auto;
        max-height: calc(65vh - 64px - 72px);
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Bottom sheet footer */
    .gh-sidebar-footer {
        display: flex;
        position: sticky;
        bottom: 0;
        background: var(--gh-white);
        padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--gh-border);
        z-index: 2;
    }

    .gh-sidebar-apply {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px;
        font-family: var(--gh-font);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.03em;
        background: var(--gh-accent);
        color: var(--gh-white);
        border: none;
        border-radius: var(--gh-radius);
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .gh-sidebar-apply:hover { background: var(--gh-primary); }

    /* Filter sections in mobile */
    .gh-filter-section { border-bottom: 1px solid var(--gh-border); }
    .gh-filter-section-header { padding: 18px 20px; }
    .gh-filter-section-inner { padding: 0 20px 18px; }

    /* Floating filter FAB */
    .gh-filter-fab {
        display: flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        bottom: 24px;
        left: 16px;
        z-index: 1000;
        padding: 12px 20px;
        font-family: var(--gh-font);
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.03em;
        background: var(--gh-primary);
        color: var(--gh-white);
        border: none;
        border-radius: 50px;
        cursor: pointer;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .gh-filter-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
    .gh-filter-fab:active { transform: scale(0.96); }

    .gh-filter-fab i { font-size: 14px; }

    .gh-filter-fab-badge {
        display: none;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        font-size: 11px;
        font-weight: 700;
        background: var(--gh-accent);
        color: var(--gh-white);
        border-radius: 10px;
    }

    .gh-filter-fab-badge.has-count { display: flex; }

    /* Hide the old toolbar toggle */
    .gh-filter-toggle { display: none !important; }

    /* Overlay */
    .gh-bottomsheet-overlay.is-visible { display: block; opacity: 1; }
}

/* ================================================================
   TABLET (<=768px)
   ================================================================ */
@media (max-width: 768px) {
    .gh-cat-hero { padding: 32px 0 28px; }
    .gh-cat-hero.has-image { padding: 48px 0 40px; }
    .gh-cat-title { font-size: 1.5rem; }

    .gh-shop-toolbar { flex-wrap: wrap; gap: 10px; }
    .gh-shop-toolbar-right { width: 100%; justify-content: space-between; }
    .gh-shop-toolbar-right .woocommerce-result-count { font-size: 11px; }
}

/* ================================================================
   SMALL MOBILE (<=480px) — Full screen bottom sheet
   ================================================================ */
@media (max-width: 480px) {
    .gh-shop-sidebar {
        max-height: 70vh;
        height: auto;
        border-radius: 16px 16px 0 0;
    }

    .gh-sidebar-body {
        max-height: calc(70vh - 64px - 72px);
    }

    /* Smaller FAB: icon + badge only */
    .gh-filter-fab {
        padding: 14px;
        bottom: 20px;
        left: 12px;
    }

    .gh-filter-fab-text { display: none; }
    .gh-filter-fab-badge { margin-left: 0; }
}

/* ---- Subcategory thumbnails: hidden (show products only) ---- */
.woocommerce ul.products li.product-category {
    display: none !important;
}

/* ---- AJAX Loading State ---- */
#productGrid {
    transition: opacity 0.25s ease;
}

/* ---- Body scroll lock ---- */
body.gh-noscroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ---- Brands Logo Grid ---- */
.gh-brands-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 0 0 40px;
}

.gh-brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    padding: 24px 16px;
    background: var(--gh-white);
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius-lg);
    transition: all 0.3s ease;
}

.gh-brand-card:hover {
    border-color: var(--gh-accent);
    transform: translateY(-3px);
    box-shadow: var(--gh-shadow);
    color: inherit;
}

.gh-brand-card-img {
    width: 100%;
    aspect-ratio: 3/2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.gh-brand-card-img img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.4s ease;
}

.gh-brand-card:hover .gh-brand-card-img img {
    filter: grayscale(0%);
    opacity: 1;
}

.gh-brand-card-letter {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gh-gray-100);
    border-radius: 50%;
    font-family: var(--gh-font-heading);
    font-size: 28px;
    color: var(--gh-gray-400);
}

.gh-brand-card-name {
    font-family: var(--gh-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--gh-primary);
    margin: 0 0 2px;
}

.gh-brand-card-count {
    font-size: 11px;
    color: var(--gh-gray-400);
}

@media (max-width: 768px) {
    .gh-brands-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .gh-brand-card { padding: 16px 10px; }
}

@media (max-width: 480px) {
    .gh-brands-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Hide FABs on brands parent page — not useful there */
.term-brands .cart-floating-btn,
.term-brands #cartFloatingBtn,
.term-brands #searchFab,
.term-brands #wishlistFab,
.term-brands .gh-wish-fab,
.term-brands .gh-search-fab {
    display: none !important;
}

/* Fix 5: Sort dropdown — icon-only on mobile */
@media (max-width: 768px) {
    .woocommerce-ordering select {
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        font-size: 0 !important;
        color: transparent !important;
        background: var(--gh-white) !important;
        border: 1px solid var(--gh-border) !important;
        border-radius: 10px !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2720%27 height=%2720%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%232c2825%27 stroke-width=%271.5%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M3 6h18M6 12h12M9 18h6%27/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
        background-size: 20px !important;
    }

    .woocommerce-ordering select option {
        font-size: 14px !important;
        color: var(--gh-primary) !important;
    }
}
