/* ========== SHOP PAGE ========== */
/* minmax(0,1fr) lets the product column shrink to the screen.
   A plain 1fr cannot shrink below its content, which is what pushed the
   right-hand product cards off-screen on phones. */
.shop-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 32px;
    padding-bottom: 60px;
}

.shop-main { min-width: 0; }

/* Sidebar */
.shop-sidebar {
    position: sticky;
    top: 140px;
    height: fit-content;
    max-height: calc(100vh - 160px);
    border: 1px solid #F1F5F9;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15,23,42,.05);
    background: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

.shop-sidebar .sidebar-section {
    border: 0;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    margin: 0;
}

.shop-sidebar .btn-block {
    margin: 16px 20px;
    width: calc(100% - 40px);
}

.sidebar-section {
    background: var(--white);
    padding: 20px;
    margin-bottom: 16px;
}

.sidebar-section h4 {
    font-size: 0.95rem;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.filter-list a,
.filter-list label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

.filter-list a:hover,
.filter-list a.active {
    color: var(--primary);
}

.filter-group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 0 4px;
    border-top: 1px solid var(--border-light);
    color: var(--primary);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.filter-list .count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ========== PRICE RANGE FILTER ========== */
.price-range-slider {
    position: relative;
    height: 24px;
    margin: 12px 0 16px;
}

/* Grey track */
.price-range-slider .range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: #F1F5F9;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

/* Orange fill */
.price-range-slider .range-fill {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    transform: translateY(-50%);
    background: var(--primary);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
    transition: left 0.15s ease, width 0.15s ease;
}

/* Both inputs — same tiny height as the thumb, centered on the track */
.price-range-slider input[type="range"] {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 18px;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    z-index: 2;
}

/* WebKit thumb */
.price-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--primary);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
    cursor: pointer;
    pointer-events: auto;
    margin: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(249, 115, 22, 0.35);
}

/* Firefox thumb */
.price-range-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--primary);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.15s ease;
}

.price-range-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
}

/* Hide native tracks */
.price-range-slider input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
    border: none;
    height: 18px;
}
.price-range-slider input[type="range"]::-moz-range-track {
    background: transparent;
    border: none;
    height: 18px;
}

/* Live value display */
.price-range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
}

/* Number inputs */
.price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.price-input-wrap label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.price-input-wrap .form-control {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.85rem;
    border: 1px solid #F1F5F9;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s ease;
    -moz-appearance: textfield;
}

.price-input-wrap .form-control::-webkit-outer-spin-button,
.price-input-wrap .form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.price-input-wrap .form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* ========== SEARCH ========== */
.shop-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 8px 8px 8px 46px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.shop-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.shop-search-icon {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
}

.shop-search-input {
    flex: 1;
    min-width: 0;
    padding: 8px 4px;
    border: 0;
    background: transparent;
    font: inherit;
    color: var(--text);
    text-overflow: ellipsis;
}

.shop-search-input:focus {
    outline: none;
}

.shop-search .btn { flex-shrink: 0; }

.shop-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--text-light);
}

.shop-search-clear:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ========== TOOLBAR ========== */
.shop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid #F1F5F9;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15,23,42,.04);
    padding: 12px 18px;
}

.shop-toolbar p {
    margin: 0;
    font-size: .92rem;
    color: var(--text-light);
}

