/* Tienda - Grid de tarjetas de producto */
.tienda-header {
  background: var(--primary);
  color: var(--on-primary);
  padding: 3rem 0;
  text-align: center;
  margin-bottom: 2rem;
}

.tienda-title { 
  font-size: 2.5rem; 
  font-weight: 700; 
  margin-bottom: 0.5rem; 
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-primary);
}

.tienda-subtitle { 
  font-size: 1rem; 
  opacity: 0.9; 
  font-family: var(--font-sans);
  color: var(--on-primary);
}

.filters-toggle {
  margin-top: 1.5rem;
  padding: 0.8rem 2.5rem;
  background: var(--bg-white);
  color: var(--primary);
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filters-toggle:hover {
  opacity: 0.8;
}

/* Product Card - Minimalist Style */
.product-card {
  position: relative;
  background: var(--bg-white);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

/* Enlace superpuesto que hace clickeable toda la tarjeta */
.product-card-link {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
  border-radius: inherit;
}

.product-image-link {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f5f5;
  margin-bottom: 0.75rem;
}

.product-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image-link img {
  transform: scale(1.05);
}

/* Recorta el borde oscuro integrado en el borde derecho de las fotos de Ofertas. */
#offersSlider .product-image-link img {
  transform: scale(1.01);
}

#offersSlider .product-card:hover .product-image-link img {
  transform: scale(1.05);
}

.product-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 10px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
  line-height: 1.2;
}

.product-badge.discount {
  background: var(--primary);
  color: var(--on-primary);
}

/* Zona fija superior de etiquetas. El margen derecho (50px) reserva el hueco
   del botón rápido "Añadir al carrito" (top:10px / right:10px / 32px) para que
   nunca se superpongan. El botón principal vive en la franja inferior. */
.product-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 50px;
  bottom: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 10;
  align-items: flex-start;
  justify-content: flex-start;
  pointer-events: none;
}
.product-badges > * {
  pointer-events: auto;
}

.quick-add-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-white);
  color: var(--primary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 15;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 0;
}

.quick-add-btn:hover {
  background: var(--primary);
  color: var(--on-primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.quick-add-btn i {
  font-size: 0.8rem;
}

.product-info {
  text-align: center;
  padding: 0 0.5rem;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 0.25rem;
  min-height: auto;
  font-family: var(--font-sans); /* Using sans for product names for better legibility */
  text-transform: none;
  letter-spacing: 0;
}

.product-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.product-price-wrapper {
  font-size: 0.95rem;
  font-weight: 600;
}

.price-old {
  color: #999;
  text-decoration: line-through;
  margin-right: 0.5rem;
  font-weight: 400;
  font-size: 0.85rem;
}

.price-new {
  color: var(--text-primary);
}

.price-regular {
  color: var(--text-primary);
}

/* Franja inferior fija: precio + botón principal alineados */
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.product-btn {
  position: relative;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.product-btn:hover {
  background: var(--primary);
  color: var(--on-primary);
  transform: translateY(-2px);
  text-decoration: none;
}

/* Sidebar / Drawer Filters */
.filters-sidebar {
  width: 350px;
  max-width: 90vw;
  padding: 2rem;
}

.filters-header {
  margin-bottom: 2rem;
  border: none;
}

.filters-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.filter-btn {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  width: 100%;
  padding: 0.85rem 1rem;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.filter-btn:hover {
  filter: brightness(0.95);
}

.filter-btn:active {
  transform: translateY(1px);
}

.form-input, .form-select {
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.85rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.search-input {
  position: relative;
  width: 100%;
}

.search-input i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.search-input .form-input {
  padding-left: 2.5rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
}

.pagination .current {
  font-weight: 600;
  color: inherit;
}

.pagination a {
  color: inherit; /* Matches .current color */
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.pagination a:hover, .pagination a:focus {
  background-color: var(--bg-light);
  color: var(--primary);
}

.pagination a i {
  font-size: 1rem;
  color: inherit;
}

@media (max-width: 768px) {
  .tienda-title { font-size: 1.5rem; }
  .product-title { font-size: 0.85rem; }
  .product-price-wrapper { font-size: 0.9rem; }
  /* Mobile: precio arriba, botón debajo para evitar desborde entre tarjetas */
  #product-grid .product-footer {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  #product-grid .product-price-wrapper {
    margin-top: 0.25rem;
    text-align: center;
  }
  #product-grid .product-btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
}

.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.products-count {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.store-sort {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.store-sort__label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-sort__field {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.store-sort__icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.9rem;
}

.store-sort__select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.6rem 2.5rem 0.6rem 2.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  background: var(--bg-white);
  color: var(--text-primary);
  min-height: 44px;
}

.store-sort__select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
}

.store-sort__field::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-secondary);
  pointer-events: none;
}

.store-toolbar {
  margin: 1.25rem 0 0.75rem;
}

.store-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: 999px;
  padding: 0.55rem 0.6rem 0.55rem 2.6rem;
  box-shadow: var(--shadow);
}

.store-search__icon {
  position: absolute;
  left: 1rem;
  color: var(--text-secondary);
  pointer-events: none;
}

.store-search__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  min-height: 44px;
  padding: 0;
}

.store-search__input:focus {
  outline: none;
}

.store-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
}

