/* ========== PRODUCTOS - GRID Y CARDS ========== */

/* Main content mejorado */
#main-content {
  flex: 1;
  padding: 1rem 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Botón de retorno a categorías */
.category-back-button-wrapper {
  margin-bottom: 1.5rem;
  padding-top: 0.5rem;
}

.category-back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid #e8e8e8;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  color: #007185;
  font-size: 14px;
  font-weight: 600;
  margin: 0rem 0.5rem;
  transition: var(--transicion);
}

.category-back-button:hover {
  transform: translateX(-4px);
  box-shadow: var(--sombra-hover);
  background: linear-gradient(135deg, #9ac0d9 0%, #96becd 100%);
}

.category-back-button:active {
  transform: translateX(-2px);
}

.category-back-button i {
  font-size: 1.1rem;
}

/* Productos - Grid Layout */
.products-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* Product Card */
.product-card {
  --card-padding: 0.75rem;
  --image-height: 160px;
  --badge-size: 0.65rem;
  --title-font: 0.9rem;
  --price-font: 1.1rem;
  --btn-font: 0.85rem;

  background: var(--blanco);
  border-radius: var(--borde-radius);
  border: 1px solid #e8e8e8;
  box-shadow: var(--sombra);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.product-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  border-color: var(--color-principal);
}

/* Badges */
.product-badges {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 2;
}

.badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 2px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge i {
  font-size: 0.7rem;
}

.badge.oferta {
  background: #c00;
  color: white;
}

.badge.mas-vendido {
  background: #2c2c2c;
  color: white;
}

.badge.destacado {
  background-color: var(--azul-destacado);
  border-left: 3px solid #004b8d;
}

.badge.nuevo {
  background: #007185;
  color: white;
}

.badge.agotado {
  background-color: #dc3545;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Imagen del producto */
.product-image-container {
  position: relative;
  padding: var(--card-padding);
  background: linear-gradient(to bottom, #f9f9f9, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--image-height);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.product-image-container.unavailable {
  opacity: 0.5;
  background: linear-gradient(to bottom, #f0f0f0, #e8e8e8);
  position: relative;
}

.product-image-container.unavailable::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    45deg,
    rgba(220, 53, 69, 0.1),
    rgba(220, 53, 69, 0.1) 10px,
    transparent 10px,
    transparent 20px
  );
}

.product-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: brightness(0.98);
  transition: transform 0.3s ease;
  cursor: pointer;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

/* Información del producto */
.product-info {
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-info h3 {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--negro);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-bottom: 10px;
}

.product-info h3:hover {
  color: var(--color-principal-pastel);
}

.product-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--negro);
  margin-bottom: 0.2rem;
  line-height: 1.1;
  min-height: unset;
  max-height: 3rem;
  overflow: hidden;
  display: -webkit-box;
  transition: color 0.2s ease;
}

.product-category {
  color: #5e5e5e87;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  margin-top: 0;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Precios */
.price-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.original-price {
  font-size: calc(var(--price-font) - 0.2rem);
  color: var(--gris-medio);
  text-decoration: line-through;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.discount-percent {
  background: var(--oferta);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: calc(var(--badge-size) - 0.05rem);
  font-weight: bold;
}

.current-price {
  font-size: var(--price-font);
  font-weight: 700;
  color: var(--negro);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

/* Información adicional */
.shipping-info {
  font-size: 0.8rem;
  color: var(--gris-medio);
  margin: 0.35rem 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.shipping-info i {
  color: var(--color-principal);
}


/* Botón agregar al carrito */
.add-to-cart {
  background: var(--color-principal);
  color: var(--negro);
  border: none;
  border-radius: 50px;
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 2px solid var(--melocoton-pastel);
}

.add-to-cart:hover {
  background: var(--botonA);
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.add-to-cart.disabled,
.add-to-cart:disabled {
  background: #dc3545;
  color: white;
  cursor: not-allowed;
  border-color: #c82333;
  opacity: 0.85;
  font-weight: 700;
}

.add-to-cart.disabled:hover,
.add-to-cart:disabled:hover {
  background: #dc3545;
  transform: none;
  box-shadow: none;
}

/* Contador de cantidad dinámico */
.quantity-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--color-principal);
  border: 2px solid var(--melocoton-pastel);
  border-radius: 50px;
  padding: 0.2rem 0.8rem;
  width: 100%;
  max-width: 300px;
}

.quantity-btn {
  background: transparent;
  border: none;
  color: var(--negro);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.quantity-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.1);
}

.quantity-btn:active {
  transform: scale(0.95);
}

.quantity-display {
  font-weight: 700;
  font-size: 1rem;
  color: var(--negro);
  min-width: 40px;
  text-align: center;
  user-select: none;
  transition: transform 0.3s ease;
}

/* Animación cuando aumenta la cantidad */
@keyframes quantity-increase {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Animación cuando disminuye la cantidad */
@keyframes quantity-decrease {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.quantity-display.increasing {
  animation: quantity-increase 0.4s ease-out;
}

.quantity-display.decreasing {
  animation: quantity-decrease 0.4s ease-out;
}

.quantity-btn.trash-icon {
  color: #dc3545;
}

.quantity-btn.trash-icon:hover {
  background: rgba(220, 53, 69, 0.2);
}

/* Mensaje sin resultados */
.no-results-container {
  width: 100%;
  padding: 3rem 1.5rem;
  text-align: center;
  display: none;
  animation: fadeInUp 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
  grid-column: 1 / -1;
  position: relative;
  z-index: 10;
}

.no-results-content {
  background-color: var(--blanco);
  padding: 2.5rem;
  border-radius: calc(var(--borde-radius) * 1.5);
  max-width: 500px;
  margin: 0 auto;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.08),
    0 5px 10px rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.15);
  position: relative;
  overflow: hidden;
}

.no-results-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--color-principal),
    var(--color-principal-pastel)
  );
}

