/* ============================================================
   BUSCADORDECOCHES.NET — CSS PÁGINA DE RESULTADOS
   Archivo: /css/results.css
   Complementa style.css (no lo reemplaza)
============================================================ */


/* ── BUSCADOR EN LA NAV (solo en página de resultados) ── */

.nav__search-form {
  display: flex;
  flex: 1;
  max-width: 540px;
  gap: 6px;
  margin: 0 12px;
}

.nav__search-select {
  height: 34px;
  border: 1.5px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 0.8rem;
  color: var(--black);
  background: var(--g50);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  min-width: 110px;
  cursor: pointer;
}

.nav__search-select:focus {
  border-color: var(--red);
}

.nav__search-input {
  flex: 1;
  height: 34px;
  border: 1.5px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 0.8rem;
  color: var(--black);
  background: var(--g50);
  outline: none;
}

.nav__search-input:focus {
  border-color: var(--red);
  background: var(--white);
}

.nav__search-btn {
  width: 34px;
  height: 34px;
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--white);
  transition: background 0.15s;
  flex-shrink: 0;
}

.nav__search-btn:hover {
  background: var(--red-dark);
}


/* ── BREADCRUMB ── */

.breadcrumb-bar {
  background: var(--white);
  border-bottom: 1px solid var(--g200);
  padding: 8px 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--g400);
  list-style: none;
  flex: 1;
}

.breadcrumb a {
  color: var(--g500);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--red);
}

.breadcrumb-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.breadcrumb__count {
  font-size: 0.75rem;
  color: var(--g400);
  white-space: nowrap;
  flex-shrink: 0;
}


/* ── LAYOUT PRINCIPAL DE RESULTADOS ── */

.results-page {
  padding: 20px 0 48px;
  background: var(--g50);
}

.results-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}


/* ══════════════════════════════════════════
   SIDEBAR DE FILTROS
══════════════════════════════════════════ */

.filters-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 70px;  /* debajo del header */
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--g200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* scrollbar del sidebar */
.filters-sidebar::-webkit-scrollbar {
  width: 4px;
}
.filters-sidebar::-webkit-scrollbar-thumb {
  background: var(--g200);
  border-radius: 2px;
}

/* Cabecera de filtros */
.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--g100);
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.filters-title {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--black);
}

.filters-reset {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
}

.filters-reset:hover {
  text-decoration: underline;
}

/* Grupos de filtros */
.filter-group {
  border-bottom: 1px solid var(--g100);
}

.filter-group:last-of-type {
  border-bottom: none;
}

.filter-group__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: none;
  border: none;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--black);
  cursor: pointer;
  text-align: left;
}

.filter-group__toggle:hover {
  background: var(--g50);
}

.filter-group__toggle svg {
  flex-shrink: 0;
  transition: transform 0.2s;
  color: var(--g400);
}

.filter-group__toggle[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.filter-group__body {
  padding: 0 14px 12px;
}

.filter-group__body--closed {
  display: none;
}

.filter-group__toggle[aria-expanded="false"] + .filter-group__body:not(.filter-group__body--closed) {
  display: none;
}

/* Select de filtro */
.filter-select {
  width: 100%;
  height: 36px;
  border: 1.5px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 0 28px 0 10px;
  font-size: 0.8rem;
  color: var(--black);
  background: var(--g50);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%239499aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 10px) center;
  background-size: 12px;
}

.filter-select:focus {
  border-color: var(--red);
  background-color: var(--white);
}

.filter-select--sm {
  width: calc(50% - 8px);
}

/* Rango de precio */
.filter-range__inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.filter-range__input {
  flex: 1;
  height: 34px;
  border: 1.5px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 0.8rem;
  color: var(--black);
  background: var(--g50);
  outline: none;
  min-width: 0;
}

.filter-range__input:focus {
  border-color: var(--red);
  background: var(--white);
}

.filter-range__sep {
  font-size: 0.75rem;
  color: var(--g400);
  flex-shrink: 0;
}

/* Presets rápidos */
.filter-range__presets {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.filter-preset {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--g200);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--g600);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.filter-preset:hover,
.filter-preset.active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* Checkboxes / radios */
.filter-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 0;
}

.filter-check input[type="radio"],
.filter-check input[type="checkbox"] {
  display: none;
}

.filter-check__box {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--g300);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--white);
  transition: background 0.15s, border-color 0.15s;
}

.filter-check input:checked + .filter-check__box {
  background: var(--red);
  border-color: var(--red);
}

