/* FacetWP Sort CSS */
.facetwp-sort {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.facetwp-sort select {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.facetwp-sort label {
    font-weight: bold;
    margin-right: 10px;
}

/* FacetWP reset button */
.facetwp-facet-reset {
    margin: 0 0 14px;
}

.facetwp-reset {
    appearance: none;
    background: #1274a8;
    border: 1px solid #0f6592;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    padding: 9px 12px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.facetwp-reset:hover,
.facetwp-reset:focus {
    background: #0d5b84;
    border-color: #0b4d70;
    color: #fff;
    outline: none;
}

.facetwp-reset:active {
    transform: translateY(1px);
}

/* ─── Top spacing for the woocommerce page template ──────────────────────────
   This page has no masthead/hero, so the first layer sits directly under the
   fixed header. Push it down so content clears the nav bar.
   ─────────────────────────────────────────────────────────────────────────── */
.woocommerce-page .layer--content:first-of-type {
    margin-top: 100px !important;
}

/* WooCommerce breadcrumbs (rendered inside content column) */
.woocommerce-page .omega-breadcrumbs {
    border-bottom: 1px solid #e4eaef;
    margin: 0 0 18px;
    padding: 0 0 10px;
}

.woocommerce-page .omega-breadcrumbs .breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none !important;
    margin: 0;
    padding: 0 !important;
    counter-reset: none !important;
}

.woocommerce-page .omega-breadcrumbs .breadcrumb-item {
    color: #5f6d79;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Neutralize global ordered-list pseudo numbering styles from theme */
.woocommerce-page .omega-breadcrumbs .breadcrumb-item::before {
    content: none !important;
    display: none !important;
}

.woocommerce-page .omega-breadcrumbs .breadcrumb-item a {
    color: #1274a8;
    text-decoration: none;
}

.woocommerce-page .omega-breadcrumbs .breadcrumb-item a:hover,
.woocommerce-page .omega-breadcrumbs .breadcrumb-item a:focus {
    color: #0d5b84;
    text-decoration: underline;
}

.woocommerce-page .omega-breadcrumbs .breadcrumb-delimiter {
    color: #90a1ae;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    line-height: 1;
    transform: translateY(-1px);
}

/* ─── 2-column layout: facets LEFT, WC content RIGHT ─────────────────────────
   refresh.min.css forces .sidebar-shop { flex: 1 0 100% !important } which
   blows the sidebar full-width. We override that here with higher specificity
   so the sidebar becomes a fixed 240px left column.
   ─────────────────────────────────────────────────────────────────────────── */

@media screen and (min-width: 768px) {

    /* Left column: sidebar */
    .layer--content .content-row .sidebar.sidebar-shop {
        flex: 0 0 240px !important;
        width: 240px !important;
        max-width: 240px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 1px solid #CFD8DC;
        border-radius: 4px;
        box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.06);
        background: #fff;
        min-height: 1px;
        align-self: flex-start;
    }

    /* Right column: content */
    .layer--content .content-row > article.content {
        flex: 1 1 0% !important;
        min-width: 0;
    }

    /* Reset the horizontal-dropdown-bar layout inside the sidebar */
    .layer--content .sidebar-shop .sidebar__inner {
        display: block !important;
        padding: 14px 15px 15px !important;
        position: static !important;
        flex-wrap: unset !important;
    }

    /* "Filters" label: inline flow, not absolutely positioned */
    .layer--content .sidebar-shop .sidebar__inner > label {
        position: static !important;
        display: block !important;
        opacity: 0.9 !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
        padding: 0 !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* Expand AAPF filter widgets to full height (not 38px dropdown) */
    .layer--content .sidebar-shop .sidebar__inner .widget_berocket_aapf {
        max-height: none !important;
        margin: 0 0 10px 0 !important;
        width: 100% !important;
        border: 1px solid #e0e6eb !important;
        border-radius: 4px !important;
        padding: 8px 10px !important;
    }

    .layer--content .sidebar-shop .berocket_aapf_widget-title {
        min-width: auto !important;
        font-size: 13px;
    }

    .layer--content .sidebar-shop .berocket_aapf_widget {
        display: block !important;
        margin: 6px 0 0 !important;
    }

    /* FacetWP facets in left sidebar */
    .layer--content .sidebar-shop .facetwp-facet {
        margin-bottom: 14px;
    }
}

/* ─── Mobile sidebar inner layout (same fixes as desktop, no 2-col sizing) ── */
@media (max-width: 767px) {
    /* Reset the horizontal-dropdown-bar layout refresh.min.css applies */
    .tax-product_cat .sidebar-shop .sidebar__inner {
        display: block !important;
        padding: 14px 15px 15px !important;
        position: static !important;
        flex-wrap: unset !important;
    }

    .tax-product_cat .sidebar-shop .sidebar__inner > label {
        position: static !important;
        display: block !important;
        opacity: 0.9 !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
        padding: 0 !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .tax-product_cat .sidebar-shop .sidebar__inner .widget_berocket_aapf {
        max-height: none !important;
        margin: 0 0 10px 0 !important;
        width: 100% !important;
        border: 1px solid #e0e6eb !important;
        border-radius: 4px !important;
        padding: 8px 10px !important;
    }

    .tax-product_cat .sidebar-shop .berocket_aapf_widget-title {
        min-width: auto !important;
        font-size: 13px;
    }

    .tax-product_cat .sidebar-shop .berocket_aapf_widget {
        display: block !important;
        margin: 6px 0 0 !important;
    }

    .tax-product_cat .sidebar-shop .facetwp-facet {
        margin-bottom: 14px;
    }
}

/* ─── Category grid (right panel) ────────────────────────────────────────── */

.shop-categories-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
}

.shop-categories-grid .category-block {
    min-width: 0;
}

.shop-categories-grid .category-block a {
    background: #fff;
    border: 1px solid #dfe5ea;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
    color: #014b72;
    display: block;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.shop-categories-grid .category-block a:hover,
.shop-categories-grid .category-block a:focus {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.shop-categories-grid .category-block img {
    aspect-ratio: 4 / 3;
    display: block;
    height: auto;
    object-fit: cover;
    width: 100%;
}

.shop-categories-grid .category-block h2 {
    color: #0784c6;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
    margin: 0;
    padding: 12px 14px 14px;
    word-break: break-word;
}

@media (max-width: 900px) {
    .shop-categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .shop-categories-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* ─── Subcategory grid (WooCommerce product-category archive pages) ───────────
   WooCommerce wraps subcategory tiles in ul.products.columns-N.
   We override that container to CSS grid only when it holds .ib-item tiles
   (which are subcategories from content-product_cat.php), leaving the regular
   product ul.products untouched.
   ─────────────────────────────────────────────────────────────────────────── */

.facetwp-template ul.products:has(.ib-item)::before,
.facetwp-template ul.products:has(.ib-item)::after {
    display: none !important;
    content: none !important;
}

.facetwp-template ul.products:has(.ib-item) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 30px !important;
    width: 100% !important;
}

/* Reset .ib-item as a plain grid cell */
.facetwp-template ul.products .ib-item {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0;
}

/* Card link — same style as .shop-categories-grid .category-block a */
.facetwp-template ul.products .ib-item .thumbnail-link {
    background: #fff;
    border: 1px solid #dfe5ea;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
    color: #014b72;
    display: block !important;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    height: 100%;
}

.facetwp-template ul.products .ib-item .thumbnail-link:hover,
.facetwp-template ul.products .ib-item .thumbnail-link:focus {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Card image — same style as .shop-categories-grid .category-block img */
.facetwp-template ul.products .ib-item img {
    aspect-ratio: 4 / 3;
    display: block !important;
    height: auto !important;
    object-fit: cover;
    width: 100% !important;
}

/* Card title — same style as .shop-categories-grid .category-block h2 */
.facetwp-template ul.products .ib-item .thumbnail-link__title {
    color: #0784c6 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    padding: 12px 14px 14px !important;
    word-break: break-word;
}

@media (max-width: 900px) {
    .facetwp-template ul.products:has(.ib-item) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    .facetwp-template ul.products:has(.ib-item) {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
}

/* ─── Mobile: show sidebar at top on product category pages ──────────────── */
@media (max-width: 767px) {
    /* Theme hides the aside via .sidebar-toggle { display:none } — override.
       Scoped to .tax-product_cat so the main shop landing page (category grid)
       is unaffected. */
    .tax-product_cat .sidebar-shop.sidebar-toggle {
        display: block !important;
        flex: 0 0 100% !important;
        width: 100% !important;
    }

    /* Theme uses order:-1 on .content to visually push it above the sidebar,
       and min-width:480px gives it flex:1 0% which can cause a mid-range
       broken layout. Force full-width stacked column below 768px. */
    .tax-product_cat .content-row .content {
        order: 0 !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}