/* Base compartida para los catálogos públicos de espacios y proveedores. */
body.search-page.catalog-layout {
    background: #fbfbfd;
    color: #171329;
    font-family: "Questrial", Arial, sans-serif;
    letter-spacing: 0;
}

body.search-page.catalog-layout button,
body.search-page.catalog-layout input,
body.search-page.catalog-layout select {
    font-family: inherit;
}

body.search-page.catalog-layout .filters-bar {
    display: none;
}

body.search-page.catalog-layout .layout {
    display: block;
    width: min(100%, 1780px);
    max-width: none;
    margin: 0 auto;
    padding: 0 28px 64px;
}

body.search-page.catalog-layout .catalog-results {
    min-width: 0;
    padding: 20px 0 0;
}

body.search-page.catalog-layout .catalog-results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

body.search-page.catalog-layout .catalog-results-header h1 {
    margin: 0;
    color: var(--reu-ink, #171329);
    font-size: 1.65rem;
    font-weight: 900;
    line-height: 1.1;
}

body.search-page.catalog-layout .catalog-results-header p {
    margin: 7px 0 0;
    color: var(--reu-muted, #7b6d91);
    font-size: .96rem;
}

body.search-page.catalog-layout .catalog-results-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Mismo orden de controles en todas las ventanas. */
body.search-page.catalog-layout .catalog-results-count { order: 1; }
body.search-page.catalog-layout .catalog-sort-control { order: 2; }
body.search-page.catalog-layout .filters-toggle { order: 3; }

body.search-page.catalog-layout .quick-filter-chip,
body.search-page.catalog-layout .filters-toggle {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 22px;
    border: 1px solid #eee8f5;
    border-radius: 999px;
    background: #fff;
    color: var(--reu-purple, #5f35a3);
    font: inherit;
    font-size: .95rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(40, 19, 77, .08);
    cursor: pointer;
}

body.search-page.catalog-layout .catalog-sort-trigger {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 9px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
}

body.search-page.catalog-layout .catalog-sort-trigger .fa-chevron-down {
    font-size: .72rem;
    pointer-events: none;
    transition: transform .18s ease;
}

body.search-page.catalog-layout .catalog-sort-control {
    position: relative;
    min-height: 42px;
    padding: 0 14px;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
body.search-page.catalog-layout .catalog-sort-control:hover,
body.search-page.catalog-layout .catalog-sort-control:focus-within {
    border-color: #bda6df;
    background: #fbf8ff;
    box-shadow: 0 12px 26px rgba(71, 40, 117, .13);
    transform: translateY(-1px);
}
body.search-page.catalog-layout .catalog-sort-control.is-open .fa-chevron-down { transform: rotate(180deg); }
body.search-page.catalog-layout .catalog-sort-control.is-selected {
    border-color: #5f35a3;
    background: #f3edfb;
    box-shadow: inset 0 0 0 1px rgba(95, 53, 163, .08);
}
body.search-page.catalog-layout .catalog-sort-native {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

body.search-page.catalog-layout .catalog-sort-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 3000;
    display: grid;
    width: max-content;
    min-width: 210px;
    max-width: min(280px, calc(100vw - 32px));
    padding: 6px;
    border: 1px solid #ded3ee;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(40, 19, 77, .18);
}

body.search-page.catalog-layout .catalog-sort-menu[hidden] { display: none; }

body.search-page.catalog-layout .catalog-sort-menu button {
    display: flex;
    width: 100%;
    min-height: 36px;
    align-items: center;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #291747;
    font: inherit;
    font-size: .86rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

body.search-page.catalog-layout .catalog-sort-menu button:hover,
body.search-page.catalog-layout .catalog-sort-menu button:focus-visible,
body.search-page.catalog-layout .catalog-sort-menu button[aria-checked="true"] {
    outline: 0;
    background: #f2ecfb;
    color: #5f35a3;
}

body.search-page.catalog-layout .catalog-results-count {
    color: var(--reu-purple, #5f35a3);
    font-size: .9rem;
    font-weight: 900;
    white-space: nowrap;
}

/* En tablet el contador compite por espacio con las acciones. Se conserva una
   sola fila fija para ordenar y filtrar, igual en Espacios y Proveedores. */
body.search-page.catalog-tablet-layout .catalog-results-tools {
    width: max-content;
    min-width: max-content;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    margin-left: auto;
}

body.search-page.catalog-tablet-layout .catalog-results-count,
body.search-page.catalog-tablet-layout #catalogResultsCount,
body.search-page.catalog-tablet-layout #providersResultCount {
    display: none !important;
}

body.search-page.catalog-tablet-layout .catalog-sort-control,
body.search-page.catalog-tablet-layout .filters-toggle {
    flex: 0 0 auto;
    white-space: nowrap;
}

body.search-page.catalog-layout .catalog-category-pills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

body.search-page.catalog-layout .catalog-category-pill {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 16px;
    border: 1px solid #eee8f5;
    border-radius: 14px;
    background: #fff;
    color: var(--reu-purple, #5f35a3);
    font: inherit;
    font-size: .88rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(40, 19, 77, .04);
    cursor: pointer;
}

body.search-page.catalog-layout .catalog-category-pill.is-active {
    border-color: #cdb8e6;
    background: #f4eefb;
}

body.search-page.catalog-layout .catalog-category-pill i {
    font-size: 1.28rem;
}

body.search-page.catalog-layout .grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

body.search-page.catalog-layout .card {
    overflow: hidden;
    border: 1px solid #ece7f3;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(44, 27, 71, .07);
}

body.search-page.catalog-layout .card-img {
    position: relative;
    aspect-ratio: 1.68 / 1;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background: #e7e2ed;
}

body.search-page.catalog-layout .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.search-page.catalog-layout .card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 14px 16px 16px;
}

/* El listado de espacios usa un pin real, no el glifo cuadrado heredado. */
body.search-page.catalog-layout:not(.providers-list-page) .card-body .location {
    display: flex;
    align-items: center;
    gap: 6px;
}

body.search-page.catalog-layout:not(.providers-list-page) .card-body .location::before {
    content: "\f3c5";
    flex: 0 0 auto;
    color: var(--reu-purple, #5f35a3);
    font-family: "Font Awesome 6 Free";
    font-size: .8em;
    font-weight: 900;
}

body.search-page.catalog-layout .filters-modal {
    position: fixed;
    z-index: 3800;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(45, 23, 65, .36);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

body.search-page.catalog-layout .filters-modal.is-open {
    display: flex;
}

body.search-page.catalog-layout.filters-modal-open {
    overflow: hidden;
}

body.search-page.catalog-layout .filters-modal-dialog {
    display: flex;
    width: min(780px, 100%);
    max-height: min(82vh, 760px);
    flex-direction: column;
    border: 1px solid #eadff6;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 26px 80px rgba(74, 43, 105, .32);
    overflow: hidden;
}

body.search-page.catalog-layout .filters-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 26px;
    border-bottom: 1px solid #eee5f8;
}

body.search-page.catalog-layout .filters-title,
body.search-page.catalog-layout .filter-label {
    margin: 0;
    color: var(--reu-ink, #171329);
    font-weight: 900;
}

body.search-page.catalog-layout .filters-title { font-size: 1.1rem; }
body.search-page.catalog-layout .filter-label { font-size: .95rem; }

body.search-page.catalog-layout .filters-close {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #eadff6;
    border-radius: 50%;
    background: #fff;
    color: var(--reu-purple, #5f35a3);
    cursor: pointer;
}

body.search-page.catalog-layout .filters-modal-scroll {
    min-height: 0;
    overflow-y: auto;
}

body.search-page.catalog-layout .filter-section {
    margin: 0;
    padding: 24px 26px;
    border-bottom: 1px solid #eee5f8;
}

body.search-page.catalog-layout .field-hint {
    margin: 7px 0 0;
    color: var(--reu-muted, #7b6d91);
    font-size: .88rem;
}

body.search-page.catalog-layout .filters-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 26px;
    background: #fff;
}

body.search-page.catalog-layout .clear-btn,
body.search-page.catalog-layout .cancel-filters-btn {
    border: 0;
    background: transparent;
    color: var(--reu-purple, #5f35a3);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

body.search-page.catalog-layout .filters-actions-primary {
    display: flex;
    align-items: center;
    gap: 14px;
}

body.search-page.catalog-layout .apply-filters-btn {
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: var(--reu-purple, #5f35a3);
    color: #fff;
    font: inherit;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(95, 53, 163, .2);
    cursor: pointer;
}

/* Catálogos planos: sin las sombras ambientales del header, buscador y
   controles. Los bordes conservan la separación visual entre elementos. */
body.search-page.catalog-layout .reu-site-header {
    box-shadow: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.search-page.catalog-layout .reu-site-header .search-bar,
body.search-page.catalog-layout .reu-site-header .search-bar.expanded,
body.search-page.catalog-layout .reu-site-header .user-menu-btn,
body.search-page.catalog-layout .reu-site-header .user-menu-btn:hover,
body.search-page.catalog-layout .reu-site-header .user-menu-btn:focus,
body.search-page.catalog-layout .reu-site-header .user-menu-btn:active,
body.search-page.catalog-layout .quick-filter-chip,
body.search-page.catalog-layout .filters-toggle,
body.search-page.catalog-layout .catalog-category-pill,
body.search-page.catalog-layout .card {
    box-shadow: none !important;
}

body.search-page.catalog-layout .catalog-sort-control:hover,
body.search-page.catalog-layout .catalog-sort-control:focus-within {
    box-shadow: none;
    transform: none;
}

body.search-page.catalog-layout.providers-list-page .provider-card-link:hover .provider-card,
body.search-page.catalog-layout.providers-list-page .provider-card-link:focus-visible .provider-card,
body.search-page.catalog-layout.providers-list-page .provider-card-featured {
    box-shadow: none;
}

/* La selección de un campo de búsqueda siempre conserva una señal clara,
   sin recuperar sombras ambientales. */
body.search-page.catalog-layout .search-field:not(.divider).active {
    background: #f7f2fd !important;
    box-shadow: inset 0 -2px 0 #8b63c5, inset 0 0 0 1px rgba(95, 53, 163, .15) !important;
}

body.search-page.catalog-layout .search-field:not(.divider).is-activating {
    animation: reu-search-field-select 220ms ease-out;
}

body.search-page.catalog-layout .search-dropdown,
body.search-page.catalog-layout .calendar-day {
    user-select: none;
    -webkit-user-select: none;
}

@keyframes reu-search-field-select {
    0% { background: #fff; box-shadow: inset 0 0 0 0 rgba(95, 53, 163, 0); }
    65% { background: #f1e9fb; box-shadow: inset 0 -3px 0 #8b63c5, inset 0 0 0 1px rgba(95, 53, 163, .25); }
    100% { background: #f7f2fd; box-shadow: inset 0 -2px 0 #8b63c5, inset 0 0 0 1px rgba(95, 53, 163, .15); }
}

@media (min-width: 761px) and (max-width: 1320px) {
    body.search-page.catalog-layout .catalog-category-pills { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    body.search-page.catalog-layout .catalog-category-pill:nth-child(n + 5) { display: none; }
}

@media (min-width: 1321px) {
    body.search-page.catalog-layout .catalog-category-pills { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    /* El catálogo mantiene una única línea de accesos principales. */
    body.search-page.catalog-layout .catalog-category-pill:nth-child(n + 7) { display: none; }
}

@media (max-width: 1320px) {
    body.search-page.catalog-layout .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    body.search-page.catalog-layout .layout { padding: 0 14px 48px; }
    body.search-page.catalog-layout .catalog-results { padding-top: 18px; }
    body.search-page.catalog-layout .catalog-results-header { flex-direction: column; gap: 12px; }
    body.search-page.catalog-layout .catalog-results-header h1 { font-size: 1.35rem; }
    /* Una única fila: contador, orden y filtros, en ese orden visual. */
    body.search-page.catalog-layout .catalog-results-tools {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    body.search-page.catalog-layout .catalog-sort-control {
        order: 2;
        display: inline-flex !important;
        width: auto;
        min-width: max-content;
        justify-content: center;
    }
    body.search-page.catalog-layout .catalog-sort-control select { min-width: 0; flex: 0 1 auto; }
    body.search-page.catalog-layout .filters-toggle { order: 3; }
    body.search-page.catalog-layout .catalog-results-count {
        order: 1;
        font-size: .78rem;
    }
    body.search-page.catalog-layout .catalog-category-pills {
        display: flex;
        margin: 0 -14px 18px;
        padding: 0 14px 4px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    body.search-page.catalog-layout .catalog-category-pills::-webkit-scrollbar { display: none; }
    body.search-page.catalog-layout .catalog-category-pill { min-width: 150px; flex: 0 0 auto; }
    body.search-page.catalog-layout .grid { grid-template-columns: 1fr; gap: 16px; }
    body.search-page.catalog-layout .filters-modal { align-items: flex-end; padding: 0; }
    body.search-page.catalog-layout .filters-modal-dialog { width: 100%; max-height: min(88vh, 760px); border-radius: 24px 24px 0 0; }
    body.search-page.catalog-layout .filters-actions { align-items: stretch; flex-direction: column-reverse; }
    body.search-page.catalog-layout .filters-actions-primary { justify-content: space-between; }
}

/* Ajuste final del grupo de acciones en tablet angosta. Las reglas móviles
   heredadas daban al botón de filtros el ancho de toda la fila. */
body.search-page.catalog-tablet-layout .catalog-results-tools {
    width: max-content !important;
    min-width: max-content;
    justify-content: flex-start;
    gap: 10px;
}

body.search-page.catalog-tablet-layout .catalog-sort-control,
body.search-page.catalog-tablet-layout .catalog-results-tools .filters-toggle {
    width: auto !important;
    min-width: 0 !important;
    min-height: 42px;
    margin: 0 !important;
    padding: 0 14px !important;
}

/* Rango de precios: se conserva la distribución, con una lectura más limpia
   y sin la cuadrícula pesada ni elementos superpuestos. */
body.search-page.catalog-layout .price-range-section {
    background: transparent;
}

body.search-page.catalog-layout .price-range-heading {
    margin-bottom: 14px;
}

body.search-page.catalog-layout .price-range-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f4effa;
}

body.search-page.catalog-layout .price-histogram {
    height: 92px;
    align-items: end;
    justify-content: center;
    gap: clamp(4px, .65vw, 7px);
    padding: 13px 20px 14px;
    border: 1px solid #eee8f5;
    border-radius: 16px;
    background: #fbfaff;
    box-sizing: border-box;
}

body.search-page.catalog-layout .price-histogram span {
    width: clamp(4px, 1.15vw, 8px);
    min-height: 5px;
    border-radius: 999px 999px 2px 2px;
    background: #d8c8ed;
    opacity: .72;
}

body.search-page.catalog-layout .price-histogram span.is-active {
    background: #b57be8;
    opacity: 1;
}

body.search-page.catalog-layout .price-dual-range {
    height: 30px;
    margin: 8px 12px 18px;
}

body.search-page.catalog-layout .price-dual-range-track,
body.search-page.catalog-layout .price-dual-range-selected {
    top: 12px;
    height: 6px;
}

body.search-page.catalog-layout .price-dual-range-track {
    background: #e9e1f1;
}

body.search-page.catalog-layout .price-dual-range-selected {
    background: #5f35a3;
    box-shadow: none;
}

body.search-page.catalog-layout .price-range-input {
    height: 30px;
}

body.search-page.catalog-layout .price-range-input::-webkit-slider-runnable-track,
body.search-page.catalog-layout .price-range-input::-moz-range-track {
    height: 6px;
}

body.search-page.catalog-layout .price-range-input::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -7px;
    border: 3px solid #fff;
    background: #5f35a3;
    box-shadow: 0 0 0 1px #d7c8e8;
}

body.search-page.catalog-layout .price-range-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    background: #5f35a3;
    box-shadow: 0 0 0 1px #d7c8e8;
}

body.search-page.catalog-layout .price-range-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

body.search-page.catalog-layout .price-range-values > p {
    display: none;
}

body.search-page.catalog-layout .price-value-field {
    gap: 7px;
    color: #6f598b;
    font-size: .75rem;
}

body.search-page.catalog-layout .price-value-field strong {
    min-height: 44px;
    padding: 0 12px;
    border-color: #e2d7ee;
    border-radius: 11px;
    background: #fff;
    box-shadow: none;
    font-size: .92rem;
}

body.search-page.catalog-layout .price-value-field:focus-within strong {
    border-color: #9a75c9;
    box-shadow: 0 0 0 3px rgba(95, 53, 163, .08);
}

/* En tablet el catálogo se lee mejor en dos cards por fila. */
body.search-page.catalog-tablet-layout .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

/* Las cards a dos columnas tienen una presencia más cercana a la referencia:
   se conserva el ancho completo disponible, pero la foto gana altura. */
body.search-page.catalog-tablet-layout .card-img {
    aspect-ratio: 1.35 / 1;
}

body.search-page.catalog-tablet-layout .card-body {
    gap: 6px 14px;
    padding: 16px 18px 18px;
}

@media (max-width: 760px) {
    /* The tablet state can persist after the viewport becomes mobile. */
    body.search-page.catalog-tablet-layout .grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

/* En móvil el acceso a filtros se distingue del selector de orden sin ganar
   ancho de más ni desplazar el resto de la barra. */
@media (max-width: 760px) {
    body.search-page.catalog-layout .mobile-host-thumb {
        display: none !important;
    }

    body.search-page.catalog-layout .catalog-results-tools {
        gap: 6px;
        min-height: 44px;
        align-items: center;
        padding-top: 8px;
    }

    body.search-page.catalog-layout .catalog-results-count {
        display: none !important;
    }

    body.search-page.catalog-layout #catalogResultsCount,
    body.search-page.catalog-layout #providersResultCount {
        display: none !important;
    }

    body.search-page.catalog-layout .catalog-category-pills {
        display: none !important;
    }

    body.search-page.catalog-layout .catalog-sort-control {
        min-height: 44px;
        padding: 0 11px;
    }

    body.search-page.catalog-layout .catalog-results-tools .filters-toggle {
        width: auto !important;
        height: 42px !important;
        min-height: 42px;
        flex: 0 0 auto !important;
        align-self: center;
        gap: 8px;
        padding: 0 11px;
        border-color: #ded3ee;
        background: #fff;
        color: #5f35a3;
        font-size: .88rem;
        font-weight: 800;
        box-shadow: none !important;
    }

    body.search-page.catalog-layout .catalog-results-tools .filters-toggle > span {
        position: static !important;
        display: inline !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
        white-space: nowrap !important;
    }

    body.search-page.catalog-layout .catalog-results-tools .filters-toggle > i {
        display: inline-grid;
        width: 22px;
        height: 22px;
        place-items: center;
        border-radius: 7px;
        background: #f0e7fb;
        font-size: .82rem;
    }

    body.search-page.catalog-layout .catalog-results-tools .filters-toggle:hover,
    body.search-page.catalog-layout .catalog-results-tools .filters-toggle:focus-visible,
    body.search-page.catalog-layout .catalog-results-tools .filters-toggle[aria-expanded="true"] {
        border-color: #5f35a3;
        background: #f0e7fb;
        box-shadow: none;
        outline: 0;
    }
}