.filter-check input:checked + .filter-check__box::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--white);
}

.filter-check__label {
  font-size: 0.8rem;
  color: var(--g600);
}

.filter-check:hover .filter-check__label {
  color: var(--black);
}

.filter-check input:checked ~ .filter-check__label {
  color: var(--black);
  font-weight: 600;
}

.filter-clear-one {
  font-size: 0.7rem;
  color: var(--red);
  text-decoration: none;
  margin-top: 4px;
  display: inline-block;
}

.filter-clear-one:hover {
  text-decoration: underline;
}

/* Botón de aplicar */
.filters-apply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 12px 14px;
  height: 38px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.filters-apply-btn:hover {
  background: var(--red-dark);
}

.filters-apply-count {
  background: rgba(255,255,255,0.25);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Ad MPU dentro del sidebar */
.ad-slot--mpu {
  margin: 10px 14px 14px;
  min-height: 160px;
  border-radius: var(--radius-md);
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  text-align: center;
}


/* ══════════════════════════════════════════
   TOPBAR DE RESULTADOS
══════════════════════════════════════════ */

.results-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--g200);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.results-topbar__left {
  flex: 1;
}

.results-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.results-count {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--black);
}

.results-count strong {
  color: var(--red);
  font-size: 1rem;
}

.results-count__context {
  font-weight: 400;
  color: var(--g500);
  margin-left: 3px;
}

.results-sort {
  font-size: 0.75rem;
  color: var(--g500);
  white-space: nowrap;
}

.results-sort__select {
  height: 30px;
  border: 1px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 0.75rem;
  color: var(--black);
  background: var(--g50);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  min-width: 160px;
}

.results-sort__select:focus {
  border-color: var(--red);
}

/* Botones de vista */
.results-view-toggle {
  display: flex;
  gap: 3px;
}

.view-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--g200);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--white);
  color: var(--g400);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.view-btn:hover,
.view-btn--active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}


/* ── FILTROS ACTIVOS ── */

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.active-filters__label {
  font-size: 0.75rem;
  color: var(--g500);
  font-weight: 600;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--red-light);
  border: 1px solid rgba(245, 130, 31, 0.2);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  transition: background 0.15s;
}

.active-filter-tag:hover {
  background: rgba(245, 130, 31, 0.12);
}

.active-filters__clear {
  font-size: 0.75rem;
  color: var(--g400);
  text-decoration: none;
  margin-left: 4px;
}

.active-filters__clear:hover {
  color: var(--red);
}


/* ══════════════════════════════════════════
   GRID DE RESULTADOS (tarjetas horizontales)
══════════════════════════════════════════ */

.car-results-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* TARJETA DE RESULTADO */
.car-result {
  background: var(--white);
  border: 1px solid var(--g200);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 220px 1fr auto;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.15s, border-color 0.18s;
}

.car-result:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--g300);
}

/* Variante: anuncio premium */
.car-result--premium {
  border: 2px solid #f5a500;
  background: #fffef8;
}

.car-result--premium:hover {
  border-color: #f5a500;
}

/* Variante: anuncio destacado */
.car-result--destacado {
  border-left: 3px solid var(--red);
}

.car-result__link {
  display: contents;
  text-decoration: none;
  color: inherit;
}

/* Thumbnail */
.car-result__thumb {
  position: relative;
  overflow: hidden;
  background: var(--g100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.car-result__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.car-result:hover .car-result__thumb img {
  transform: scale(1.04);
}

.car-result__no-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--g100), var(--g200));
  min-height: 140px;
}

/* Badges */
.car-result__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.car-result__badge--premium  { background: #f5a500; color: var(--white); }
.car-result__badge--destacado { background: var(--red); color: var(--white); }
.car-result__badge--km0       { background: var(--black); color: var(--white); top: 8px; left: auto; right: 8px; }

/* Foto count */
.car-result__photo-count {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  color: var(--white);
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

/* Favorito */
.car-result__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--g200);
  display: grid;
  place-items: center;
  color: var(--g400);
  transition: border-color 0.15s, color 0.15s;
  backdrop-filter: blur(4px);
}

.car-result__fav:hover,
.car-result__fav.is-saved {
  border-color: var(--red);
  color: var(--red);
}

.car-result__fav.is-saved svg {
  fill: var(--red);
}