.shop-toolbar select {
    padding: 8px 14px;
    border: 1px solid #F1F5F9;
    border-radius: 10px;
    background: #fff;
    font-size: .9rem;
    cursor: pointer;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.sort-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sort-form label {
    font-size: .9rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.view-toggle { display: flex; align-items: center; gap: 6px; }
.view-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--secondary);
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.view-btn:hover { background: var(--bg-light); }
.view-btn.active { background: var(--primary-light); color: var(--primary); }
.view-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ========== PRODUCT CARDS ========== */
/* min(100%, 210px) guarantees a column can never be wider than the screen */
.shop-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    gap: 22px;
}
.shop-products .product-card {
    display: flex; flex-direction: column; background: #fff; min-width: 0;
    border: 1px solid #F1F5F9; border-radius: 18px; overflow: hidden;
    box-shadow: 0 8px 25px rgba(15,23,42,.045);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.shop-products .product-card:hover {
    transform: translateY(-5px);
    border-color: #E2E8F0;
    box-shadow: 0 18px 36px rgba(15,23,42,.10);
}
.shop-products .product-image { aspect-ratio: 1 / 1; background: #F8FAFC; flex-shrink: 0; }
.shop-products .product-image-link { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
.shop-products .product-image img { width: 100%; height: 100%; object-fit: contain; padding: 18px; }
.shop-products .product-wishlist { border: 0; cursor: pointer; opacity: 1; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

.shop-products .product-info { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 16px 18px 18px; }
.shop-products .product-category { font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); margin-bottom: 4px; }
/* titles may use two lines instead of being cut after one */
.shop-products .product-info h3 {
    font-size: 1rem; line-height: 1.35; min-height: 2.7em; margin-bottom: 4px;
    -webkit-line-clamp: 2; overflow-wrap: anywhere;
}
.shop-products .product-info h3 a:hover { color: var(--primary); }
.shop-products .product-meta { margin-bottom: 8px; }
.shop-products .product-desc { display: none; font-size: .9rem; color: var(--text-light); margin-bottom: 10px; }
.shop-products .product-rating i { font-size: .75rem; color: #ffc107; }
.shop-products .product-rating i.off { color: #ddd; }
.shop-products .product-buy { margin-top: auto; padding-top: 6px; }
.shop-products .product-price { margin-bottom: 12px; }
.shop-products .product-actions .btn { width: 100%; border-radius: 12px; padding: 11px; }

/* List view */
.shop-products[data-view="list"] { grid-template-columns: minmax(0, 1fr); gap: 16px; }
.shop-products[data-view="list"] .product-card { flex-direction: row; align-items: stretch; }
.shop-products[data-view="list"] .product-card:hover { transform: translateY(-3px); }
.shop-products[data-view="list"] .product-image { width: 220px; aspect-ratio: auto; min-height: 200px; }
.shop-products[data-view="list"] .product-info { flex-direction: column; justify-content: center; padding: 20px 24px; }
.shop-products[data-view="list"] .product-info h3 { min-height: 0; font-size: 1.1rem; }
.shop-products[data-view="list"] .product-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shop-products[data-view="list"] .product-buy { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 8px; padding-top: 0; }
.shop-products[data-view="list"] .product-price { margin: 0; }
.shop-products[data-view="list"] .product-actions .btn { width: auto; padding: 11px 24px; }

/* ========== WISHLIST TOAST ========== */

/* Pagination */
.shop-pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.shop-pagination a {
    min-width: 40px; height: 40px; padding: 0 12px;
    border-radius: 12px; border: 1px solid #F1F5F9; background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .9rem;
}
.shop-pagination a:hover { border-color: var(--primary); color: var(--primary); }
.shop-pagination a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ========== BULK CTA BANNER ========== */
.cta-banner--shop {
    position: relative;
    background: linear-gradient(135deg, var(--primary-light) 0%, #F1F5F9 100%);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    display: grid;
    align-items: center;
    margin: 20px 0;
    min-height: 260px;
    overflow: hidden;
}

.cta-banner--shop .cta-banner-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
    pointer-events: none;
    z-index: 0;
}

.cta-banner--shop .cta-banner-content {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin-left: auto;
    text-align: left;
}

.cta-banner--shop h2,
.cta-banner--shop h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    line-height: 1.25;
}

.cta-banner--shop p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* ========== MOBILE FILTER BUTTON / DRAWER (hidden on desktop) ========== */
.mobile-filter-btn,
.sidebar-overlay,
.mobile-close-btn { display: none; }

/* ========== TABLET & MOBILE ========== */
@media (max-width: 1024px) {

    .shop-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-bottom: 48px; }

    .mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 44px;
        background: var(--primary);
        color: #fff;
        border: none;
        padding: 10px 22px;
        border-radius: 12px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 16px;
        width: fit-content;
    }
    .mobile-filter-btn:hover { background: var(--primary-dark, #C2410C); }

    /* filters become a slide-in drawer */
    .shop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 88vw;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        background: #fff;
        z-index: 9999;
        margin: 0;
        border-radius: 0;
        border: none;
        box-shadow: 5px 0 25px rgba(0,0,0,0.15);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-top: 56px;                       /* room for the close button */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateX(-100%);
        visibility: hidden;                      /* not tabbable while closed */
        transition: transform 0.3s ease-in-out, visibility 0s linear 0.3s;
    }
    .shop-sidebar.active {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.3s ease-in-out, visibility 0s linear 0s;
    }

    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 10px;
        right: 12px;
        width: 40px;
        height: 40px;
        background: #f0f0f0;
        border: none;
        border-radius: 50%;
        color: #333;
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 10;
    }
    .mobile-close-btn:hover { background: #e0e0e0; }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }

    body.no-scroll { overflow: hidden; }

    /* bigger touch targets inside the drawer */
    .shop-sidebar .filter-list a,
    .shop-sidebar .filter-list label { min-height: 40px; }
    .shop-sidebar .color-filter-label { min-height: 38px; }
    .price-input-wrap .form-control { font-size: 16px; padding: 10px; }   /* >=16px: no iOS zoom */

    .price-range-slider { height: 30px; }
    .price-range-slider input[type="range"] { height: 22px; }
    .price-range-slider input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
    .price-range-slider input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
    .price-range-slider input[type="range"]::-webkit-slider-runnable-track { height: 22px; }
    .price-range-slider input[type="range"]::-moz-range-track { height: 22px; }

    .shop-search-input { font-size: 16px; }
    .shop-toolbar select { font-size: 16px; min-height: 42px; }

    /* cards: no hover-lift on touch screens */
    .shop-products .product-card:hover { transform: none; }
}

@media (hover: none) {
    .shop-products .product-card:hover,
    .shop-products[data-view="list"] .product-card:hover { transform: none; }
}

/* ---------- Phones & small tablets ---------- */
@media (max-width: 640px) {

    .mobile-filter-btn { width: 100%; margin-bottom: 14px; }

    .shop-search { padding: 6px 6px 6px 40px; gap: 6px; margin-bottom: 12px; border-radius: 14px; }
    .shop-search-icon { left: 15px; }
    .shop-search .btn { padding: 9px 16px; min-height: 40px; }

    .shop-toolbar { padding: 12px 14px; margin-bottom: 16px; gap: 10px; border-radius: 14px; }
    .shop-toolbar p { width: 100%; font-size: .88rem; }
    .toolbar-right { width: 100%; justify-content: space-between; gap: 10px; flex-wrap: nowrap; }
    .sort-form { flex: 1; min-width: 0; }
    .sort-form label { font-size: .85rem; }
    .sort-form select { flex: 1; min-width: 0; width: 100%; padding: 8px 10px; }
    .view-toggle { flex-shrink: 0; }
    .view-btn { width: 42px; height: 42px; }

    /* two product cards per row, always inside the screen */
    .shop-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .shop-products .product-card { border-radius: 14px; }
    .shop-products .product-image img { padding: 10px; }
    .shop-products .product-info { padding: 12px; }
    .shop-products .product-category { font-size: .64rem; margin-bottom: 2px; }
    .shop-products .product-info h3 { font-size: .9rem; min-height: 2.5em; }
    .shop-products .product-meta { display: none; }
    .shop-products .product-price { margin-bottom: 10px; }
    .shop-products .product-actions .btn { font-size: .82rem; padding: 10px 6px; min-height: 42px; border-radius: 10px; gap: 6px; }

    .shop-products[data-view="list"] { grid-template-columns: minmax(0, 1fr); }
    .shop-products[data-view="list"] .product-image { width: 120px; min-height: 150px; }
    .shop-products[data-view="list"] .product-info { padding: 12px 14px; }
    .shop-products[data-view="list"] .product-info h3 { font-size: .95rem; }
    .shop-products[data-view="list"] .product-desc { display: none; }
    .shop-products[data-view="list"] .product-buy { flex-direction: column; align-items: flex-start; gap: 8px; }
    .shop-products[data-view="list"] .product-actions { width: 100%; }
    .shop-products[data-view="list"] .product-actions .btn { width: 100%; padding: 9px 14px; }

    .shop-products .product-wishlist {
        width: 34px;
        height: 34px;
        font-size: .9rem;
        top: 8px;
        right: 8px;
    }
    .shop-products .product-badge { top: 8px; left: 8px; padding: 3px 9px; font-size: .62rem; }

    .shop-pagination { gap: 6px; margin-top: 28px; }
    .shop-pagination a { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; }

    .shop-empty { padding: 40px 12px; }

    .cta-banner--shop .cta-banner-img { opacity: 0.2; }
}

/* ---------- Narrow phones (320–380px) ---------- */
@media (max-width: 380px) {
    .shop-products { gap: 10px; }
    .shop-products .product-info { padding: 10px; }
    .shop-products .product-info h3 { font-size: .85rem; }
    .shop-products .product-actions .btn { font-size: .78rem; padding: 9px 4px; }
    .shop-products .product-actions .btn i { display: none; }
    .shop-products[data-view="list"] .product-image { width: 104px; }
    .shop-toolbar .sort-form label { display: none; }
}

/* Multi-color filter */
.color-filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.color-filter-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text);
}
.color-filter-label input.color-filter-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.color-filter-label .color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
    flex-shrink: 0;
}
.color-filter-label .color-swatch.active,
.color-filter-label:hover .color-swatch {
    border-color: var(--primary);
}
.color-filter-name { font-size: 0.85rem; }

