﻿/* =========================================================
   FILTERING.CSS — COMPLETE & SAFE
   ========================================================= */

:root {
    --tj-page-background: #FDFBF5;
    --filter-black: #211f1c;
    --filter-black-soft: #302b25;
    --filter-gold: #b89a65;
    --filter-gold-light: #d6bd8b;
    --filter-white: #ffffff;
    --filter-beige: #f3eee4;
    --filter-border: #e6ddce;
}

/* 1. FILTER BUTTON & DROPDOWN */
.luxury-filter-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    z-index: 3000;
}

.luxury-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 42px;
    padding: 0 16px;
    background: linear-gradient(135deg, #302b25, #211f1c);
    color: var(--filter-gold-light);
    border: 1px solid var(--filter-gold);
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    white-space: nowrap;
    cursor: pointer;
    transition: all .25s ease;
}

    .luxury-filter-button:hover {
        background: var(--filter-gold);
        color: var(--filter-black);
    }

.filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    max-height: min(75vh, 650px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 22px;
    background: linear-gradient(145deg, #29251f, #191816);
    color: #f5f0e7;
    border: 1px solid var(--filter-gold);
    border-radius: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,.32);
    box-sizing: border-box;
    z-index: 9999;
}

    .filter-dropdown.show {
        display: block !important;
    }

.filter-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 19px;
    border-bottom: 1px solid rgba(184,154,101,.35);
}

.filter-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--filter-gold-light);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

.filter-header h5 {
    margin: 0 0 6px;
    color: var(--filter-white);
    font-family: Georgia, serif;
    font-size: 19px;
    font-weight: 500;
}

.filter-header p {
    margin: 0;
    color: #c6bfb3;
    font-size: 11px;
    line-height: 1.6;
}

.close-filter-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--filter-gold-light);
    background: transparent;
    border: 1px solid rgba(184,154,101,.45);
    border-radius: 50%;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.filter-section {
    margin-bottom: 20px;
    padding-bottom: 17px;
    border-bottom: 1px solid rgba(184,154,101,.18);
}

    .filter-section:last-of-type {
        border-bottom: none;
    }

.filter-label {
    display: block;
    margin-bottom: 10px;
    color: var(--filter-gold-light);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.filter-dropdown input[type="range"] {
    width: 100%;
    margin: 7px 0;
    accent-color: var(--filter-gold);
}

.price-range-text {
    margin-top: 9px;
    color: var(--filter-gold-light);
    font-size: 12px;
    font-weight: 700;
}

.filter-dropdown .form-select,
.filter-dropdown select {
    width: 100%;
    min-height: 41px;
    padding: 9px 35px 9px 11px;
    color: var(--filter-white);
    background-color: #302b25;
    border: 1px solid rgba(184,154,101,.55);
    border-radius: 6px;
    font-size: 12px;
}

    .filter-dropdown select option {
        color: var(--filter-black);
        background: #ffffff;
    }

.filter-dropdown .form-check {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 27px;
    margin: 8px 0;
    padding-left: 0;
}

.filter-dropdown .form-check-input {
    width: 16px;
    height: 16px;
    margin: 0;
    background-color: #302b25;
    border: 1px solid var(--filter-gold);
}

    .filter-dropdown .form-check-input:checked {
        background-color: var(--filter-gold);
        border-color: var(--filter-gold);
    }

.filter-dropdown .form-check-label {
    color: #f5f0e7;
    font-size: 12px;
}

.luxury-apply-filter {
    position: sticky;
    bottom: -1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 47px;
    margin-top: 17px;
    padding: 12px 15px;
    background: var(--filter-gold);
    color: var(--filter-black);
    border: 1px solid var(--filter-gold-light);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    cursor: pointer;
    z-index: 5;
}

/* 2. FILTER RESULTS MODAL */
#filteredProductsModal {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    padding: 25px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: rgba(20,18,16,.78) !important;
    z-index: 11000 !important;
    box-sizing: border-box !important;
}

    #filteredProductsModal.show {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #filteredProductsModal .modal-dialog,
    .modal-dialog:has(.filtered-products-grid) {
        flex: 0 1 820px !important;
        width: 820px !important;
        max-width: calc(100vw - 40px) !important;
        margin: auto !important;
    }

    #filteredProductsModal .modal-content,
    .modal-content:has(.filtered-products-grid) {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 820px !important;
        max-height: 88vh !important;
        padding: 0 !important;
        background: #ffffff !important;
        border: 1px solid var(--filter-gold) !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        text-align: left !important;
        box-shadow: 0 15px 45px rgba(0,0,0,.35) !important;
    }

/* 3. DARK LUXURY HEADER */
html body #filteredProductsModal .filter-modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
    gap: 15px !important;
    width: 100% !important;
    padding: 20px 24px !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #302b25, #211f1c) !important;
    border-bottom: 2px solid #b89a65 !important;
    box-sizing: border-box !important;
}

html body #filteredProductsModal .filter-modal-eyebrow {
    display: block !important;
    margin-bottom: 6px !important;
    color: #d6bd8b !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    letter-spacing: 2.5px !important;
    text-transform: uppercase !important;
}

