/* =========================================================================
   Shop listing - restyles legacy markup that ships with shop.js
   The class names below (.shopwrapper, .category, .mivu-pagination, etc.)
   are required by shop.js and cannot be renamed. We just dress them.
   ========================================================================= */

.shop-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    align-items: center;
    justify-content: space-between;
    padding: var(--s-4) 0;
    border-bottom: 1px solid var(--c-line);
    margin-bottom: var(--s-5);
}
.shop-toolbar__group { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.shop-toolbar .shop-search {
    position: relative;
    flex: 1 1 280px;
    max-width: 360px;
}
.shop-toolbar .shop-search input {
    width: 100%;
    height: 40px;
    padding: 0 var(--s-4) 0 var(--s-7);
    background: var(--c-paper);
    border: 1px solid var(--c-line-cool);
    border-radius: var(--r-pill);
    font-size: var(--fs-sm);
}
.shop-toolbar .shop-search input:focus {
    outline: none;
    border-color: var(--c-brass);
    box-shadow: 0 0 0 3px rgb(176 123 44 / 0.15);
}
.shop-toolbar .shop-search::before {
    content: "\f002";
    font-family: "Font Awesome 5 Pro";
    font-weight: 400;
    position: absolute;
    left: var(--s-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-muted-soft);
    pointer-events: none;
}

.shop-result-summary {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
    flex-wrap: wrap;
    margin-bottom: var(--s-5);
}
.shop-result-summary .chosen_category {
    color: var(--c-brass);
    font-weight: 600;
    border-bottom: 1.5px dashed var(--c-brass);
    cursor: pointer;
}
.shop-result-summary .productShowCount {
    color: var(--c-ink);
    font-weight: 700;
}

.shopwrapper.wrapper {
    display: grid;
    gap: var(--s-5);
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    min-height: 320px;
    padding: 0;
}
@media (max-width: 640px) {
    .shopwrapper.wrapper { gap: var(--s-3); grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
    .shopwrapper.wrapper { grid-template-columns: 1fr; }
}

/* Legacy "box" cards rendered by shop.js - restyled to match .product-card
   on the home/product pages.
   shop.js writes .product-body before .product-still-image, so we use
   column-reverse to render the image on top. */
.shopwrapper .box {
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    text-decoration: none;
    color: inherit;
    background: var(--c-paper);
    border: 1px solid var(--c-line-cool);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: transform var(--t-base) var(--ease-out),
                box-shadow var(--t-base) var(--ease-out),
                border-color var(--t-base) var(--ease-out);
}
.shopwrapper .box:hover {
    transform: translateY(-3px);
    box-shadow: var(--c-shadow-2);
    border-color: var(--c-bone);
    color: inherit;
}

/* Image on top */
.shopwrapper .box .product-still-image {
    position: relative;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    width: 100%;
    margin: 0 !important;
    background: var(--c-paper);
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--c-line-cool);
}
.shopwrapper .box img.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--s-4);
    transition: transform var(--t-slow) var(--ease-out);
}
.shopwrapper .box:hover img.product-image { transform: scale(1.04); }

/* Body */
.shopwrapper .box .product-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-4);
}
.shopwrapper .box .product-name,
.shopwrapper .box .product-name a {
    font-family: var(--f-display);
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--c-ink);
    line-height: var(--lh-snug);
    text-decoration: none;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(var(--fs-lg) * var(--lh-snug) * 2);
}
.shopwrapper .box .product-description {
    font-size: var(--fs-sm);
    color: var(--c-muted);
    line-height: var(--lh-snug);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (max-width: 640px) {
    .shopwrapper .box .product-description { display: none; }
}

/* Inventory pill (server returns inventory_html with .inventory-status text) */
.shopwrapper .box .inventory-status {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: 4px 10px;
    border-radius: var(--r-pill);
    background: var(--c-forest-soft);
    color: var(--c-forest);
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1;
    width: fit-content;
    margin: 0;
}
.shopwrapper .box .inventory-status .mdi { font-size: 0.5rem; line-height: 1; }
.shopwrapper .box .inventory-status.is-icon-not {
    background: var(--c-bone);
    color: var(--c-muted);
}

/* Price + CTA row - use .product-price-wrapper as the meta container. */
.shopwrapper .box .product-price-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-top: auto;
    flex-wrap: wrap;
}
.shopwrapper .box .product-price {
    font-family: var(--f-display);
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--c-ink);
    line-height: 1;
}
.shopwrapper .box .product-before-price {
    display: block;
    font-size: var(--fs-xs);
    color: var(--c-muted);
    text-decoration: line-through;
    margin-bottom: 2px;
    font-family: var(--f-body);
}

