/* =========================================
   STABLE GRID LAYOUT (Desktop Fix)
   ========================================= */

.collection-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 48px;
    align-items: start;
    position: relative;
    padding-bottom: 3rem;
}

/* Sidebar estable */
.collection-layout .filter-sidebar {
    position: sticky;
    top: 120px;
    align-self: start;
    z-index: 10;
    display: block;
    /* Ensure visible on desktop */
}

/* MUY IMPORTANTE: evita que el grid de productos se “rompa” */
.collection-layout .products-col {
    min-width: 0;
}

/* Grid de productos */
.collection-layout .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.mobile-filter-trigger {
    display: none;
    /* Hide on desktop */
}

/* =========================================
   MOBILE LAYOUT (1 Col + Offcanvas)
   ========================================= */

@media (max-width: 991.98px) {
    .collection-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .collection-layout .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 100%;
        max-width: 320px;
        background: #fff;
        z-index: 2000;
        padding: 20px;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .collection-layout .filter-sidebar.active {
        transform: translateX(0);
    }

    .mobile-filter-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        background: #1a1a1a;
        color: #fff;
        border: none;
        padding: 12px;
        font-size: 0.9rem;
        text-transform: uppercase;
        cursor: pointer;
        margin-bottom: 20px;
    }

    /* Overlay Backdrop */
    .filters-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1500;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .filters-overlay.active {
        display: block;
        opacity: 1;
    }
}


/* =========================================
   BOOTSTRAP UTILITIES SHIM (For filters.blade.php)
   ========================================= */
/* Display */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.w-100 {
    width: 100% !important;
}

/* Flex & Spacing */
.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.pt-2 {
    padding-top: 0.5rem !important;
}

.pb-3 {
    padding-bottom: 1rem !important;
}

.border-bottom {
    border-bottom: 1px solid #eee !important;
}

.fw-bold {
    font-weight: 700 !important;
}

/* Components */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-dark {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #1a1a1a;
}

.btn-outline-dark {
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
}

.input-group {
    display: flex;
    width: 100%;
}

.input-group-text {
    padding: 0.375rem 0.75rem;
    background: #eee;
    border: 1px solid #ddd;
}

/* Desktop: Sidebar + Grid */
@media (min-width: 992px) {
    .collection-layout {
        grid-template-columns: 280px 1fr;
        /* Fixed Sidebar width + Flexible Grid */
    }

    .filters-sidebar-container {
        display: block !important;
        /* Ensure visible on desktop */
        position: sticky;
        top: 100px;
        height: fit-content;
        z-index: 10;
        border-right: 1px solid var(--color-border);
        padding-right: 1.5rem;
    }

    .mobile-filter-trigger {
        display: none !important;
    }
}

/* Mobile: Drawer (Hidden by default) */
@media (max-width: 991px) {
    .filters-sidebar-container {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 100%;
        max-width: 320px;
        background: #fff;
        z-index: 2000;
        padding: 20px;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .filters-sidebar-container.active {
        transform: translateX(0);
    }

    /* Overlay Backdrop */
    .filters-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1500;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .filters-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Header inside Drawer */
    .filters-drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }
}

/* =========================================
   Filter Component Styling
   ========================================= */
.product-filters-component {
    font-size: 0.9rem;
}

.filter-group {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
}

.filter-group:last-child {
    border-bottom: none;
}

.group-details summary {
    list-style: none;
    /* Remove default triangle */
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 5px 0;
}

.group-details summary::-webkit-details-marker {
    display: none;
}

.icon-toggle {
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 300;
    transition: transform 0.2s;
}

.group-details[open] .icon-toggle {
    transform: rotate(45deg);
    /* "+" becomes "x" ish manually or just minus */
}

/* Custom Size Badges */
.size-option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 35px;
    border: 1px solid #ddd;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-size-input:checked+.size-option-label {
    background: #000;
    color: #fff;
    border-color: #000;
}

.size-option-label:hover {
    border-color: #999;
}

.btn-size-input {
    display: none;
    /* Hide actual radio */
}

/* Price Inputs */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.price-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    padding: 0 8px;
    flex: 1;
}

.price-symbol {
    color: #888;
    font-size: 0.8rem;
}

.price-field {
    border: none;
    width: 100%;
    padding: 8px 5px;
    font-size: 0.9rem;
    outline: none;
}

.btn-apply-price {
    background: #000;
    color: #fff;
    border: none;
    width: 100%;
    padding: 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    cursor: pointer;
}

/* Mobile Trigger Button */
.btn-mobile-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #1a1a1a;
    color: #fff;
    border: none;
    padding: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    cursor: pointer;
    margin-bottom: 20px;
}


/* =========================================
   BOOTSTRAP COMPATIBILITY UTILITIES (Custom)
   ========================================= */

/* Display & Responsive */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.w-100 {
    width: 100% !important;
}

@media (min-width: 992px) {
    .d-lg-none {
        display: none !important;
    }

    .d-lg-block {
        display: block !important;
    }

    .d-lg-flex {
        display: flex !important;
    }
}

@media (max-width: 991px) {
    .d-lg-none {
        display: block !important;
    }

    /* Visible on mobile */
    .d-lg-block {
        display: none !important;
    }

    /* Hidden on mobile */
}

/* Flex Utilities */
.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

/* Spacing */
.m-0 {
    margin: 0 !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.pb-3 {
    padding-bottom: 1rem !important;
}

.pt-1 {
    padding-top: 0.25rem !important;
}

.pt-2 {
    padding-top: 0.5rem !important;
}

.ps-0 {
    padding-left: 0 !important;
}

.ps-1 {
    padding-left: 0.25rem !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Borders */
.border-bottom {
    border-bottom: 1px solid #eee !important;
}

.border-end-0 {
    border-right: 0 !important;
}

.border-start-0 {
    border-left: 0 !important;
}

.border {
    border: 1px solid #ddd !important;
}

.rounded-0 {
    border-radius: 0 !important;
}

/* Text & Typos */
.fw-bold {
    font-weight: 700 !important;
}

.text-center {
    text-align: center !important;
}

.text-dark {
    color: #1a1a1a !important;
}

.text-muted {
    color: #888 !important;
}

.text-danger {
    color: #dc2626 !important;
}

.text-decoration-none {
    text-decoration: none !important;
}

.small {
    font-size: 0.875rem !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Components Mock */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-dark {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #1a1a1a;
}

.btn-outline-dark {
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
}

.btn-outline-secondary {
    border: 1px solid #ccc;
    background: transparent;
    color: #666;
}

.btn-check {
    display: none;
}

/* Hide radio/checkbox */

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.input-group-sm>.form-control,
.input-group-sm>.input-group-text {
    padding: 0.25rem 0.5rem;
    font-size: .875rem;
    border-radius: 0.2rem;
}

/* Offcanvas Safety */
.offcanvas {
    visibility: hidden;
    /* Hide by default if class exists */
}

.offcanvas.show {
    visibility: visible;
}

/* Fix for drawer header in our implementation */
.filters-drawer-header.d-lg-none {
    /* Ensure it behaves correctly based on generic media query above */
}