.store-search__submit {
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s ease, transform 0.15s ease;
  flex: 0 0 auto;
}

.store-search__submit:hover {
  filter: brightness(0.95);
}

.store-search__submit:active {
  transform: translateY(1px);
}

.products-section--slider .section-header {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin: 0 0 1.25rem;
}

.products-section--slider .section-title {
  font-family: var(--font-serif);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
  font-size: 1.05rem;
}

.products-section--slider {
  margin: 1.25rem 0 2.5rem;
  content-visibility: auto;
  contain-intrinsic-size: 1px 650px;
}

.store-empty {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--bg-light);
  margin: 2rem auto 0;
  max-width: 760px;
}

.store-empty__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex: 0 0 auto;
}

.store-empty__icon i {
  font-size: 1.1rem;
}

.store-empty__content {
  flex: 1;
  min-width: 0;
}

.store-empty__title {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.store-empty__text {
  margin: 0.4rem 0 0;
  color: var(--text-secondary);
}

.store-empty__actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.store-btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.store-btn--primary:hover {
  filter: brightness(0.95);
  color: var(--on-primary);
}

@media (max-width: 768px) {
  .store-empty {
    flex-direction: column;
    align-items: stretch;
  }

  .store-btn {
    width: 100%;
  }
}

/* ============================================
   Grilla de productos de la tienda
   - 4 columnas fijas por fila en escritorio/tablet (>=768px)
   - 2 columnas por fila en móvil (<768px)
   - Filas ilimitadas: se generan automáticamente según la cantidad
     de productos (filtrados o no).
   - La estructura de la rejilla es independiente de los filtros: estos
     solo cambian el conjunto de productos, nunca la grilla en sí.
   ============================================ */
#product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  align-items: stretch;
}

@media (max-width: 767.98px) {
  #product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

#product-grid > .product-grid-item {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 0;
}

/* Tarjetas uniformes: misma anchura, altura e imagen en todas */
#product-grid .product-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  margin-bottom: 0;
}

#product-grid .product-image-link {
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 0.75rem;
}

#product-grid .product-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

#product-grid .product-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #ccc;
  font-size: 2rem;
}

#product-grid .product-info {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 0 0.5rem 0.25rem;
}

/* Título limitado a 2 líneas con altura reservada => misma altura en todas las tarjetas */
#product-grid .product-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  min-height: 2.6em;
}

#product-grid .product-price-wrapper {
  margin-top: auto;
}

/* Sidebar de filtros rediseñado */
.filters-sidebar .filters-header {
  background: var(--primary);
  color: #fff;
  padding: 1.25rem 1.5rem;
}
.filters-sidebar .filters-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.filters-sidebar .filters-count {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}
.filters-sidebar .filters-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
}
.filters-sidebar .filters-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.filters-sidebar .form-group {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: var(--bg-white, #fff);
}
.filters-sidebar .form-label {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary, #111);
  margin-bottom: 0.5rem;
}
.filters-sidebar .form-select,
.filters-sidebar .form-input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  font-size: 0.95rem;
  background: var(--bg-white, #fff);
  color: var(--text-primary, #111);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.filters-sidebar .form-select:focus,
.filters-sidebar .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}
.filters-sidebar .filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  width: 100%;
}
.filters-sidebar .filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -8px rgba(0, 180, 216, 0.6);
  filter: brightness(0.95);
}

/* Badges de inventario (Remake) */
.badge-soldout {
  position: relative;
  flex: 0 0 auto;
  background: rgba(75, 85, 99, 0.92);
  color: #fff;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  z-index: 11;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(2px);
}
.badge-lowstock {
  position: relative;
  flex: 0 0 auto;
  background: #f59e0b;
  color: #1f2937;
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  z-index: 11;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.4);
}
.product-card.is-soldout .quick-add-btn {
  display: none !important;
}
.product-card.is-soldout .product-image-link {
  opacity: 0.6;
  filter: grayscale(0.5);
}
.product-card.is-soldout .product-image {
  opacity: 0.6;
  filter: grayscale(0.5);
}
.product-card.is-soldout .product-info {
  opacity: 0.7;
}
.product-card.is-soldout .product-content {
  opacity: 0.7;
}
.related-card.is-soldout .related-media {
  opacity: 0.6;
  filter: grayscale(0.5);
}
.related-card.is-soldout .related-content {
  opacity: 0.7;
}
