:root {
    /* fallback header height; adjust if your header is taller */
    --site-header-height: 70px;
}

.search-container {
    position: relative;
    width: 300px;
}

#results {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.result-item {
    padding: 8px;
    cursor: pointer;
}

.result-item:hover,
.result-item.active {
    background-color: #f0f0f0;
}

#final-results {
    margin-top: 20px;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border: 1px solid #ddd;
    padding: 8px;
}

/* Layout container */
.search-layout {
    display: flex;
    gap: 30px;
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Left sidebar */
.filters-sidebar {
    flex: 0 0 280px;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(166, 140, 109, 0.45);
    height: fit-content;
    position: sticky;
    /* top: 100px; */
}

.filters-sidebar h3 {
    color: var(--dark-brown);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 25px;
    font-family: "Philosopher", serif;
}

/* Filter groups */
.filter-group {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--cream);
}

.filter-group h4 {
    color: var(--dark-brown);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 0 6px;
    font-family: "Philosopher", serif;
}

/* Filter options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Checkbox styles */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--muted-brown);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-checkbox:hover {
    color: var(--dark-brown);
}

.filter-checkbox input[type="checkbox"],
.filter-checkbox input[type="radio"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--muted-brown);
    border-radius: 4px;
    cursor: pointer;
}

/* Price range inputs */
.price-range {
    margin-top: 15px;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.price-inputs input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--muted-gray);
    border-radius: 8px;
    font-size: 14px;
    color: var(--dark-brown);
    background: var(--cream);
    width: 100px;
}

.price-inputs span {
    color: var(--muted-brown);
    font-weight: 500;
}

/* Color swatches */
.color-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 5px 0;
}

.color-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted-brown);
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--muted-gray);
    position: relative;
}

.color-checkbox input:checked+.color-swatch {
    border: 2px solid var(--gold);
}

.color-checkbox input:checked+.color-swatch::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* Active states */
.filter-checkbox input:checked+label {
    color: var(--dark-brown);
    font-weight: 500;
}

/* Product Card Styling */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 20px;
}

.product-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 450px;
    /* Fixed height for consistent cards */
    width: 95%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.card-media {
    height: 65%;
    /* Takes up 65% of card height */
    position: relative;
    overflow: hidden;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .card-media img {
    transform: scale(1.05);
}

.card-body {
    height: 35%;
    /* Takes up remaining 35% of card height */
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: white;
}

.card-rating {
    display: inline-flex;
    align-items: center;
    background: #f8f8f8;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.star {
    color: #ff9800;
    margin-right: 4px;
}

.brand-container {
    margin-bottom: 8px;
}

.card-brand {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 4px;
}

.card-title {
    font-size: 1em;
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /* -webkit-line-clamp: 2; */
    -webkit-box-orient: vertical;
}

.card-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 8px 0;
}

.card-price {
    font-size: 1.2em;
    font-weight: 600;
    color: #111;
}

.card-original {
    color: #999;
    text-decoration: line-through;
    font-size: 0.9em;
}

.add-btn {
    width: 100%;
    padding: 10px;
    border: none;
    background: #2874f0;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.add-btn:hover {
    background: #1c5cc7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-layout {
        flex-direction: column;
    }

    .filters-sidebar {
        position: relative;
        top: 0;
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 15px;
    }

    /* Keep desktop card styling */
    .product-card {
        height: 500px;
    }

    .card-media {
        height: 380px;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
    }

    .product-card {
        height: 450px;
        /* Slightly shorter but same proportions */
    }

    .card-media {
        height: 340px;
    }
}

@media (max-width: 480px) {
    .search-layout {
        padding: 15px;
    }

    .products-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
    }
}

/* Product card: classic vertical card */
.product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(61, 44, 25, 0.07);
    overflow: hidden;
    transition: box-shadow .18s, transform .18s;
    min-height: 390px;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    box-shadow: 0 12px 32px rgba(61, 44, 25, 0.13);
    transform: translateY(-4px);
}

/* Image container */
.card-media {
    position: relative;
    width: 100%;
    height: 280px;
    background: var(--cream);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    overflow: hidden;
    padding: 12px;
}

.card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 12px;
    transition: transform 0.3s ease;
    background: var(--cream);
    border-radius: 12px;
    /* add border radius to image */
}

