﻿/* ===== Category hero banner (categoria.html) ===== */
.category-banner {
  padding: 132px 0 48px;
  background: var(--bg-surface);
  text-align: center;
}
.category-banner h1 { font-size: clamp(1.9rem, 4.4vw, 2.8rem); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.category-banner p { color: var(--text-secondary); max-width: 560px; margin: 0 auto; }
.category-banner .breadcrumb { justify-content: center; }

/* ===== Toolbar: búsqueda + filtros ===== */
.catalog-toolbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  padding: 20px 0;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.catalog-toolbar.stuck {
  box-shadow: var(--shadow-sm);
  border-bottom-color: var(--border);
}

/* Once stuck, collapse the pills/results-count so a tall filter bar
   (many categories/tags) doesn't eat the viewport and hide product rows
   while scrolling. */
.catalog-toolbar .pills-row,
.catalog-toolbar .results-count {
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}
.catalog-toolbar.stuck .pills-row,
.catalog-toolbar.stuck .results-count {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Search */
.search-box {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}
.search-box input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.92rem;
  color: var(--text);
}
.search-box input:focus { border-color: var(--gold); }
.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-light);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-light);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.search-clear.visible { display: flex; }
.search-clear:hover { background: var(--gold-bg); color: var(--gold); }

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 60;
  display: none;
}
.search-suggestions.open { display: block; }
.search-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.search-suggestion:last-child { border-bottom: none; }
.search-suggestion:hover { background: var(--gold-bg); }
.search-suggestion img {
  width: 32px; height: 32px;
  object-fit: cover;
  border-radius: 6px;
  flex: none;
}
.search-suggestion .suggestion-price { margin-left: auto; color: var(--gold); font-weight: 500; font-size: 0.82rem; }

/* Sort select */
.sort-select {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.88rem;
  color: var(--text);
  margin-left: auto;
}

.filters-toggle-btn {
  display: none;
  align-items: center;
  gap: 8px;
}

/* Pills row (categorías / tags) */
.pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.pills-row + .pills-row { margin-top: 10px; }

.filter-pill {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.filter-pill:hover:not(.active) { border-color: var(--gold); color: var(--gold); }
.filter-pill.active { background: var(--gold); border-color: var(--gold); color: #fff; }

.results-count {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Grid ===== */
.catalog-section { padding-top: 0; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  min-height: 200px;
  /* padding-top is set dynamically in catalog.js to match the live
     .catalog-toolbar height, so products never start behind the sticky
     bar regardless of how many pill rows it wraps into. */
  transition: opacity 0.15s ease, padding-top 0.25s ease;
}
.product-grid.transitioning { opacity: 0; }

.product-grid .product-card {
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 0.5s ease forwards;
}
@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .product-grid .product-card { animation: none; opacity: 1; transform: none; }
}

.catalog-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.88rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--gold); color: var(--gold); }
.page-btn.active { background: var(--gold); border-color: var(--gold); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { color: var(--text-light); padding: 0 4px; }

/* ===== Filters drawer (mobile) ===== */
.filters-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
}
.filters-drawer-overlay.open { display: block; }

.filters-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: var(--bg-elevated);
  z-index: 201;
  padding: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.filters-drawer.open { transform: translateX(0); }

.filters-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.filters-drawer-header h3 { font-family: 'Lato', sans-serif; font-size: 1.1rem; }
.filters-drawer-close {
  width: 32px; height: 32px;
  border: none; background: var(--gold-bg);
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--text);
}
.filters-drawer .field-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 20px 0 10px;
}
.filters-drawer .field-label:first-of-type { margin-top: 0; }
.filters-drawer .sort-select { width: 100%; margin-left: 0; }
.filters-drawer-apply { width: 100%; margin-top: 24px; }

/* ===== Otras categorías (categoria.html) ===== */
.other-categories {
  background: var(--bg-surface);
}
.other-categories-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.other-category-card {
  flex: 0 0 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.other-category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.other-category-card h4 { font-size: 1.1rem; margin-bottom: 4px; }
.other-category-card p { color: var(--text-secondary); font-size: 0.82rem; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .sort-select { display: none; }
  .filters-toggle-btn { display: inline-flex; margin-left: auto; }
  .pills-row.category-pills-row,
  .pills-row.tag-pills-row { display: none; }
}

@media (max-width: 420px) {
  .search-box { max-width: none; }
  .product-grid { grid-template-columns: 1fr; gap: 18px; }
  .other-category-card { flex-basis: 172px; }
}

@media (max-width: 768px) {
  .filter-pill { padding: 11px 18px; }
  .page-btn { min-width: 44px; height: 44px; }
  .search-clear { width: 32px; height: 32px; }
  .filters-toggle-btn { min-height: 44px; }
}
