/* ===============================
   THP Search — estilos completos
   =============================== */

/* Variables de diseño */
.thp-search {
    --thp-radius: 9999px;
    --thp-pad: .65rem .9rem;
    --thp-gap: .5rem;
    --thp-gap-row: .6rem;
    --thp-bd: 1px solid #e2e8f0;      /* gris suave */
    --thp-bg: #fff;
    --thp-fg: #1f2937;                 /* slate-800 */
    --thp-fg-muted: #4b5563;           /* slate-600 */
    --thp-shadow: 0 1px 2px rgba(0,0,0,.05);
    --thp-focus: 0 0 0 3px rgba(59,130,246,.25);

    /* Layout */
    --thp-max: 980px;                  /* ancho común barra + filtros */
    --chip-h: 42px;                    /* alto de pastillas */

    color: var(--thp-fg);
}

/* ----- Layout contenedor del formulario ----- */
.thp-search .thp-search__form { margin: 0 auto; }

/* Barra y filtros centrados con el mismo ancho */
.thp-search .thp-search__bar,
.thp-search .thp-search__filters {
    max-width: var(--thp-max);
    margin-left: auto;
    margin-right: auto;
}

/* ===================
   Barra principal
   =================== */
.thp-search .thp-search__bar {
    display: flex;
    /*grid-template-columns: auto 1fr auto;*/
    align-items: center;
    gap: var(--thp-gap);
    background: var(--thp-bg);
    border: var(--thp-bd);
    box-shadow: var(--thp-shadow);
    border-radius: var(--thp-radius);
    padding: .25rem; /* borde interior para que el botón no “salte” */
    margin-bottom: 10px;
}

.thp-search .thp-search__icon {
    padding-left: .9rem;
    font-size: 1rem;
    opacity: .75;
}

.thp-search .thp-input {
    border: none !important;      /* ganamos a Astra */
    outline: none !important;
    background: transparent;
    font-size: clamp(.95rem, 2vw, 1rem);
    padding: var(--thp-pad);
    color: var(--thp-fg);
    box-shadow: none !important;
}
.thp-search .thp-input::placeholder { color: var(--thp-fg-muted); }

/* Botón */
.thp-search .thp-btn {
    border: var(--thp-bd);
    background: #d7ebff;
    color: #111827;
    border-radius: var(--thp-radius);
    padding: var(--thp-pad);
    font-weight: 400;
    transition: transform .05s ease, background .15s ease;
}
.thp-search .thp-btn:hover { background: #b1d8ff; }
.thp-search .thp-btn:active { transform: translateY(1px); }
.thp-search .thp-btn:focus-visible { outline: none; box-shadow: var(--thp-focus); }

/* ===================
   Filtros (chips)
   =================== */

/* En desktop: 1 sola fila */
.thp-search .thp-search__filters {
    display: flex;
    flex-wrap: nowrap;                 /* clave: 1 fila */
    gap: var(--thp-gap);
    justify-content: center;
    overflow: visible;
}

/* Pastilla base: select y combobox comparten look */
.thp-search .thp-select,
.thp-search .thp-combobox {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: var(--chip-h);
    flex: 0 0 auto;                    /* no crecer/encoger */
    border: var(--thp-bd);
    background: var(--thp-bg);
    border-radius: var(--thp-radius);
    box-shadow: var(--thp-shadow);
}

/* Anchos por chip para encajar en 1 fila */
.thp-search .thp-select--loc  { width: 280px; }  /* Ubicación */
.thp-search .thp-select--type { width: 120px; }
.thp-search .thp-select--op   { width: 180px; }
.thp-search .thp-select--min,
.thp-search .thp-select--max  { width: 140px; }

/* <select> internos */
.thp-search .thp-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: none !important;
    outline: none !important;
    width: 100%;
    height: 100%;
    padding: 0 2rem 0 1rem;            /* espacio para la flecha */
    font-size: .95rem;
    color: var(--thp-fg);
    cursor: pointer;
}

/* Flecha ▼ para todos los chips (selects y combobox) */
.thp-search .thp-select::after,
.thp-search .thp-combobox::after {
    content: "▼";
    position: absolute;
    right: .9rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .7rem;
    color: var(--thp-fg-muted);
    pointer-events: none;
}

/* Accesibilidad foco */
.thp-search :is(.thp-input, .thp-select select):focus-visible {
    outline: none;
    box-shadow: var(--thp-focus);
    border-radius: var(--thp-radius);
}

/* ===================
   Combobox (Ubicación)
   =================== */

.thp-search .thp-combobox input[type="text"] {
    border: none !important;
    outline: none !important;
    background: transparent;
    width: 100%;
    height: 100%;
    padding: 0 2rem 0 1rem;            /* igual que <select> */
    font-size: .95rem;
}

.thp-search .thp-combobox { position: relative; }
.thp-search .thp-combobox__clear {
    position: absolute;
    right: 2rem;                        /* deja sitio a la flecha */
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 1.1rem;
    line-height: 1;
    opacity: .5;
    cursor: pointer;
    display: none;
}
.thp-search .thp-combobox.has-value .thp-combobox__clear { display: block; }

.thp-search .thp-combobox__list {
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 4px);
    z-index: 9999;                      /* por encima del tema */
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    max-height: 280px;
    overflow: auto;
    padding: .25rem;
}
.thp-search .thp-combobox__list li {
    list-style: none;
    padding: .5rem .75rem;
    border-radius: 8px;
    cursor: pointer;
}
.thp-search .thp-combobox__list li:hover { background:#f3f4f6; }
.thp-search .thp-combobox__subtitle {
    display:block; font-size:.8rem; color:#6b7280; margin-top:2px;
}

/* ===================
   Responsive
   =================== */

/* Filtros: en ≤900px se apilan a 100% */
@media (max-width: 900px) {
    .thp-search .thp-search__filters { flex-wrap: wrap; }
    .thp-search .thp-select--loc,
    .thp-search .thp-select--type,
    .thp-search .thp-select--op,
    .thp-search .thp-select--min,
    .thp-search .thp-select--max { width: 60%; }
}