/* Card body */
.card-body {
    padding: 16px 16px 12px 16px;
    display: flex;
    flex-direction: column;
    /* gap: 8px; */
    flex: 1 1 auto;
}


/* Brand name */
.card-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark-brown);
    margin-bottom: 2px;
    font-family: "Philosopher", serif;
    letter-spacing: 0.1px;
}

/* Product title */
.card-title {
    font-size: 14px;
    color: #a68c6d;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 1.3;
    font-family: "Open Sans", sans-serif;
    white-space: normal;
    overflow: visible;
}

/* Rating block */
.card-rating-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.card-rating {
    background: #e7e4df;
    color: #a68c6d;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-rating .star {
    color: #f5a623;
    font-size: 13px;
    margin-right: 2px;
}

.card-rating .count {
    color: #555;
    font-size: 12px;
    margin-left: 4px;
    font-weight: 600;
}

/* Price block */
.card-price-row {
    display: flex;

    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.card-price {
    color: var(--muted-brown);
    /* header/footer accent */
    font-size: 1.35rem;
    font-weight: 800;
    font-family: "Philosopher", serif;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #bfa16a 0%, #a68c6d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
}

.card-price .rs-symbol {
    font-size: 1.1rem;
    font-weight: 700;
    margin-right: 2px;
    color: var(--dark-brown);
    -webkit-text-fill-color: var(--dark-brown);
    background: none;
}

.card-original {
    color: #a8a08a;
    font-size: 1rem;
    text-decoration: line-through;
    font-weight: 500;
    margin-left: 4px;
}

/* Remove discount block */
.card-discount {
    display: none !important;
}

/* CTA button: use header/footer brown/gold gradient */
.add-btn {
    background: linear-gradient(90deg, #a68c6d 0%, #bfa16a 100%);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    margin-top: 10px;
    align-self: flex-start;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(191, 161, 106, 0.10);
}

.add-btn:hover {
    background: linear-gradient(90deg, #bfa16a 0%, #a68c6d 100%);
    opacity: 0.95;
}

/* Responsive */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .search-layout {
        gap: 20px;
    }

    .filters-sidebar {
        flex: 0 0 240px;
    }

    .products-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 768px) {
    .search-layout {
        flex-direction: column;
    }

    .filters-sidebar {
        position: relative;
        top: 0;
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 15px;
    }

    /* Keep desktop card styling */
    .product-card {
        height: 500px;
    }

    .card-media {
        height: 380px;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
    }

    .product-card {
        height: 450px;
        /* Slightly shorter but same proportions */
    }

    .card-media {
        height: 340px;
    }
}

@media (max-width: 480px) {
    .search-layout {
        padding: 15px;
    }

    .products-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
    }
}

/* Ensure mobile filter button stays in document flow and does not use fixed/sticky positioning */
.mobile-filter-bar {
    display: none;
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    z-index: auto;
    padding: 0;
    margin: 0;
}

/* Small screens: show the button in-flow and place it below the header so it won't overlap while scrolling */
@media (max-width: 765px) {
    .mobile-filter-bar {
        display: flex;
        position: relative;
        /* in-flow so it scrolls with page */
        margin-top: calc(var(--site-header-height) + 8px);
        /* sit just under header */
        left: auto;
        top: auto;
        transform: none;
        z-index: auto;
        /* do not force above header */
        padding: 0.25rem;
        gap: 0.5rem;
        align-items: center;
    }

    /* remove any remaining inline-style fixed overrides */
    .mobile-filter-bar[style] {
        position: relative !important;
    }

    /* Off-canvas sidebar and overlay logic remains unchanged */
    .filters-sidebar {
        position: fixed;
        top: var(--site-header-height);
        left: 0;
        width: 300px;
        height: calc(100% - var(--site-header-height));
        background: #fff;
        transform: translateX(-110%);
        z-index: 1400;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        overflow: auto;
        transition: transform .25s ease;
        border-radius: 8px;
        margin: 10px;
        margin-left: 10px;
    }

    .search-layout.filters-open .filters-sidebar {
        transform: translateX(0);
    }

    .filters-overlay {
        position: fixed;
        top: var(--site-header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.32);
        z-index: 1350;
        display: none;
    }

    .search-layout.filters-open .filters-overlay {
        display: block;
    }
}

.products-container {
    flex: 1;
    min-width: 0;
}

.mobile-filter-bar {
    display: none;
    position: fixed;
    /* Change from relative to fixed */
    left: 0;
    top: 12%;
    /* Position in middle of screen */
    transform: translateY(-50%);
    z-index: 1300;
    padding: 0;
    margin-left: 10px;
}

.filter-toggle {
    background: linear-gradient(90deg, #bfa16a 0%, #a68c6d 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
}

.filter-toggle:hover {
    background: linear-gradient(90deg, #a68c6d 0%, #bfa16a 100%);
}

.filters-overlay {
    display: none;
}

.no-scroll {
    overflow: hidden !important;
    /* Prevent layout shift when scrollbar disappears */
    padding-right: var(--scrollbar-width, 17px);
}

@media (max-width: 765px) {

    /* keep button visible on small screens but in-flow (not fixed) so it behaves like other pages */
    .mobile-filter-bar {
        display: flex;
        position: relative;
        /* no fixed positioning */
        left: auto;
        top: auto;
        transform: none;
        z-index: 1400;
        /* above sidebar when necessary but still in-flow */
        padding: 0;
        margin: 10px;
        /* keep a small gap from page content */
    }

    /* hide sidebar off-canvas by default on small screens */
    .filters-sidebar {
        position: fixed;
        top: var(--site-header-height);
        left: 0;
        width: 300px;
        height: calc(100% - var(--site-header-height));
        background: #fff;
        transform: translateX(-110%);
        z-index: 1400;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        overflow: auto;
        transition: transform .25s ease;
        border-radius: 8px;
        margin: 10px;
        margin-left: 10px;
    }

    /* bring sidebar in when open */
    .search-layout.filters-open .filters-sidebar {
        transform: translateX(0);
    }

    /* overlay covering the rest of the page */
    .filters-overlay {
        position: fixed;
        top: var(--site-header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.32);
        z-index: 1350;
        display: none;
    }

    /* show overlay when filters are open */
    .search-layout.filters-open .filters-overlay {
        display: block;
    }

    /* make main content full width under overlay */
    main.products-container {
        margin-left: 0;
    }
}

/* Ensure the mobile filter button transitions smoothly when it's relocated */
.mobile-filter-bar {
    transition: left 0.25s ease, transform 0.25s ease;
}

/* Final override: keep mobile filter button IN-FLOW and below the header so it never overlaps while scrolling.
       This explicitly cancels any earlier `position: fixed` rules that were accidentally re-added. */
.mobile-filter-bar {
    display: none;
    /* default hidden on large screens */
    position: relative !important;
    /* enforce in-flow positioning */
    left: auto !important;
    top: auto !important;
    transform: none !important;
    z-index: auto !important;
    /* do not force above the header */
    padding: 0 !important;
    margin: 0 !important;
}

/* On small screens show the button in-flow below the header (no sticking) */
@media (max-width: 765px) {
    .mobile-filter-bar {
        display: flex;
        position: relative !important;
        /* keep it in document flow */
        margin-top: calc(var(--site-header-height) + 8px);
        /* sit just under header */
        left: auto !important;
        top: auto !important;
        transform: none !important;
        z-index: auto !important;
        /* don't overlap header */
        padding: 0.25rem;
        gap: 0.5rem;
        align-items: center;
    }

    /* Ensure no inline style or other rule can force it to fixed */
    .mobile-filter-bar[style] {
        position: relative !important;
    }
}


.type-filter.active {
    font-weight: bold;
    color: #d9534f;
    /* red highlight or your theme color */
}

.type-filter:hover {
    color: #d9534f;
}



/* Title */
.filter-title {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #222;
}

/* Container */
.type-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Pills Style */
.type-pill {
    padding: 10px 14px;
    border-radius: 10px;
    background: #f4f4f4;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    display: block;
    transition: 0.25s ease;
    border: 1px solid #eee;
}

/* Hover Style */
.type-pill:hover {
    background: #ffeceb;
    border-color: #f7b7b2;
    transform: translateX(4px);
}

/* Active Selected Type */
.type-pill.active {
    background: #ffdedb;
    color: #b12b23;
    border-color: #ff9e97;
    font-weight: 600;
}