/* Cuerpo de la tarjeta */
.car-result__body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.car-result__make {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.car-result__model {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-result__version {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--g500);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Specs */
.car-result__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 4px 0;
}

.car-result__specs li {
  font-size: 0.75rem;
  color: var(--g500);
  padding-right: 7px;
  margin-right: 7px;
  border-right: 1px solid var(--g200);
}

.car-result__specs li:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

/* Extras / garantías */
.car-result__extras {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 3px 0;
}

.extra-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--g200);
  background: var(--g50);
  color: var(--g600);
}

.extra-tag--green {
  background: rgba(10,124,62,0.06);
  border-color: rgba(10,124,62,0.2);
  color: var(--green);
}

.extra-tag--blue {
  background: rgba(17,85,204,0.06);
  border-color: rgba(17,85,204,0.2);
  color: var(--blue);
}

/* Dealer */
.car-result__dealer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--g100);
}

.dealer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g300);
  flex-shrink: 0;
}

.dealer-dot--active {
  background: var(--green);
}

.car-result__dealer-name {
  font-size: 0.75rem;
  color: var(--g500);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-result__location {
  font-size: 0.7rem;
  color: var(--g400);
  white-space: nowrap;
}

/* Panel de precio */
.car-result__price-panel {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 150px;
  border-left: 1px solid var(--g100);
  flex-shrink: 0;
}

.car-result__old-price {
  font-size: 0.75rem;
  color: var(--g400);
  text-decoration: line-through;
  text-align: right;
  min-height: 18px;
}

.car-result__price {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--black);
  text-align: right;
  line-height: 1.1;
}

.car-result__price-note {
  font-size: 0.65rem;
  color: var(--g400);
  text-align: right;
  margin-top: 1px;
}

.car-result__fin {
  background: rgba(17,85,204,0.06);
  border: 1px solid rgba(17,85,204,0.15);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  text-align: right;
  margin-top: 4px;
}

.car-result__fin-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
}

.car-result__cta {
  width: 100%;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-top: 8px;
}


/* ── SLOT IN-FEED ── */

.ad-slot--infeed {
  border: 1.5px dashed var(--ad-bd, #f0c040);
  background: var(--ad-bg, #fffbe6);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ad-slot--infeed .ad-slot__label {
  position: static;
  background: #f5a500;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.ad-slot--infeed .ad-slot__placeholder {
  flex: 1;
}

.ad-infeed-mock {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ad-infeed-icon {
  font-size: 1.5rem;
  opacity: 0.5;
}

.ad-infeed-mock div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ad-infeed-mock strong {
  font-size: 0.8rem;
  font-weight: 800;
  color: #b87800;
}

.ad-infeed-mock span {
  font-size: 0.7rem;
  color: #b87800;
  opacity: 0.7;
}


/* ── ESTADO VACÍO ── */

.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--g200);
}

.results-empty__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.results-empty__title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--black);
  margin-bottom: 8px;
}

.results-empty__desc {
  font-size: 0.875rem;
  color: var(--g500);
  margin-bottom: 24px;
  max-width: 380px;
}

.results-empty__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}


/* ── PAGINACIÓN ── */

.pagination {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pagination__list {
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--g200);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--g600);
  text-decoration: none;
  background: var(--white);
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}

.pagination__btn:hover {
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-1px);
}

.pagination__btn--active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
  pointer-events: none;
}

.pagination__btn--arrow {
  font-size: 1.1rem;
  color: var(--g400);
}

.pagination__dots {
  font-size: 0.875rem;
  color: var(--g300);
  padding: 0 4px;
}

.pagination__info {
  font-size: 0.75rem;
  color: var(--g400);
  text-align: center;
}


/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {

  .results-layout {
    grid-template-columns: 1fr;
  }

  .filters-sidebar {
    position: static;
    max-height: none;
    display: none; /* En móvil se muestra con un botón de toggle */
  }

  .filters-sidebar.is-open {
    display: flex;
  }

  .nav__search-form {
    max-width: 340px;
    margin: 0 6px;
  }

  .car-result {
    grid-template-columns: 180px 1fr;
  }

  .car-result__price-panel {
    display: none; /* En tablet, el precio va dentro del body */
  }
}

/* Móvil */
@media (max-width: 640px) {

  .nav__search-form {
    display: none; /* Se oculta, el buscador está en la homepage */
  }

  .car-result {
    grid-template-columns: 1fr;
  }

  .car-result__thumb {
    height: 180px;
  }

  .results-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .results-topbar__right {
    width: 100%;
    justify-content: flex-end;
  }

  .pagination__btn {
    min-width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
}
