/* ================================================================
   LISTING.CSS — Búsqueda / Categoría
   ================================================================ */

/* ── LAYOUT ── */
.listing-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  padding: 24px 0 48px;
}

/* ── SIDEBAR FILTERS ── */
.filters-sidebar {
  background: var(--white);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-h) + var(--nav-sub-h) + 16px);
}
.filters-header {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filters-header h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
}
.filters-clear {
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
}
.filters-clear:hover { text-decoration: underline; }

.filter-block {
  border-bottom: 1.5px solid var(--border);
}
.filter-block:last-child { border-bottom: none; }
.filter-block-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.filter-block-header:hover { background: var(--bg); }
.filter-block-title { font-size: 0.85rem; font-weight: 700; }
.filter-chevron {
  font-size: 0.7rem;
  color: var(--text-3);
  transition: transform 0.2s;
}
.filter-block.collapsed .filter-chevron { transform: rotate(-90deg); }
.filter-block.collapsed .filter-body { display: none; }
.filter-body { padding: 4px 20px 16px; }

/* Price slider */
.price-slider-wrap { padding: 4px 0; }
.price-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--red) 0%, var(--red) 55%, var(--border) 55%);
  outline: none;
  cursor: pointer;
  margin: 12px 0 8px;
}
.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(216,27,96,0.3);
  cursor: grab;
}
.price-slider::-webkit-slider-thumb:active { cursor: grabbing; }
.price-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-2); font-weight: 600; }
.price-input-row { display: flex; gap: 8px; margin-top: 10px; }
.price-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
}
.price-input:focus { border-color: var(--red); }

/* Checkboxes */
.filter-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text-2);
  transition: color var(--transition);
}
.filter-check:hover { color: var(--red); }
.filter-check input[type="checkbox"] {
  accent-color: var(--red);
  width: 15px; height: 15px;
  flex-shrink: 0;
}
.filter-check-count { margin-left: auto; font-size: 0.7rem; color: var(--text-3); background: var(--bg2); padding: 1px 6px; border-radius: 8px; }

/* Star filter */
.star-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-2);
  transition: color var(--transition);
}
.star-row:hover { color: var(--red); }
.star-row input { accent-color: var(--red); }

/* Color swatches */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.color-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.color-swatch:hover, .color-swatch.active { border-color: var(--text); transform: scale(1.15); }
.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  color: #fff;
  font-weight: 700;
}

/* Mobile filter drawer */
.mobile-filter-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.mobile-filter-bar::-webkit-scrollbar { display: none; }
.mobile-filter-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 30px;
  font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
}
.mobile-filter-pill:hover { border-color: var(--red); color: var(--red); }
.mobile-filter-pill.active { background: var(--red); color: #fff; border-color: var(--red); }

/* ── RESULTS AREA ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.results-meta h2 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; }
.results-meta p { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

.results-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sort-dropdown {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 30px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  background: var(--white);
  cursor: pointer;
  color: var(--text);
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238A8A8A'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.sort-dropdown:focus { border-color: var(--red); }

.view-toggle { display: flex; gap: 3px; }
.view-toggle-btn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  transition: all var(--transition);
}
.view-toggle-btn.active, .view-toggle-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

/* Active filters tags */
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.active-filter-tag {
  display: flex; align-items: center; gap: 6px;
  background: var(--red-light);
  color: var(--red);
  border: 1px solid var(--red-mid);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.active-filter-remove {
  background: none; border: none;
  color: var(--red); cursor: pointer;
  font-size: 0.9rem; line-height: 1;
  padding: 0;
}

/* Product listing grid */
.listing-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.listing-products-grid.list-view {
  grid-template-columns: 1fr;
}
.listing-products-grid.list-view .product-card {
  flex-direction: row;
  max-height: 160px;
}
.listing-products-grid.list-view .card-img-wrap {
  width: 160px;
  min-width: 160px;
  aspect-ratio: auto;
  height: 100%;
}
.listing-products-grid.list-view .card-actions {
  padding: 14px 14px 14px 0;
  opacity: 1;
  transform: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 32px 0 0;
}
.page-btn {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--red); color: var(--red); }
.page-btn.active { background: var(--red); border-color: var(--red); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* RESPONSIVE LISTING */
@media (max-width: 900px) {
  .listing-layout { grid-template-columns: 1fr; }
  .filters-sidebar { display: none; }
  .mobile-filter-bar { display: flex; }
}
@media (max-width: 600px) {
  .listing-products-grid { grid-template-columns: repeat(2, 1fr); }
  .listing-products-grid.list-view { grid-template-columns: 1fr; }
  .listing-products-grid.list-view .card-img-wrap { width: 120px; min-width: 120px; }
}
