/*
 * ╔══════════════════════════════════════════════════════════════╗
 * ║  DAMPI — categoria.css  (versión revisada)                   ║
 * ║  Cards más grandes, uniformes y responsivas.                  ║
 * ║  Specs técnicas con el mismo estilo que ocasion.html          ║
 * ╚══════════════════════════════════════════════════════════════╝
 */

/* ── Layout general de página de categoría ─────────────────── */
.cat-page {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 0;
  min-height: calc(100vh - 200px);
}

/* ── Sidebar de filtros ────────────────────────────────────── */
.cat-sidebar {
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.cat-sidebar::-webkit-scrollbar { width: 4px; }
.cat-sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-inner { padding: 0 16px; }

/* ── Zona de contenido (derecha) ───────────────────────────── */
.cat-content { padding: 20px 24px; }

/* ── Hero de categoría ─────────────────────────────────────── */
.cat-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 20px 0 16px;
}
.cat-hero__icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--cat-accent) 12%, transparent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cat-hero__name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1.1;
}
.cat-hero__desc {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
  line-height: 1.5;
}
.cat-hero__stats {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.cat-hero__stat {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.cat-hero__stat strong { color: var(--text2); font-weight: 700; }

/* ── Chips de subcategoría ─────────────────────────────────── */
.subcat-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.subcat-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.subcat-chip:hover {
  border-color: var(--cat-accent);
  color: var(--cat-accent);
  background: color-mix(in srgb, var(--cat-accent) 6%, transparent);
}
.subcat-chip.active {
  background: var(--cat-accent);
  border-color: var(--cat-accent);
  color: #fff;
}

/* ── Toolbar (resultados + orden) ──────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar__left { display: flex; align-items: center; gap: 10px; }
.toolbar__right { display: flex; align-items: center; gap: 8px; }
.results-count {
  font-size: 13px;
  color: var(--text3);
}
.results-count strong { color: var(--text2); }
.sort-select {
  font-size: 13px;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--surface);
  cursor: pointer;
}
.btn-filter-mobile {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--surface);
  cursor: pointer;
}

/* ── Grid de productos ─────────────────────────────────────── */
/*
 * Tamaño de card aumentado: mínimo 240px (antes 210px)
 * Las cards se expanden para cubrir el ancho disponible
 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.products-grid.list-view {
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ── Tarjeta de producto ───────────────────────────────────── */
a.prod-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, box-shadow .15s, transform .15s;
  height: 100%;
}
.prod-card:hover {
  border-color: var(--cat-accent, #94a3b8);
  box-shadow: 0 6px 24px rgba(0,0,0,.09);
  transform: translateY(-2px);
}

/* Imagen — más alta para que se vea mejor el producto */
.prod-card__img {
  height: 200px;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.prod-card__img img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 14px;
  transition: transform .3s;
}
.prod-card:hover .prod-card__img img { transform: scale(1.05); }
.prod-card__img-ph {
  color: var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
}
.prod-card__img-ph svg { width: 56px; height: 56px; }

/* Badge reacondicionado */
.prod-card__badge {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 20px;
  background: #fef3c7;
  color: #92400e;
}
.prod-card__badge--reac {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
}

/* Cuerpo de la card */
.prod-card__body {
  padding: 14px 15px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
}
.prod-card__brand {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 4px;
}
.prod-card__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.38;
  margin-bottom: 10px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Specs técnicas — idéntico a ocasion.html */
.prod-card__specs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 10px;
  padding: 7px 9px;
  background: var(--bg2, #f8fafc);
  border-radius: 7px;
  font-size: 11.5px;
}
.prod-card__spec {
  display: flex;
  gap: 5px;
  line-height: 1.4;
}
.prod-card__spec-k {
  font-weight: 700;
  color: var(--text3, #94a3b8);
  min-width: 36px;
  flex-shrink: 0;
}
.prod-card__spec-v {
  color: var(--text2, #475569);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* Footer precio + botón */
.prod-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}
.prod-card__price {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1;
}
.prod-card__stock {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.prod-card__stock.ok  { color: #065f46; }
.prod-card__stock.low { color: #92400e; }
.prod-card__stock.out { color: #9f1239; }

.prod-card__btn {
  background: var(--cyan);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
  line-height: 1;
}
.prod-card__btn:hover:not(:disabled) {
  opacity: .88;
  background: var(--cyan-dark);
}
.prod-card__btn:disabled {
  background: var(--bg3);
  color: var(--text3);
  cursor: not-allowed;
}

/* ── Vista lista ───────────────────────────────────────────── */
.products-grid.list-view .prod-card {
  flex-direction: row;
  height: 120px;
}
.products-grid.list-view .prod-card__img {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.products-grid.list-view .prod-card__body {
  flex-direction: row;
  align-items: center;
  flex: 1;
  padding: 12px 16px;
  gap: 16px;
}
.products-grid.list-view .prod-card__name {
  flex: 1;
  margin-bottom: 0;
  font-size: 14px;
  -webkit-line-clamp: 2;
}
.products-grid.list-view .prod-card__brand { display: none; }
.products-grid.list-view .prod-card__specs { display: none; }
.products-grid.list-view .prod-card__footer {
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Filtros (sidebar) ─────────────────────────────────────── */
.filter-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.filter-block__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 11px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .08em;
  background: var(--bg2);
  user-select: none;
}
.filter-block__header:hover { color: var(--text); }
.filter-chevron { font-size: 10px; color: var(--text3); transition: transform .2s; }
.filter-block.open .filter-chevron { transform: rotate(180deg); }
.filter-body {
  padding: 10px 14px 14px;
  background: var(--surface);
}
.filter-check {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 0; cursor: pointer;
}
.filter-check input { accent-color: var(--cat-accent); width: 14px; height: 14px; }
.filter-check label {
  font-size: 13px; color: var(--text2); cursor: pointer; line-height: 1.4;
}
.filter-check:hover label { color: var(--text); }

/* Precio range */
.price-range { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.price-inputs { display: flex; gap: 8px; align-items: center; }
.price-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg2);
  color: var(--text);
}
.price-sep { font-size: 12px; color: var(--text3); flex-shrink: 0; }
.price-slider {
  width: 100%;
  accent-color: var(--cat-accent);
}

/* Buscador de marca */
.brand-search {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg2);
  color: var(--text);
  margin-bottom: 8px;
}

/* Paginación */
.cat-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 24px 0;
  flex-wrap: wrap;
}
.cat-page-btn {
  padding: 8px 13px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  min-width: 38px;
}
.cat-page-btn:hover:not(:disabled) {
  border-color: var(--cat-accent);
  color: var(--cat-accent);
}
.cat-page-btn.active {
  background: var(--cat-accent);
  border-color: var(--cat-accent);
  color: #fff;
}
.cat-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Botón de filtro móvil ─────────────────────────────────── */
@media (max-width: 860px) {
  .cat-page { grid-template-columns: 1fr; }
  .cat-sidebar {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    height: 100%;
    background: var(--surface);
    overflow-y: auto;
  }
  .cat-sidebar.open { display: block; }
  .btn-filter-mobile { display: flex; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .prod-card__img { height: 150px; }
  .products-grid.list-view .prod-card { height: auto; flex-direction: column; }
  .products-grid.list-view .prod-card__img { width: 100%; height: 140px; border-right: none; border-bottom: 1px solid var(--border); }
  .products-grid.list-view .prod-card__body { flex-direction: column; gap: 8px; }
}
@media (max-width: 500px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .prod-card__img { height: 130px; }
  .prod-card__name { font-size: 12px; }
  .prod-card__price { font-size: 1.1rem; }
}

/* ── Estilos del sidebar original (sidebar, filter-item, etc.) ─ */
.sidebar {
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
  background: var(--surface);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text2);
  padding: 4px 0 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.sidebar__clear {
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.sidebar__clear:hover { text-decoration: underline; }

.subcat-nav { margin-bottom: 12px; }
.subcat-nav__item {
  display: block;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  border-radius: 6px;
  transition: all .15s;
}
.subcat-nav__item:hover, .subcat-nav__item.active {
  background: color-mix(in srgb, var(--cat-accent) 10%, transparent);
  color: var(--cat-accent);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.filter-item:last-child { border-bottom: none; }
.filter-item input[type="checkbox"] { display: none; }
.filter-checkbox {
  width: 15px; height: 15px;
  border: 1.5px solid var(--border2);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.filter-item input:checked + .filter-checkbox {
  background: var(--cat-accent);
  border-color: var(--cat-accent);
}
.filter-item input:checked + .filter-checkbox::after {
  content: '✓';
  font-size: 9px;
  color: #fff;
  font-weight: 900;
}
.filter-label {
  font-size: 13px;
  color: var(--text2);
  flex: 1;
  line-height: 1.4;
}
.filter-item:hover .filter-label { color: var(--text); }
.filter-count {
  font-size: 11px;
  color: var(--text3);
  background: var(--bg2);
  padding: 1px 6px;
  border-radius: 10px;
}

.filter-block__name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text2);
}

/* Range de precio */
.range-wrap { padding: 4px 0 8px; }
.range-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.range-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg2);
  color: var(--text);
  text-align: center;
}
.range-sep { font-size: 11px; color: var(--text3); }
.range-slider {
  width: 100%;
  accent-color: var(--cat-accent);
}

/* Valoración estrellas en filtros */
.filter-stars { display: flex; align-items: center; gap: 4px; }
.filter-stars .star { color: #f59e0b; font-size: 13px; }
.filter-stars .star.empty { color: var(--border2); }

/* ── Range slider de precio dual ──────────────────────────── */
.range-slider {
  position: relative;
  height: 28px;
  margin-bottom: 8px;
}
.range-track {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  left: 0; right: 0;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
}
.range-fill {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  height: 4px;
  background: var(--cat-accent);
  border-radius: 2px;
  pointer-events: none;
}
.range-slider input[type="range"] {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  left: 0; width: 100%;
  height: 4px;
  background: none;
  -webkit-appearance: none;
  pointer-events: none;
  outline: none;
}
.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--cat-accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  pointer-events: all;
  cursor: pointer;
}
.range-slider input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--cat-accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  pointer-events: all;
  cursor: pointer;
}
