/**
 * CatalogBrowsing — filter sidebar + listing grid styles.
 *
 * Scoped under [data-catalog-listing] so it doesn't bleed into other
 * Protera surfaces. Companion to themes/Web/Protera/Resources/assets/
 * js/catalog-browsing.js.
 */

[data-catalog-listing] {
    margin-top: 1rem;
}

/* ---------- Filter sidebar ----------------------------------------------- */

.catalog-aside {
    padding-right: 0.5rem;
}

.filter-sidebar .filter-facet:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.filter-sidebar legend {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.filter-checkbox .form-check {
    margin-bottom: 0.25rem;
}

.filter-checkbox .form-check-label {
    font-size: 0.875rem;
    cursor: pointer;
}

/* ---------- Color swatches ----------------------------------------------- */

.filter-color-swatch-grid {
    --swatch-size: 32px;
}

.filter-color-swatch {
    width: var(--swatch-size);
    height: var(--swatch-size);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    transition: transform 120ms ease, box-shadow 120ms ease;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.filter-color-swatch:hover,
.filter-color-swatch:focus-visible {
    transform: scale(1.1);
    outline: none;
}

.filter-color-swatch.is-selected,
.filter-color-swatch-input:checked + .filter-color-swatch {
    box-shadow: 0 0 0 2px var(--brand, #e11d2a);
    transform: scale(1.05);
}

/* ---------- Range sliders ------------------------------------------------ */

.filter-range-slider,
.filter-price-slider {
    height: 8px;
    margin: 0.75rem 0.25rem 0;
}

/* noUiSlider stock styles are bundled by catalog-browsing.js (task-16d, was a
   jsdelivr <link>); the rules below are the theme overrides on top of them. */
.noUi-target {
    background: #e9ecef;
    border: none;
    box-shadow: none;
    border-radius: 4px;
    height: 6px;
}

.noUi-connect {
    background: var(--brand, #e11d2a);
}

.noUi-handle {
    background: var(--brand, #e11d2a);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 18px !important;
    height: 18px !important;
    right: -9px !important;
    top: -7px !important;
    cursor: grab;
}

.noUi-handle::before,
.noUi-handle::after {
    display: none;
}

/* ---------- Toolbar + chips --------------------------------------------- */

.catalog-toolbar {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.75rem;
}

.active-filters {
    padding: 0.5rem 0;
}

.catalog-chip {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 120ms ease;
}

.catalog-chip:hover {
    background-color: var(--brand-50, #ffe5e7) !important;
}

.catalog-chip i.bi-x-circle-fill {
    font-size: 0.85em;
    margin-left: 2px;
    opacity: 0.6;
}

.catalog-chip:hover i.bi-x-circle-fill {
    opacity: 1;
}

/* ---------- Product grid ------------------------------------------------- */

.product-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: box-shadow 150ms ease, transform 150ms ease;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.product-card-title a {
    color: var(--ink, #1a1a1a);
}

.product-card-price {
    color: var(--brand, #e11d2a);
    font-size: 1.05rem;
}

/* ---------- Pagination --------------------------------------------------- */

.catalog-pagination {
    padding: 1.5rem 0;
}

.btn-brand {
    background-color: var(--brand, #e11d2a);
    color: #fff;
    border: 1px solid var(--brand, #e11d2a);
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    transition: background 120ms ease;
}

.btn-brand:hover,
.btn-brand:focus {
    background-color: var(--brand-700, #b8121e);
    color: #fff;
    border-color: var(--brand-700, #b8121e);
}

/* ---------- Empty state -------------------------------------------------- */

[data-product-list-empty] {
    border: 1px dashed #dee2e6;
    border-radius: 8px;
}

/* ---------- Mobile responsiveness ---------------------------------------- */

@media (max-width: 991.98px) {
    .catalog-aside {
        display: none;
    }

    .catalog-toolbar {
        flex-direction: row;
        align-items: stretch;
    }

    /* Inside mobile modal: the price slider should breathe more */
    .modal-body .filter-price-slider,
    .modal-body .filter-range-slider {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    /* Two columns on the smallest viewports */
    .catalog-grid .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .product-card-title {
        font-size: 0.875rem;
    }

    .catalog-toolbar {
        gap: 0.5rem;
    }
}

/* ---------- Cloak Alpine until ready ------------------------------------- */

[x-cloak] {
    display: none !important;
}