html body #filteredProductsModal .filter-modal-header h2,
html body #filteredProductsModal .modal-content h2 {
    margin: 0 0 5px !important;
    color: #ffffff !important;
    font-family: Georgia, serif !important;
    font-size: 21px !important;
    font-weight: 500 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
}

html body #filteredProductsModal .filter-results-count {
    display: block !important;
    color: #d6bd8b !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
}

        /* 4. PRODUCT GRID & CARDS */
        #filteredProductsContainer,
        .modal-content:has(.filtered-products-grid) .modal-body {
            padding: 20px !important;
            overflow-y: auto !important;
            background: #ffffff !important;
        }

.filtered-products-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

    .filtered-products-grid > .filtered-product-column {
        display: flex !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

.filtered-product-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 430px !important;
    min-height: 430px !important;
    padding: 10px !important;
    background: #ffffff !important;
    border: 1px solid var(--filter-border) !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    overflow: hidden !important;
    transition: all .3s ease !important;
}

    .filtered-product-card:hover {
        border-color: var(--filter-gold) !important;
        box-shadow: 0 8px 22px rgba(0,0,0,.10) !important;
        transform: translateY(-4px) !important;
    }

    .filtered-product-card > a:first-child {
        display: block !important;
        width: 100% !important;
        height: 205px !important;
        background: var(--filter-beige) !important;
        border-radius: 6px !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
    }

    .filtered-product-card .card-img-top {
        display: block !important;
        width: 100% !important;
        height: 205px !important;
        padding: 8px !important;
        object-fit: contain !important;
        background: var(--filter-beige) !important;
        border: none !important;
        transition: transform .4s ease !important;
    }

    .filtered-product-card:hover .card-img-top {
        transform: scale(1.05) !important;
    }

    .filtered-product-card .card-body {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        flex: 1 !important;
        width: 100% !important;
        padding: 10px 2px 0 !important;
    }

    .filtered-product-card .card-title {
        margin: 0 0 4px !important;
        color: var(--filter-black) !important;
        font-family: Georgia, serif !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 1.35 !important;
    }

    .filtered-product-card .card-text {
        margin: 0 0 6px !important;
        color: #888888 !important;
        font-size: 10px !important;
        letter-spacing: 1px !important;
        text-transform: uppercase !important;
    }


/* =========================================================
   OVERRIDE CUSTOM .modal-content & HEADER FOR FILTER POPUP
   ========================================================= */

/* 1. Widen outer white card from 600px to 820px & remove 20px white border */
div:has(> .modal-content .filtered-products-grid) .modal-content,
.modal-content:has(.filtered-products-grid) {
    width: 92% !important;
    max-width: 820px !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: 1px solid #b89a65 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    text-align: left !important;
    box-shadow: 0 15px 45px rgba(0,0,0,.35) !important;
}

    /* 2. Style ANY top header div inside the filter modal to match search.css */
    .modal-content:has(.filtered-products-grid) > div:first-child,
    .modal-content:has(.filtered-products-grid) .modal-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 20px 24px !important;
        margin: 0 !important;
        background: linear-gradient(135deg, #302b25, #211f1c) !important;
        border-bottom: 2px solid #b89a65 !important;
        box-sizing: border-box !important;
    }

        /* 3. Style the header title text (whether h3, h4, h5, or span) */
        .modal-content:has(.filtered-products-grid) > div:first-child h3,
        .modal-content:has(.filtered-products-grid) > div:first-child h4,
        .modal-content:has(.filtered-products-grid) > div:first-child h5,
        .modal-content:has(.filtered-products-grid) .modal-header h5,
        .modal-content:has(.filtered-products-grid) .modal-title {
            margin: 0 !important;
            color: #ffffff !important;
            font-family: Georgia, serif !important;
            font-size: 20px !important;
            font-weight: 500 !important;
            letter-spacing: 1.5px !important;
            text-transform: uppercase !important;
        }

        /* 4. Style the close (X) button in the header to match .search-close-btn */
        .modal-content:has(.filtered-products-grid) > div:first-child button,
        .modal-content:has(.filtered-products-grid) .modal-header button {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            width: 36px !important;
            height: 36px !important;
            padding: 0 !important;
            margin: 0 !important;
            background: transparent !important;
            color: #d6bd8b !important;
            border: 1px solid #b89a65 !important;
            border-radius: 50% !important;
            font-size: 18px !important;
            line-height: 1 !important;
            cursor: pointer !important;
            transition: all .25s ease !important;
        }

            .modal-content:has(.filtered-products-grid) > div:first-child button:hover,
            .modal-content:has(.filtered-products-grid) .modal-header button:hover {
                background: #b89a65 !important;
                color: #211f1c !important;
                transform: rotate(90deg) !important;
            }

    /* 5. Add clean padding around the product cards container */
    #filteredProductsContainer,
    .modal-content:has(.filtered-products-grid) > div:nth-child(2) {
        padding: 20px !important;
        max-height: 75vh !important;
        overflow-y: auto !important;
    }