/* Wishlist page product grid */
#wishlistGrid.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 20px;
}
#wishlistGrid .product-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: box-shadow .2s, transform .2s;
}
#wishlistGrid .product-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    transform: translateY(-3px);
}
#wishlistGrid .product-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
#wishlistGrid .product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}
#wishlistGrid .product-info {
    padding: 14px 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#wishlistGrid .product-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

@media (max-width: 640px) {
    #wishlistGrid.products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    #wishlistGrid .product-info { padding: 10px 12px 14px; }
    #wishlistGrid .product-image img { padding: 8px; }
}

/* ========== SHOP: extracted from former inline styles ========== */
.price-apply-btn {
    margin-top: 12px;
}

.shop-empty {
    text-align: center;
    padding: 60px 20px;
}

.shop-empty-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.shop-empty-text {
    color: var(--text-light);
}

.shop-empty-btn {
    margin-top: 16px;
}

/* colour filter swatches (one class per colour name) */
.color-swatch--black { background: #1a1a1a; }
.color-filter-label .color-swatch--white { background: #ffffff; border-color: #CBD5E1; }
.color-swatch--brown { background: #8D6B4A; }
.color-swatch--beige { background: #D9C7A7; }
.color-swatch--blue  { background: #1976d2; }
.color-swatch--green { background: #2E7D32; }
.color-swatch--red   { background: #c62828; }
.color-swatch--grey  { background: #757575; }