.no-results-icon {
  font-size: 3rem;
  color: var(--color-principal);
  margin-bottom: 1.5rem;
  display: inline-block;
  animation: bounce 1s ease infinite alternate;
}

.no-results-title {
  font-size: 1.75rem;
  color: var(--negro);
  margin-bottom: 1rem;
  font-weight: 700;
  position: relative;
}

.no-results-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--color-principal);
  border-radius: 3px;
}

.no-results-message {
  color: var(--gris-medio);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
}

.no-results-term {
  font-weight: 700;
  color: var(--negro);
  font-style: italic;
}

.clear-search-btn {
  background: var(--color-principal);
  color: var(--negro);
  border: none;
  padding: 0.9rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 6px rgba(212, 175, 55, 0.2);
}

.clear-search-btn:hover {
  background: var(--color-principal-pastel);
  transform: translateY(-2px);
  box-shadow: 0 7px 14px rgba(212, 175, 55, 0.3);
}

.clear-search-btn i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.clear-search-btn:hover i {
  transform: translateX(3px);
}

/* ========== CATEGORY PANELS - AGRUPACIÓN POR CATEGORÍA ========== */

/* Contenedor de productos rediseñado */
#products-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin-top: 1.5rem;
}

/* Panel de categoría */
.category-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background: transparent;
  border: none;
  border-radius: 0.75rem;
  padding: 0;
  animation: slideInUp 0.5s ease-out;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.category-panel:hover {
  transform: none;
}

/* Encabezado de categoría - Más compacto */
.category-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--melocoton-pastel);
  border-radius: 0.6rem;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.12);
  animation: slideInLeft 0.5s ease-out;
  border-left: 4px solid var(--melocoton-pastel);
  border-bottom: 2px solid rgba(212, 175, 55, 0.25);
}

.category-header-content {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
}

.category-header i {
  font-size: 1.5rem;
  color: var(--color-principal);
  opacity: 1;
  flex-shrink: 0;
}

.category-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blanco);
  margin: 0;
  text-transform: capitalize;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-count {
  background: var(--color-principal);
  color: var(--negro);
  padding: 0.35rem 0.8rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-left: auto;
  border: 2px solid rgba(212, 175, 55, 0.4);
  flex-shrink: 0;
}

/* Grid de productos por categoría */
.category-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  animation: fadeIn 0.6s ease-out 0.1s both;
}

/* Animaciones */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========== RESPONSIVE PARA CATEGORY PANELS ========== */

/* Desktop Grande (1400px+) */
@media (min-width: 1400px) {
  .category-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Desktop Estándar (1200px - 1399px) */
@media (max-width: 1399px) {
  .category-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.4rem;
  }
}

/* Tablets Grandes (992px - 1199px) */
@media (max-width: 1199px) {
  #products-container {
    gap: 2rem;
  }

  .category-header {
    padding: 0.8rem 0.9rem;
    gap: 0.75rem;
  }

  .category-header i {
    font-size: 1.4rem;
  }

  .category-title {
    font-size: 1.1rem;
  }

  .category-count {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
  }

  .category-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
  }
}

