/**
 * Zimbi Category Browser
 * Version 1.3.0
 */

.zcb-browser {
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    color: #1f2937;
    font-family: inherit;
}

.zcb-browser *,
.zcb-browser *::before,
.zcb-browser *::after {
    box-sizing: border-box;
}

.zcb-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #1f2937;
    color: #ffffff;
}

.zcb-title {
    display: block;
    overflow: hidden;
    flex: 1;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zcb-back {
    min-width: auto;
    margin: 0;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    box-shadow: none;
    color: #ffffff;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.zcb-back:hover,
.zcb-back:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.65);
    color: #ffffff;
}

.zcb-back:focus-visible,
.zcb-category-link:focus-visible,
.zcb-category-drilldown:focus-visible,
.zcb-view-current-category:focus-visible,
.zcb-retry-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.zcb-category-list {
    position: relative;
    min-height: 180px;
    max-height: 65vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.zcb-category-level {
    width: 100%;
}

.zcb-category-row {
    display: flex;
    min-height: 54px;
    align-items: stretch;
    border-bottom: 1px solid #eef0f2;
    background: #ffffff;
}

.zcb-category-row:last-child {
    border-bottom: 0;
}

.zcb-category-row:hover {
    background: #f8fafc;
}

.zcb-category-link {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    padding: 14px 16px;
    color: #1f2937;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.zcb-category-link:hover,
.zcb-category-link:focus {
    color: #111827;
    text-decoration: none;
}

.zcb-category-drilldown {
    display: flex;
    width: 56px;
    min-width: 56px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-left: 1px solid #eef0f2;
    border-radius: 0;
    box-shadow: none;
    color: #4b5563;
    cursor: pointer;
    font-family: inherit;
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
}

.zcb-category-drilldown:hover,
.zcb-category-drilldown:focus {
    background: #edf2f7;
    color: #111827;
}

.zcb-view-current-category {
    display: flex;
    min-height: 54px;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px;
    background: #f3f4f6;
    border-bottom: 1px solid #dfe3e8;
    color: #111827;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
}

.zcb-view-current-category:hover,
.zcb-view-current-category:focus {
    background: #e9edf2;
    color: #111827;
    text-decoration: none;
}

.zcb-view-current-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.zcb-view-current-arrow {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1;
}

.zcb-loading {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
}

.zcb-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid #d1d5db;
    border-top-color: #1f2937;
    border-radius: 50%;
    animation: zcb-spin 0.8s linear infinite;
}

@keyframes zcb-spin {
    to {
        transform: rotate(360deg);
    }
}

.zcb-empty-message {
    padding: 28px 18px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.zcb-error {
    padding: 24px 18px;
    color: #7f1d1d;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.zcb-error p {
    margin: 0 0 14px;
}

.zcb-retry-button {
    margin: 0;
    padding: 10px 16px;
    background: #1f2937;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    color: #ffffff;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.zcb-retry-button:hover,
.zcb-retry-button:focus {
    background: #111827;
    color: #ffffff;
}

.zcb-slide-forward {
    animation: zcb-slide-forward 0.16s ease-out;
}

.zcb-slide-back {
    animation: zcb-slide-back 0.16s ease-out;
}

@keyframes zcb-slide-forward {
    from {
        opacity: 0;
        transform: translateX(18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zcb-slide-back {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.zcb-browser.zcb-is-loading .zcb-category-drilldown,
.zcb-browser.zcb-is-loading .zcb-back {
    pointer-events: none;
}

@media (max-width: 768px) {
    .zcb-browser {
        width: 100%;
        max-width: none;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .zcb-category-list {
        max-height: calc(100vh - 70px);
    }

    .zcb-header {
        min-height: 62px;
        padding: 12px 14px;
    }

    .zcb-title {
        font-size: 16px;
    }

    .zcb-category-row {
        min-height: 58px;
    }

    .zcb-category-link {
        padding: 16px;
        font-size: 16px;
    }

    .zcb-category-drilldown {
        width: 62px;
        min-width: 62px;
    }

    .zcb-view-current-category {
        min-height: 58px;
        padding: 16px;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zcb-spinner,
    .zcb-slide-forward,
    .zcb-slide-back {
        animation: none;
    }
}

/* WooCommerce product-category archive integration. */
.zcb-archive-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
    clear: both;
    width: 100%;
}

.zcb-archive-sidebar {
    min-width: 0;
}

.zcb-browser--archive {
    position: sticky;
    top: 24px;
    max-width: none;
}

.admin-bar .zcb-browser--archive {
    top: 56px;
}

.zcb-archive-products {
    min-width: 0;
}

.zcb-archive-products .woocommerce-result-count {
    float: left;
}

.zcb-archive-products .woocommerce-ordering {
    float: right;
}

.zcb-archive-products ul.products {
    clear: both;
}

.zcb-category-row--current {
    background: rgba(245, 130, 32, 0.10);
    box-shadow: inset 4px 0 0 #f58220;
}

.zcb-category-row--current .zcb-category-link {
    color: #123b6d;
    font-weight: 700;
}

@media (max-width: 921px) {
    .zcb-archive-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .zcb-browser--archive {
        position: static;
    }
}

/* Homepage catalogue: category browser plus AJAX product panel. */
.zcb-catalogue {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 32px;
    width: 100%;
    align-items: start;
}

.zcb-catalogue > .zcb-browser {
    max-width: none;
}

.zcb-product-panel {
    min-width: 0;
    padding: 0;
}

.zcb-product-panel__header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    border-bottom: 2px solid #123b6d;
}

.zcb-product-panel__title {
    margin: 0;
    color: #123b6d;
    font-family: inherit;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
}

.zcb-product-panel__view-all {
    color: #f58220;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.zcb-product-panel__view-all:hover,
.zcb-product-panel__view-all:focus {
    color: #123b6d;
    text-decoration: underline;
}

.zcb-product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px 22px;
}

.zcb-product-card {
    min-width: 0;
    margin: 0;
}

.zcb-product-card__link {
    display: block;
    color: #123b6d;
    text-decoration: none;
}

.zcb-product-card__image-wrap {
    display: flex;
    width: 100%;
    aspect-ratio: 1 / 1;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    background: #ffffff;
}

.zcb-product-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.zcb-product-card__link:hover .zcb-product-card__image,
.zcb-product-card__link:focus .zcb-product-card__image {
    transform: scale(1.025);
}

.zcb-product-card__name {
    display: block;
    min-height: 2.7em;
    color: #123b6d;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.zcb-product-card__price {
    margin-top: 7px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.zcb-product-card__price del {
    margin-right: 5px;
    color: #6b7280;
    font-weight: 400;
}

.zcb-product-card__price ins {
    color: #f58220;
    text-decoration: none;
}

.zcb-products-loading,
.zcb-products-empty,
.zcb-products-error {
    display: flex;
    min-height: 280px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    color: #4b5563;
    text-align: center;
}

.zcb-products-error {
    flex-direction: column;
    color: #7f1d1d;
}

.zcb-products-error p {
    margin: 0;
}

@media (max-width: 1100px) {
    .zcb-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 921px) {
    .zcb-catalogue {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .zcb-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .zcb-product-panel {
        padding: 0 14px 24px;
    }

    .zcb-product-panel__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding-bottom: 12px;
    }

    .zcb-product-panel__title {
        font-size: 21px;
    }

    .zcb-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 16px;
    }

    /* =========================================================
   HOMEPAGE PRODUCT GRID — REDUCE IMAGE HEIGHT
   ========================================================= */

    .zcb-product-card__image {
        height: 220px;
        overflow: hidden;
        background: #ffffff;
    }

    .zcb-product-card__image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }
}

/* V1 mobile catalogue refinements. */
.zcb-change-category {
    display: none;
}

@media (max-width: 640px) {
    .zcb-browser {
        margin: 0 12px;
        border-radius: 10px;
        overflow: hidden;
    }

    .zcb-header {
        min-height: 54px;
        padding: 10px 14px;
    }

    .zcb-title {
        font-size: 18px;
        line-height: 1.25;
    }

    .zcb-back {
        min-height: 38px;
        padding: 6px 11px;
        font-size: 15px;
    }

    .zcb-category-row {
        min-height: 58px;
    }

    .zcb-category-link {
        padding: 15px 16px;
        font-size: 17px;
        line-height: 1.25;
    }

    .zcb-category-drilldown {
        width: 52px;
        min-width: 52px;
        font-size: 28px;
    }

    .zcb-view-current-category {
        padding: 14px 16px;
        font-size: 15px;
    }

    .zcb-browser.zcb-mobile-selection .zcb-category-list {
        display: none;
    }

    .zcb-browser.zcb-mobile-selection .zcb-header {
        background: #123b6d;
    }

    .zcb-browser.zcb-mobile-selection .zcb-title,
    .zcb-browser.zcb-mobile-selection .zcb-back {
        display: none;
    }

    .zcb-browser.zcb-mobile-selection .zcb-change-category {
        display: block;
        width: 100%;
        border: 0;
        padding: 10px 12px;
        background: transparent;
        color: #fff;
        font-size: 16px;
        font-weight: 700;
        text-align: left;
    }

    /* Keep only the floating cart on mobile. */
    .ast-site-header-cart,
    .ast-header-woo-cart,
    .ast-header-account,
    .ast-mobile-header-wrap .ast-site-header-cart {
        display: none !important;
    }

    /* Make Astra's mobile menu readable if a transparent-header colour leaks into it. */
    .ast-mobile-popup-drawer .ast-mobile-popup-inner,
    .ast-mobile-popup-drawer .main-header-menu,
    .ast-mobile-popup-drawer .menu-link {
        background: #ffffff;
        color: #123b6d !important;
    }

    .ast-mobile-popup-drawer .menu-link:hover,
    .ast-mobile-popup-drawer .menu-link:focus,
    .ast-mobile-popup-drawer .current-menu-item > .menu-link {
        color: #f58220 !important;
    }
}

/* Zimbi V1 mobile navigation drawer. */
.zcb-mobile-drawer {
    display: none;
}

@media (max-width: 921px) {
    body.zcb-mobile-drawer-open {
        overflow: hidden;
    }

    .zcb-mobile-drawer {
        position: fixed;
        inset: 0;
        z-index: 999999;
        display: block;
        visibility: hidden;
        pointer-events: none;
    }

    .zcb-mobile-drawer.is-open {
        visibility: visible;
        pointer-events: auto;
    }

    .zcb-mobile-drawer__backdrop {
        position: absolute;
        inset: 0;
        width: 100%;
        border: 0;
        background: rgba(8, 25, 47, 0.58);
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .zcb-mobile-drawer.is-open .zcb-mobile-drawer__backdrop {
        opacity: 1;
    }

    .zcb-mobile-drawer__panel {
        position: absolute;
        inset: 0 0 0 auto;
        width: min(92vw, 430px);
        height: 100%;
        overflow-y: auto;
        background: #fff;
        box-shadow: -10px 0 30px rgba(8, 25, 47, 0.2);
        transform: translateX(100%);
        transition: transform 0.22s ease;
        -webkit-overflow-scrolling: touch;
    }

    .zcb-mobile-drawer.is-open .zcb-mobile-drawer__panel {
        transform: translateX(0);
    }

    .zcb-mobile-drawer__top {
        position: sticky;
        top: 0;
        z-index: 3;
        display: flex;
        min-height: 64px;
        align-items: center;
        justify-content: space-between;
        padding: 12px 18px;
        background: #123b6d;
        color: #fff;
    }

    .zcb-mobile-drawer__top strong {
        font-size: 20px;
    }

    .zcb-mobile-drawer__close {
        display: inline-flex;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 50%;
        background: rgba(255,255,255,.12);
        color: #fff;
        font-size: 30px;
        line-height: 1;
    }

    .zcb-mobile-drawer__nav {
        display: grid;
        padding: 12px 0;
    }

    .zcb-mobile-drawer__nav button,
    .zcb-mobile-drawer__nav a {
        display: flex;
        min-height: 60px;
        align-items: center;
        width: 100%;
        border: 0;
        border-bottom: 1px solid #e7ebf0;
        padding: 14px 22px;
        background: #fff;
        color: #123b6d;
        font-size: 19px;
        font-weight: 700;
        text-align: left;
        text-decoration: none;
    }

    .zcb-mobile-drawer__nav button::after {
        content: '›';
        margin-left: auto;
        color: #f58220;
        font-size: 28px;
        font-weight: 400;
    }

    .zcb-mobile-drawer__view-back {
        width: 100%;
        min-height: 48px;
        border: 0;
        border-bottom: 1px solid #e7ebf0;
        padding: 10px 16px;
        background: #f7f9fb;
        color: #123b6d;
        font-size: 16px;
        font-weight: 700;
        text-align: left;
    }

    .zcb-mobile-drawer__view .zcb-catalogue {
        display: block;
        padding: 12px 0 28px;
    }

    .zcb-mobile-drawer__view .zcb-browser {
        margin: 0 12px 18px;
    }

    .zcb-mobile-drawer__view .zcb-product-panel {
        padding: 0 12px 24px;
    }

    .zcb-mobile-drawer__view .zcb-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 12px;
    }

    .zcb-mobile-drawer__view .zcb-product-card__image-wrap,
    .zcb-mobile-drawer__view .zcb-product-card__image {
        height: 150px;
    }

    .zcb-mobile-contact {
        display: grid;
        gap: 12px;
        padding: 18px;
    }

    .zcb-mobile-contact > a,
    .zcb-mobile-contact > div {
        display: grid;
        grid-template-columns: 42px 1fr;
        column-gap: 12px;
        align-items: center;
        min-height: 76px;
        border: 1px solid #dce3eb;
        border-radius: 10px;
        padding: 12px 14px;
        background: #fff;
        color: #123b6d;
        text-decoration: none;
    }

    .zcb-mobile-contact span {
        grid-row: 1 / span 2;
        font-size: 25px;
        text-align: center;
    }

    .zcb-mobile-contact strong {
        font-size: 17px;
    }

    .zcb-mobile-contact small {
        color: #5d6875;
        font-size: 13px;
        line-height: 1.35;
    }
}


.zcb-product-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 24px 0 4px;
}

.zcb-product-pagination__button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #1f2937;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.zcb-product-pagination__button:hover,
.zcb-product-pagination__button:focus,
.zcb-product-pagination__button.is-current {
    border-color: #1f2937;
    background: #1f2937;
    color: #ffffff;
}

.zcb-product-pagination__button:disabled {
    opacity: 0.4;
    cursor: default;
}


/* Keep the homepage hero compact enough to reveal the catalogue below it.
 * Astra/Spectra may place the height on the first wrapper rather than directly
 * on the Cover block, so constrain both the wrapper and common hero children.
 */
body.home .entry-content > :first-child {
    height: clamp(300px, 40vh, 400px) !important;
    min-height: 0 !important;
    max-height: 400px !important;
    overflow: hidden;
}

body.home .entry-content > :first-child .wp-block-cover,
body.home .entry-content > :first-child.wp-block-cover,
body.home .entry-content > :first-child .wp-block-uagb-container,
body.home .entry-content > :first-child.wp-block-uagb-container {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 400px !important;
}

@media (max-width: 921px) {
    body.home .entry-content > :first-child {
        height: clamp(220px, 30svh, 270px) !important;
        max-height: 270px !important;
    }

    body.home .entry-content > :first-child .wp-block-cover,
    body.home .entry-content > :first-child.wp-block-cover,
    body.home .entry-content > :first-child .wp-block-uagb-container,
    body.home .entry-content > :first-child.wp-block-uagb-container {
        height: 100% !important;
        min-height: 0 !important;
        max-height: 270px !important;
    }
}