/* Discount badge (top-left over image) */
.shopwrapper .box .discount-rectangle {
    position: absolute;
    top: var(--s-3); left: var(--s-3); z-index: 2;
    background: var(--c-coral);
    color: #fff;
    border-radius: var(--r-sm);
    padding: 4px 10px;
    font-weight: 600;
    font-size: var(--fs-xs);
    letter-spacing: var(--ls-wide);
    box-shadow: var(--c-shadow-1);
}
.shopwrapper .box .discount-rectangle .bubble-text { line-height: 1; }

/* Kjøp / Se mer button - restyle to match .product-card__cta */
.shopwrapper .box .product-purchase-button {
    margin: 0;
    flex: 0 0 auto;
}
.shopwrapper .box .product-purchase-button .is-btn,
.shopwrapper .box .product-purchase-button .btn,
.shopwrapper .box .product-purchase-button > span {
    all: unset;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    height: 36px;
    padding: 0 14px;
    background: var(--c-navy);
    color: #fff;
    border: 1.5px solid var(--c-navy);
    border-radius: var(--r-sm);
    font-family: var(--f-body);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--ls-caps);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out);
    box-sizing: border-box;
}
.shopwrapper .box .product-purchase-button .is-btn:hover,
.shopwrapper .box .product-purchase-button .btn:hover,
.shopwrapper .box .product-purchase-button > span:hover {
    background: var(--c-brass);
    border-color: var(--c-brass);
    color: #fff;
}

/* Mobile: two-column grid - tighten legacy box card to fit narrow width */
@media (max-width: 640px) {
    .shopwrapper .box img.product-image { padding: var(--s-2); }
    .shopwrapper .box .product-body { padding: var(--s-3); gap: var(--s-2); }
    .shopwrapper .box .product-name,
    .shopwrapper .box .product-name a {
        font-size: var(--fs-md);
        min-height: calc(var(--fs-md) * var(--lh-snug) * 2);
    }
    .shopwrapper .box .product-price-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--s-2);
    }
    .shopwrapper .box .product-price { font-size: var(--fs-md); }
    .shopwrapper .box .product-before-price { font-size: 0.65rem; }
    .shopwrapper .box .inventory-status {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
    .shopwrapper .box .product-purchase-button { width: 100%; }
    .shopwrapper .box .product-purchase-button .is-btn,
    .shopwrapper .box .product-purchase-button .btn,
    .shopwrapper .box .product-purchase-button > span {
        width: 100%;
        height: 40px;
        font-size: 0.7rem;
        letter-spacing: 0.04em;
    }
    .shopwrapper .box .discount-rectangle {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}

/* Loader overlay */
#productLoader {
    background: rgb(255 255 255 / 0.92) !important;
    backdrop-filter: blur(2px);
}
#productLoader .loading-ellipsis {
    color: var(--c-muted);
    font-family: var(--f-body);
    font-weight: 500;
}

/* Empty state */
#noMoreProductsImg {
    text-align: center;
    padding: var(--s-9) var(--s-5);
    color: var(--c-muted);
}
#noMoreProductsImg .text-primary { color: var(--c-brass) !important; }

/* Pagination */
.mivu-pagination {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    align-items: center;
    padding: var(--s-3) var(--s-4);
    background: var(--c-paper);
    border: 1px solid var(--c-line-cool);
    border-radius: var(--r-pill);
    box-shadow: var(--c-shadow-1);
    position: sticky;
    bottom: var(--s-5);
    margin-inline: auto;
    width: fit-content;
}
.mivu-pagination .mivu-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 var(--s-3);
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--c-ink);
    font-weight: 600;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.mivu-pagination .mivu-page.active,
.mivu-pagination .mivu-page:hover {
    background: var(--c-navy);
    color: #fff;
}
.mivu-pagination .mivu-page.no-action { background: var(--c-cream); color: var(--c-ink); cursor: default; }
.mivu-pagination .mivu-page.after-me { display: none; }
.hide-pagination {
    position: absolute;
    top: -16px; left: 50%;
    transform: translateX(-50%);
    width: 32px; height: 32px;
    background: var(--c-paper);
    border: 1px solid var(--c-line-cool);
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-muted);
    cursor: pointer;
    box-shadow: var(--c-shadow-1);
}

