﻿/* ==========================================================================
   category.css  -  category.aspx only
   Category banner, listing layout, filters (price/size/color sliders),
   toolbar, pagination, mobile filter drawer (moved from inline <style>)
   ========================================================================== */

/* ============ Category Banner ============ */
.category-banner {
    padding: 60px 0;
    background: linear-gradient(180deg, var(--red-soft) 0%, #ffffff 100%);
}

.category-banner-inner {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 60px;
    align-items: center;
}

.category-title {
    font-family: var(--serif);
    font-size: clamp(38px, 5vw, 60px);
    line-height: 1.05;
    margin: 0 0 20px;
    font-weight: 700;
}

.category-desc {
    font-size: 16px;
    color: var(--ink-3);
    max-width: 540px;
    margin: 0;
}

.category-banner-image {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

    .category-banner-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* ============ Listing Layout ============ */
.listing-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
}

.filters {
    position: sticky;
    top: 100px;
    align-self: start;
}

.filter-group {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

    .filter-group:last-child {
        border-bottom: none;
    }

    .filter-group h4 {
        font-size: 16px;
        margin: 0 0 12px;
        font-weight: 600;
        letter-spacing: 0.5px;
    }

    .filter-group h5 {
        font-size: 12px;
        margin: 0 0 12px;
        font-weight: 600;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: var(--ink);
    }

    .filter-group label {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 13px;
        color: var(--ink-2);
        padding: 6px 0;
        cursor: pointer;
        transition: color 0.15s ease;
    }

        .filter-group label:hover {
            color: var(--red-primary);
        }

    .filter-group input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--red-primary);
        cursor: pointer;
    }

/* Brand checkbox list: show ~5-6 items then scroll */
#brand-filter-list {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

    #brand-filter-list::-webkit-scrollbar {
        width: 6px;
    }

    #brand-filter-list::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    #brand-filter-list::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }

        #brand-filter-list::-webkit-scrollbar-thumb:hover {
            background: #999;
        }

/* Price / size range slider */
.price-slider {
    position: relative;
    height: 22px;
    margin: 20px 2px 8px;
}

.price-slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--line);
    transform: translateY(-50%);
    border-radius: 2px;
}

.price-slider-range {
    position: absolute;
    top: 50%;
    height: 3px;
    background: var(--red-primary);
    transform: translateY(-50%);
    border-radius: 2px;
}

.price-slider-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 22px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    pointer-events: none;
}

    .price-slider-input::-webkit-slider-thumb {
        -webkit-appearance: none;
        pointer-events: auto;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #fff;
        border: 2px solid var(--red-primary);
        cursor: pointer;
        box-shadow: var(--shadow-sm);
    }

    .price-slider-input::-moz-range-thumb {
        pointer-events: auto;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #fff;
        border: 2px solid var(--red-primary);
        cursor: pointer;
        box-shadow: var(--shadow-sm);
    }

    .price-slider-input::-webkit-slider-runnable-track,
    .price-slider-input::-moz-range-track {
        background: transparent;
    }

.price-slider-values {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--ink-3);
}

/* Size filter: ML / OZ toggle */
.size-unit-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.size-unit-btn {
    flex: 1;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
    color: var(--ink-2);
    transition: all 0.15s ease;
}

    .size-unit-btn.active {
        background: var(--red-primary);
        border-color: var(--red-primary);
        color: #fff;
    }

.color-swatch-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--line);
    flex: none;
}

/* ============ Toolbar / grid / pagination ============ */
.listing-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.result-count {
    font-size: 13px;
    color: var(--muted);
}

.sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .sort-wrap label {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: var(--muted);
    }

    .sort-wrap select {
        padding: 8px 12px;
        border: 1px solid var(--line);
        background: #fff;
        font-size: 13px;
        color: var(--ink);
        border-radius: var(--radius);
        outline: none;
        cursor: pointer;
    }

        .sort-wrap select:focus {
            border-color: var(--red-primary);
        }

/* Category page uses a 3-column grid */
#category-products.product-grid {
    grid-template-columns: repeat(3, 1fr);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

    .page-btn:hover {
        border-color: var(--red-primary);
        color: var(--red-primary);
    }

    .page-btn.active {
        background: var(--red-primary);
        color: #fff;
        border-color: var(--red-primary);
    }

/* ============ Mobile filter drawer (was inline <style> in category.aspx) ============ */
/* Hidden on desktop */
.filter-toggle-btn,
.filter-drawer-head,
.filter-drawer-foot,
.filter-overlay {
    display: none;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .category-banner-inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .listing-layout {
        grid-template-columns: 1fr;
    }

    .filters {
        position: static;
    }

    .filter-group label {
        display: inline-flex;
        margin-right: 10px;
    }

    #category-products.product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991px) {
    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 16px;
        border: 1px solid #ccc;
        border-radius: 4px;
        background: #fff;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }

    .listing-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Sidebar becomes a slide-in drawer */
    .filters {
        display: block !important;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85%;
        max-width: 340px;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 16px !important;
        background: #fff;
        overflow-y: auto;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform .3s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, .2);
    }

        .filters.open {
            transform: translateX(0);
        }

        .filters .listing-layout {
            display: block !important;
        }

    .filter-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        margin: 0 -16px 10px;
        padding: 14px 16px;
        background: #fff;
        border-bottom: 1px solid #eee;
        z-index: 2;
    }

        .filter-drawer-head h3 {
            margin: 0;
            font-size: 18px;
        }

    .filter-drawer-close {
        border: 0;
        background: none;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
    }

    .filter-drawer-foot {
        display: block;
        position: sticky;
        bottom: 0;
        margin: 16px -16px 0;
        padding: 12px 16px;
        background: #fff;
        border-top: 1px solid #eee;
    }

        .filter-drawer-foot button {
            width: 100%;
        }

    .filter-overlay {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(0, 0, 0, .5);
        opacity: 0;
        visibility: hidden;
        transition: opacity .3s ease;
        z-index: 9998;
    }

        .filter-overlay.open {
            opacity: 1;
            visibility: visible;
        }

    body.filters-open {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    #category-products.product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    #category-products.product-grid {
        grid-template-columns: 1fr;
    }
}
.listing-main {
    display: flex;
    flex-direction: column;
    min-height: 60vh; /* keeps it low on mobile too */
}

    .listing-main .pagination {
        margin-top: auto; /* pushes it to the bottom */
        padding-top: 48px;
    }

/* Ensure the grid items align uniformly */
#category-products.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch; /* Forces equal height columns */
}

/* Fix container size for all product cards */
#category-products .product-card,
.product-grid .hs-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Force equal image container dimensions */
#category-products .product-card-image,
.product-grid .hs-media {
    width: 100%;
    aspect-ratio: 1 / 1; /* Ensures perfect 1:1 square boxes for all images */
    overflow: hidden;
    background: var(--bg-3, #f5f5f5);
    border-radius: 6px;
}

    /* Force image to fit exact dimensions of container */
    #category-products .product-card-image img,
    .product-grid .hs-media img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* Fills container cleanly. Use 'contain' if you prefer no cropped edges */
        object-position: center;
    }