@import url("search_cars_filters.css");
@import url("search_cars_results_top.css");
@import url("search_cars_card.css");
@import url("search_cars_grid.css");
@import url("search_cars_pagination.css");

.search-cars-page {
    padding: 40px 0 72px;
    background: var(--color-bg-primary);
}

@media (min-width: 769px) {
    .search-cars-page .search-cars-shell {
        width: calc(100% - 192px);
        max-width: none;
        padding: 0;
    }
}

.search-cars-layout {
    width: 100%;
    display: grid;

    grid-template-columns: clamp(280px, 26vw, 340px) minmax(0, 1fr);
    gap: clamp(16px, 1.8vw, 24px);

    align-items: start;
}

/* ===== WRAPPER DEL FILTER ===== */
.filters-sidebar {
    position: sticky;
    top: 96px;

    align-self: start;
    min-width: 0;
}

.search-cars-content {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* OCULTO EN DESKTOP */
.filters-btn {
    display: none;
}

/* TABLET */
@media (max-width: 1100px) {
    .search-cars-layout {
        grid-template-columns: clamp(260px, 30vw, 300px) minmax(0, 1fr);
    }

    .filters-sidebar {
        top: 88px;
    }
}

/* MOBILE BASE */
@media (max-width: 900px) {
    .search-cars-layout {
        grid-template-columns: 1fr;
    }

    .filters-sidebar {
        position: static;
        top: auto;
    }
}

/* ===== MOBILE FILTER PANEL ===== */
@media (max-width: 768px) {

    .search-cars-layout {
        display: block; /* 🔥 FIX CLAVE */
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;

        width: 85%;
        height: 100%;

        background: #FFFFFF;
        z-index: 1001;

        padding: 20px;
        overflow-y: auto;

        transition: left 0.3s ease;
    }

    .filters-sidebar.active {
        left: 0;
    }

    .filters-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);

        opacity: 0;
        pointer-events: none;

        transition: opacity 0.3s ease;
        z-index: 1000;
    }

    .filters-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .filters-btn {
        display: block;
        width: 100%;
        margin-bottom: 16px;
    }

    /* 🔥 FIX FINAL */
    .filters-inner {
        width: 100%;
    }
}
