/* ======================================================
   ÁLVORA · FILTERS + TOOLBAR · BASELINE SYSTEM (FINAL)
====================================================== */

/* =========================
   STICKY CONTENEDOR · FULL WIDTH REAL
========================= */
.alv-filters-shell{
  position: sticky;
  top: 0;
  z-index: 80;

  width: 100vw;
  left: 50%;
  margin-left: -50vw;

  background: #fff;
  box-shadow: 0 6px 20px rgba(15,23,42,.08);
}

/* =========================
   FILA FILTROS · GRIS (FULL WIDTH)
========================= */
.alv-filters-row{
  width: 100%;
  background: #fafafa;
}

/* =========================
   GRID FILTROS (SIN CENTRADO)
========================= */
.alv-filters{
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  align-items: center;

  /* SOLO padding interno del diseño */
  padding: 10px 40px 20px 35px;
}

@media (max-width:1100px){
  .alv-filters{
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width:640px){
  .alv-filters{
    grid-template-columns: 1fr;
    padding: 10px 16px 20px 16px;
  }
}

/* =========================
   COLUMNA BASE
========================= */
.alv-filter-col{
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
}

.alv-filter-col::after{
  content:'';
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:1px;
  background:#1E293B;
  pointer-events:none;
}

/* =========================
   SELECTS
========================= */
.alv-filter-select{
  position: relative;
}

.alv-filter-select select{
  width: 100%;
  height: 44px;
  appearance: none;
  background: transparent;
  border: none;

  padding: 0 26px;
  text-align: center;
  text-align-last: center;
  -moz-text-align-last: center;

  line-height: 44px;
  cursor: pointer;
  display:block;
}

.alv-filter-select select:focus{
  outline: none;
}

.alv-filter-select:not(.alv-zonas-btn)::after{
  content:'';
  position:absolute;
  right:6px;
  top:50%;
  width:7px;
  height:7px;
  border-right:1.5px solid var(--alv-color-dark);
  border-bottom:1.5px solid var(--alv-color-dark);
  transform:translateY(-50%) rotate(45deg);
  pointer-events:none;
}

/* =========================
   ZONAS
========================= */
.alv-filter-col--zonas{
  position: relative;
}

.alv-zonas-btn{
  width: 100%;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: center;
  line-height: 44px;
  color: var(--alv-color-dark);
  font-weight: 400;
  position: relative;
}

.alv-filter-select.alv-custom-btn{
  text-align: center;
}


.alv-zonas-btn::after{
  content:'';
  position:absolute;
  right:6px;
  top:50%;
  width:7px;
  height:7px;
  border-right:1.5px solid var(--alv-color-dark);
  border-bottom:1.5px solid var(--alv-color-dark);
  transform:translateY(-50%) rotate(45deg);
}

.alv-zonas-popup{
  position:absolute;
  top:calc(100% + 10px);
  left:50%;
  transform:translateX(-50%);
  width: 480px;
  background:#fff;
  border-radius:16px;
  padding:18px;
  box-shadow:0 14px 32px rgba(0,0,0,.14);
  display:none;
  z-index:999;
}

.alv-filter-col--zonas.is-open .alv-zonas-popup{
  display:block;
}

.alv-zonas-popup label{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
  font-weight:400;
  color: var(--alv-color-dark);
  margin-bottom:10px;
  cursor:pointer;
}

.alv-zonas-popup input[type="checkbox"]{
  width:16px;
  height:16px;
}

.alv-zonas-footer{
  display:flex;
  justify-content:space-between;
  margin-top:16px;
}

.alv-zonas-footer button{
  border:none;
  background:#f2f2f2;
  padding:8px 16px;
  cursor:pointer;
}

.alv-zonas-footer button:last-child{
  background:#111;
  color:#fff;
}

.alv-filter-col--zonas label.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.alv-zonas-list label.is-disabled {
  opacity: .35;
  pointer-events: none;
}

/* ZONAS · filas con nombre + contador sin desbordar */
.alv-zonas-list label{
  display:grid;
  grid-template-columns: auto minmax(0,1fr) auto; /* CLAVE */
  align-items:center;
  gap:8px;
  min-width:0; /* CLAVE */
}

/* nombre: permite encoger */
.alv-zona-name{
  min-width:0;               /* CLAVE */
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* contador: nunca rompe línea y se alinea a la derecha */
.alv-zona-count{
  justify-self:end;
  white-space:nowrap;
  font-size:12px;
  color: var(--alv-color-grey);
}

.alv-zonas-list label.is-disabled{
  opacity: .35;
  pointer-events: none;
  filter: grayscale(1);
}

.alv-zonas-list{
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 16px;
}
@media (min-width: 768px){
  .alv-zonas-list{
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px){

  /* 3 columnas SOLO si hay 9 o más zonas */
  .alv-zonas-list:has(label:nth-child(9)){
    grid-template-columns: repeat(3, 1fr);
  }

  /* Si no llega a 9, se queda en 2 */

  /* Con 3 columnas cada nombre dispone de bastante menos ancho:
     ampliamos el popup para que "Salamanca Prime" / "Chamberí Prime"
     no se corten (con 2 columnas 480px iba sobrado, con 3 no). */
  .alv-zonas-popup:has(.alv-zonas-list label:nth-child(9)){
    width: 640px;
    max-width: calc(100vw - 40px);
  }
}

/* ZONAS · ocultar footer (Reiniciar / Hecho) */
.alv-zonas-footer{
  display:none !important;
}

/* Checkbox base */
.alv-zonas-popup input[type="checkbox"]{
  accent-color: var(--alv-color-dark);
}

/* Hover fila */
.alv-zonas-list label:not(.is-disabled):hover{
  background: transparent;
  border-radius: 8px;
}

/* Activo (checked) */
.alv-zonas-list input:checked + .alv-zona-name{
  font-weight: 500;
  color:var(--alv-color-dark);
}


/* =========================
   SLIDERS
========================= */
.alv-filter-col--slider{
  position: relative;
  min-height: 44px;
}

.alv-range-label{
  margin-bottom: -2px;
  font-size: 14px;
  font-weight:400;
  color: var(--alv-color-dark);
  text-align: center;
  pointer-events:none;
}

.alv-range-values,
.alv-range-values span{
  font-size:14px;
  font-weight:400;
  color: var(--alv-color-dark);
  text-align:center;
}

.alv-filter-col--slider .noUi-target{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:1px;
  background: transparent;
  border:none;
}

.alv-filter-col--slider .noUi-connect{
  background: var(--alv-color-dark);
}

.alv-filter-col--slider .noUi-handle{
  width:10px;
  height:10px;
  background: var(--alv-color-dark);
  border-radius:50%;
  border:none;
  top:-5px;
  right:-6px;
}

.alv-filter-col--slider .noUi-handle::before,
.alv-filter-col--slider .noUi-handle::after{
  display:none;
}

/* =========================
   TOOLBAR · BLANCO (FULL WIDTH)
========================= */
.alv-toolbar-row{
  width: 100%;
  background: #fff;
}

.alv-toolbar{
  display:flex;
  align-items:center;
  gap:24px;

  padding: 18px 36px 18px 34px;
}

/* columnas */
.alv-toolbar-left{
  flex:1;
  min-width:280px;
}

.alv-toolbar-right{
  display:flex;
  gap:12px;
  justify-content:flex-end;
  align-items:center;
}

.alv-toolbar button{
  background:none;
  border:none;
  font-size:14px;
  font-weight:500;
  color:#111;
  cursor:pointer;
  padding:0 0 0px 20px;
}

.alv-toolbar button:hover{
  font-weight:300
}

/* responsive */
@media (max-width:768px){
  .alv-toolbar{
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }

  /* Fila 1: buscador — misma altura que el toggle (48px) */
  .alv-toolbar-left{
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 0.5px solid #e8e4de;
    box-sizing: border-box;
  }

  .alv-toolbar-search {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* Input sin ancho fijo en móvil */
  .alv-toolbar-search input,
  .alv-toolbar-search input:focus {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Fila 2: contador centrado */
  .alv-toolbar-center{
    width: 100%;
    height: 40px;
    padding: 0 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 0.5px solid #e8e4de;
    box-sizing: border-box;
  }

  /* Fila 3: botones en una línea */
  .alv-toolbar-right{
    width: 100%;
    height: 44px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    box-sizing: border-box;
  }

  .alv-toolbar-right .alv-btn {
    flex: 1;
    text-align: center;
    padding-left: 0 !important;
  }

  /* Icono de sort, sort-recent y view centrado también en móvil */
  .alv-btn--sort::before,
  .alv-btn--sort-recent::before,
  .alv-btn--view::before {
    position: static;
    transform: none;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
  }
}

/* =========================
   TOOLBAR · SEARCH
========================= */
.alv-toolbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* Contenedor del input + badge + dropdown */
.alv-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alv-toolbar-search input {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--alv-color-dark);
  font-family: inherit;
  width: 200px;
  transition: width .2s ease;
}
.alv-toolbar-search input:focus {
  outline: none;
  width: 260px;
}

.alv-toolbar-search input::placeholder {
  color: #a0aec0;
}

/* Badge con número de resultados */
.alv-search-badge {
  display: none;
  background: #1E293B;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  line-height: 1.6;
  letter-spacing: .02em;
}

/* Dropdown de sugerencias */
.alv-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: -36px;
  width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  border: 1px solid #f1f5f9;
  list-style: none;
  padding: 6px 0;
  margin: 0;
  z-index: 200;
  overflow: hidden;
}

.alv-search-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .12s;
  gap: 12px;
}
.alv-search-suggestion:hover {
  background: #f8fafc;
}

.alv-sug-label {
  font-size: 13px;
  color: #1E293B;
  min-width: 0;
}
.alv-sug-label strong {
  font-weight: 700;
  color: #1E293B;
}
.alv-sug-tipo {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}

/* =========================
   TOOLBAR · CONTADOR CENTRAL
========================= */
.alv-toolbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.alv-total-count {
  white-space: nowrap;
  /* tamaño y color controlados por alvora-ui-core.css */
}

/* =========================
   TOOLBAR · SEPARACIÓN FAVORITOS
========================= */

/* El corazón se separa del resto */
.alv-toolbar-right{
  display:flex;
  align-items:center;
}

/* Favoritos = grupo independiente */
.alv-btn--favs{
  margin-right: 0px; /* separación visual clara */
}

/* Grupo de acciones */
.alv-toolbar-right .alv-btn:not(.alv-btn--favs){
  margin-left: 0;
}


/* =========================
   TIPOGRAFÍA CONSISTENTE
========================= */
.alv-zonas-btn,
.alv-zonas-popup label,
.alv-range-label,
.alv-range-values,
.alv-range-values span{
  letter-spacing: 0;
}

/* =========================
   PAGINACIÓN · SEPARACIÓN
========================= */
.alv-pagination {
  margin-top: 40px;
}

/* =========================
   FILTROS COLAPSABLES EN MÓVIL
========================= */
.alv-filters-toggle { display: none; }

@media (max-width: 768px) {

    /* Botón toggle */
    .alv-filters-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: 48px;
        padding: 0 16px;
        background: #fff;
        border: none;
        border-bottom: 0.5px solid #e8e4de;
        font-size: 11px;
        font-weight: 400;
        font-family: 'Jost', 'Inter', sans-serif;
        letter-spacing: .12em;
        text-transform: uppercase;
        color: #0e0e0e;
        cursor: pointer;
        line-height: 1;
        box-sizing: border-box;
    }
    .alv-filters-toggle__label {
        display: flex;
        align-items: center;
        line-height: 1;
        padding-top: 1px; /* compensación óptica uppercase */
    }
    /* Icono +/− dibujado con CSS — sin tipografía */
    .alv-filters-toggle__icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        position: relative;
        font-size: 0;
        color: transparent;
    }
    .alv-filters-toggle__icon::before,
    .alv-filters-toggle__icon::after {
        content: '';
        position: absolute;
        background: #0e0e0e;
        border-radius: 1px;
        transition: opacity .2s ease, transform .2s ease;
    }
    /* Línea horizontal */
    .alv-filters-toggle__icon::before {
        width: 10px; height: 1px;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%);
    }
    /* Línea vertical */
    .alv-filters-toggle__icon::after {
        width: 1px; height: 10px;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%);
    }
    /* Abierto: solo queda la horizontal = − */
    .alv-filters-toggle.is-open .alv-filters-toggle__icon::after {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(90deg);
    }

    /* Fila de filtros oculta por defecto en móvil */
    .alv-filters-row {
        max-height: 0;
        overflow: hidden;
        transition: max-height .35s ease;
    }
    .alv-filters-row.is-open {
        max-height: 1200px;
    }
}