/* Tablets (769px - 991px) */
@media (max-width: 991px) {
  #products-container {
    gap: 1.8rem;
  }

  .category-panel {
    gap: 1rem;
  }

  .category-header {
    padding: 0.75rem 0.85rem;
    gap: 0.65rem;
  }

  .category-header i {
    font-size: 1.3rem;
  }

  .category-title {
    font-size: 1.05rem;
  }

  .category-count {
    font-size: 0.75rem;
    padding: 0.3rem 0.65rem;
  }

  .category-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }
}

/* Tablets Medianos (768px - 768px) */
@media (max-width: 768px) {
  #main-content {
    padding: 0.75rem 1rem;
  }

  #products-container {
    gap: 1.5rem;
  }

  .category-panel {
    gap: 0.9rem;
  }

  .category-header {
    padding: 0.7rem 0.8rem;
    gap: 0.6rem;
  }

  .category-header i {
    font-size: 1.25rem;
  }

  .category-title {
    font-size: 1rem;
  }

  .category-count {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
  }

  .category-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.9rem;
  }

  .product-card {
    --image-height: 140px;
    --title-font: 0.85rem;
    --price-font: 1rem;
    --btn-font: 0.8rem;
  }

  .product-info {
    padding: 0.65rem;
  }

  .product-title {
    font-size: 0.85rem;
  }

  .price-container {
    margin-bottom: 0.6rem;
  }

  .add-to-cart {
    padding: 0.8rem;
    font-size: 0.9rem;
  }
}

/* Móviles Grandes (480px - 767px) */
@media (max-width: 767px) {
  #main-content {
    padding: 0.5rem 0.75rem;
  }

  #products-container {
    gap: 1.2rem;
  }

  .category-panel {
    gap: 0.8rem;
  }

  .category-header {
    padding: 0.65rem 0.75rem;
    gap: 0.55rem;
    border-bottom: 2px solid var(--color-principal-pastel);
  }

  .category-header i {
    font-size: 1.2rem;
  }

  .category-title {
    font-size: 0.95rem;
  }

  .category-count {
    font-size: 0.7rem;
    padding: 0.25rem 0.55rem;
  }

  .category-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.8rem;
  }

  .product-card {
    --image-height: 130px;
    --title-font: 0.8rem;
    --price-font: 0.95rem;
    --btn-font: 0.75rem;
  }

  .product-info {
    padding: 0.6rem;
  }

  .product-title {
    font-size: 0.8rem;
  }

  .price-container {
    margin-bottom: 0.5rem;
    gap: 0.3rem;
  }

  .original-price {
    font-size: 0.75rem;
  }

  .discount-percent {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
  }

  .current-price {
    font-size: 0.9rem;
  }

  .add-to-cart {
    padding: 0.7rem;
    font-size: 0.8rem;
    gap: 0.4rem;
  }

  .add-to-cart i {
    font-size: 0.85rem;
  }
}

/* Móviles Pequeños (hasta 479px) */
@media (max-width: 479px) {
  #main-content {
    padding: 0.5rem 0.5rem;
  }

  #products-container {
    gap: 3rem;
  }

  .category-panel {
    gap: 0.7rem;
  }

  .category-header {
    padding: 0.6rem 0.7rem;
    gap: 0.5rem;
  }

  .category-header-content {
    gap: 0.6rem;
  }

  .category-header i {
    font-size: 1.1rem;
  }

  .category-title {
    font-size: 0.9rem;
  }

  .category-count {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  .category-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
  }

  .product-card {
    --image-height: 120px;
    --title-font: 0.75rem;
    --price-font: 0.9rem;
    --btn-font: 0.7rem;
  }

  .product-info {
    padding: 0.5rem;
  }

  .product-title {
    font-size: 0.75rem;
    max-height: 2.5rem;
  }

  .product-category {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
  }

  .price-container {
    margin-bottom: 0.4rem;
    gap: 0.2rem;
  }

  .original-price {
    font-size: 1rem;
  }

  .discount-percent {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
  }

  .current-price {
    font-size: 0.85rem;
  }

  .add-to-cart {
    padding: 0.6rem;
    font-size: 0.7rem;
    gap: 0.3rem;
  }

  .add-to-cart i {
    font-size: 0.75rem;
  }
}