/* Mobile category drawer (#mobileCategories.solbris-sidebar) */
#mobileCategories.solbris-sidebar {
    position: fixed;
    top: 0; right: 0;
    width: min(380px, 100vw);
    height: 100vh;
    background: var(--c-paper);
    box-shadow: var(--c-shadow-3);
    transform: translateX(100%);
    transition: transform var(--t-base) var(--ease-out);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
#mobileCategories.solbris-sidebar.solbris-open { transform: translateX(0); }
#mobileCategories.solbris-sidebar .closebtn {
    position: absolute; top: var(--s-3); right: var(--s-4);
    font-size: 1.6rem; line-height: 1;
    color: var(--c-muted); text-decoration: none;
    z-index: 10;
}
#mobileCategories .product-load-count {
    padding: var(--s-4) var(--s-5) var(--s-3);
    font-size: var(--fs-sm);
    color: var(--c-muted);
}
#mobileCategories .filter-box {
    padding: var(--s-4) var(--s-5);
    background: var(--c-cream);
    border-block: 1px solid var(--c-line);
    margin-bottom: var(--s-4);
}
#mobileCategories .filter-box h2 {
    font-size: var(--fs-lg);
    margin: 0 0 var(--s-3);
}
#mobileCategories .filter-box label { font-size: var(--fs-sm); font-weight: 600; }
#mobileCategories .filter-box select.form-control {
    height: 40px; font-size: var(--fs-sm);
    border-radius: var(--r-xs);
    border: 1px solid var(--c-line-cool);
    padding: 0 var(--s-3);
    background: var(--c-paper);
}
#mobileCategories .showFilteredProductsBtn {
    margin: var(--s-4) var(--s-5);
    background: var(--c-brass);
    border: 0;
    color: #fff;
    height: 48px;
    border-radius: var(--r-sm);
    text-align: center;
    text-decoration: none;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}

/* Category list inside the drawer */
.top-category-container .category-container {
    display: flex; flex-direction: column; gap: 2px;
    padding: 0 var(--s-3);
}
.top-category-container .category {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-sm);
    color: var(--c-ink);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease-out);
}
.top-category-container .category:hover { background: var(--c-cream); }
.top-category-container .category.active { background: var(--c-navy); color: #fff; }
.top-category-container .category .category-text { margin: 0; font-weight: 500; font-size: var(--fs-sm); }
.top-category-container .category .badge.featured {
    background: var(--c-brass); color: #fff;
    width: 18px; height: 18px; padding: 0; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
}
.sub-category-container {
    background: var(--c-paper);
    padding: var(--s-3);
    border-top: 1px solid var(--c-line);
}
.scroll-up-cats, .scroll-down-cats {
    text-align: center; padding: var(--s-2);
    color: var(--c-muted);
}

/* Inline category bar at top of shop */
.shop-categories-inline {
    display: flex;
    gap: var(--s-2);
    overflow-x: auto;
    padding: var(--s-3) 0;
    margin-bottom: var(--s-5);
    scrollbar-width: none;
}
.shop-categories-inline::-webkit-scrollbar { display: none; }
.shop-categories-inline .cat-box {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s-1);
    width: 110px;
    padding: var(--s-3);
    background: var(--c-paper);
    border: 1px solid var(--c-line-cool);
    border-radius: var(--r-md);
    color: var(--c-ink);
    text-decoration: none;
    transition: all var(--t-fast) var(--ease-out);
    cursor: pointer;
    text-align: center;
}
.shop-categories-inline .cat-box:hover,
.shop-categories-inline .cat-box.active {
    border-color: var(--c-brass);
    background: var(--c-brass-soft);
    color: var(--c-ink);
}
.shop-categories-inline .cat-box i { color: var(--c-brass); font-size: 1.2rem; }
.shop-categories-inline .cat-box p { margin: 0; font-size: var(--fs-xs); font-weight: 600; line-height: 1.2; }
.shop-categories-inline .cat-box small { font-size: 10px; color: var(--c-muted); }

/* ion.rangeSlider tweak - match brass accent */
.irs--flat .irs-bar,
.irs--flat .irs-handle > i:first-child,
.irs--flat .irs-from,
.irs--flat .irs-to,
.irs--flat .irs-single { background: var(--c-brass) !important; }
.irs--flat .irs-from::before,
.irs--flat .irs-to::before,
.irs--flat .irs-single::before { border-top-color: var(--c-brass) !important; }
