/* ===== ESTILOS ESPECÍFICOS PARA EL CATÁLOGO DE PRODUCTOS ===== */

/* Page Header */
.page-header {
  background: linear-gradient(135deg, var(--primario) 0%, var(--primario-claro) 100%);
  color: white;
  padding: var(--spacing-xl) 0 var(--spacing-lg);
}

.breadcrumb {
  font-size: 14px;
  margin-bottom: var(--spacing-sm);
  opacity: 0.9;
}

.breadcrumb a {
  color: white;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.breadcrumb a:hover {
  opacity: 0.8;
}

.page-header h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  line-height: 1.2;
  color: inherit;
}

.page-header p {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
  color: inherit;
}

/* Catalog Section */
.catalog-section {
  padding: var(--spacing-xl) 0;
  background-color: var(--gris-6);
  /* FIX: Prevenir overflow horizontal */
  overflow-x: hidden;
}

/* Category Navigation - PRINCIPALES FIXES AQUÍ */
.category-nav-wrapper {
  position: relative;
  margin-bottom: var(--spacing-xl);
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: var(--spacing-xs) var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  /* FIX: Prevenir que se desborde */
  max-width: 100%;
  overflow: hidden;
}

.category-nav {
  display: flex;
  gap: var(--spacing-md);
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  padding: var(--spacing-xs) 0;
  /* FIX: Asegurar que no se desborde */
  min-width: 0;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav.active {
  cursor: grabbing;
  user-select: none;
}

.category-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 32px;
  text-decoration: none;
  color: var(--primario);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  min-width: 120px;
  flex-shrink: 0;
  text-align: left;
  background: var(--gris-6);
  /* FIX: Prevenir que el texto se desborde */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-link:hover {
  background: var(--primario-casi-blanco);
  color: var(--primario-oscuro);
  transform: translateY(-2px);
}

.category-link.active {
  background: var(--primario);
  color: white;
}

.category-link img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
  flex-shrink: 0;
}

.category-link.active img {
  border-color: white;
}

.nav-arrow {
  background: var(--gris-5);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--primario);
  flex-shrink: 0;
}

.nav-arrow:hover {
  background: var(--primario);
  color: white;
  transform: scale(1.1);
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Products Container - FIX PARA GRID */
.products-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-md);
  /* FIX: Asegurar que el grid no se desborde */
  width: 100%;
  max-width: 100%;
}

/* Product Card */
.product-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  /* FIX: Prevenir overflow en las cards */
  max-width: 100%;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Product Image */
.product-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-category {
  position: absolute;
  top: var(--spacing-xs);
  right: var(--spacing-xs);
  background: var(--verde);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Product Content */
.product-content {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  flex: 1;
  /* FIX: Prevenir overflow de texto */
  min-width: 0;
}

.product-title {
  margin-bottom: var(--spacing-sm);
}

.product-title a {
  color: var(--primario);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 600;
  transition: color 0.3s ease;
  line-height: 1.2;
  display: block;
  /* FIX: Manejar texto largo */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.product-title a:hover {
  color: var(--primario-oscuro);
}

.product-description {
  color: var(--gris-2);
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
  font-size: 14px;
  /* FIX: Manejar texto largo */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Product Footer */
.product-footer {
  display: block;
  margin-top: auto;
}

.product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--verde);
  margin-bottom: var(--spacing-sm);
}

/* Contenedor para los botones de acción */
.product-actions {
  display: flex;
  gap: var(--spacing-xs);
  align-items: stretch;
  /* FIX: Prevenir overflow de botones */
  min-width: 0;
}

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  background: #25d366;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.btn-whatsapp:hover {
  background: #128c7e;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-more-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  flex: 1;
  background: var(--primario);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.25;
  /* FIX: Prevenir overflow del botón */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-more-info svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-more-info:hover {
  background: var(--primario-oscuro);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Purchase Information */
.purchase-info {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: var(--spacing-lg);
  padding: var(--spacing-lg);
  text-align: center;
  /* FIX: Prevenir overflow */
  max-width: 100%;
  overflow: hidden;
}

.purchase-info-content h3 {
  color: var(--primario);
  font-size: 1.5rem;
  margin-bottom: var(--spacing-sm);
}

.purchase-info-content p {
  color: var(--gris-2);
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

.contact-options {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.contact-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.contact-option.whatsapp {
  background: #25d366;
  color: white;
}

.contact-option.whatsapp:hover {
  background: #128c7e;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.contact-option.email {
  background: var(--primario);
  color: white;
}

.contact-option.email:hover {
  background: var(--primario-oscuro);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.purchase-note {
  font-size: 0.9rem;
  color: var(--gris-3);
  font-style: italic;
  margin-bottom: 0;
}

/* Responsive Design - FIXES PRINCIPALES AQUÍ */
@media (max-width: 1200px) {
  /* FIX: Ajustar grid para pantallas medianas */
  .products-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  /* FIX: Reducir padding del contenedor */
  .container {
    padding: 0 var(--spacing-sm);
  }

  /* FIX: Ajustar navegación de categorías */
  .category-nav-wrapper {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .category-link {
    min-width: 110px;
    font-size: 13px;
  }
}

@media (max-width: 992px) {
  .products-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  /* FIX: Asegurar que no hay overflow en móvil */
  .catalog-section {
    padding: var(--spacing-lg) 0;
    overflow-x: hidden;
  }

  .category-nav-wrapper {
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    /* FIX: Asegurar que el wrapper no se desborde */
    margin-left: 0;
    margin-right: 0;
  }

  .category-nav {
    gap: var(--spacing-sm);
  }

  .category-link {
    min-width: 100px;
    padding: var(--spacing-xs);
    font-size: 12px;
  }

  .category-link img {
    width: 35px;
    height: 35px;
  }

  .nav-arrow {
    width: 35px;
    height: 35px;
  }

  .page-header {
    padding: var(--spacing-lg) 0 var(--spacing-md);
    text-align: center;
  }

  .page-header h1 {
    font-size: 2.5rem;
  }

  .page-header p {
    font-size: 1.1rem;
  }

  /* Vista en lista para móviles */
  .products-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .product-card {
    display: flex;
    flex-direction: row;
    /* FIX: Prevenir overflow en cards horizontales */
    max-width: 100%;
    overflow: hidden;
  }

  .product-image {
    width: 140px;
    height: auto;
    min-height: 100%;
    flex-shrink: 0;
  }

  .product-content {
    flex: 1;
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* FIX: Asegurar que el contenido no se desborde */
    min-width: 0;
    overflow: hidden;
  }

  .product-title a {
    font-size: 1rem;
    line-height: 1.3;
  }

  .product-description {
    font-size: 13px;
    margin-bottom: var(--spacing-sm);
    flex: 1;
  }

  /* Product Footer en móvil - flex layout */
  .product-footer {
    display: flex !important;
    justify-content: flex-start;
    align-items: center;
    gap: var(--spacing-sm);
    /* FIX: Prevenir overflow del footer */
    min-width: 0;
  }

  .product-price {
    font-size: 1.1rem;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .product-actions {
    margin-left: auto;
    gap: var(--spacing-xs);
    /* FIX: Prevenir overflow de acciones */
    flex-shrink: 0;
  }

  .btn-whatsapp {
    width: 32px;
    height: 32px;
  }

  .btn-more-info {
    padding: 6px var(--spacing-sm);
    font-size: 12px;
    flex: none;
    width: auto;
    /* FIX: Limitar ancho máximo */
    min-width: 0;
    overflow: hidden;
  }

  .product-category {
    top: 4px;
    right: 4px;
    padding: 2px 6px;
    font-size: 10px;
  }

  .purchase-info {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
  }

  .contact-options {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
  }

  .contact-option {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  /* FIX: Ajustes adicionales para pantallas muy pequeñas */
  .container {
    padding: 0 var(--spacing-xs);
  }

  .category-link {
    min-width: 90px;
    font-size: 11px;
  }

  .category-link img {
    width: 30px;
    height: 30px;
  }

  .nav-arrow {
    width: 30px;
    height: 30px;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .product-card {
    display: flex;
    flex-direction: row;
  }

  .product-image {
    width: 120px;
    height: auto;
    min-height: 100%;
  }

  .product-content {
    padding: var(--spacing-xs);
  }

  .product-title a {
    font-size: 0.9rem;
  }

  .product-description {
    font-size: 12px;
  }

  .product-price {
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .btn-more-info .btn-text {
    display: none;
  }

  .btn-more-info {
    width: 40px;
    padding: var(--spacing-xs);
    flex: none;
  }
}

/* Estados de carga y animaciones */
.product-card {
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus states para accesibilidad */
.category-btn:focus,
.btn-more-info:focus,
.product-title a:focus,
.product-image a:focus {
  outline: 2px solid var(--primario);
  outline-offset: 2px;
}

/* Mejoras adicionales para la consistencia visual */
.product-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Navegación activa */
.main-nav a.active {
  color: var(--primario);
  font-weight: 600;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-top: var(--spacing-xl);
  padding: var(--spacing-md) 0;
  /* FIX: Prevenir overflow de paginación */
  max-width: 100%;
  overflow-x: auto;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: 12px 16px;
  background: white;
  color: var(--primario);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 44px;
  border: 1px solid var(--gris-4);
  /* FIX: Prevenir shrinking excesivo */
  flex-shrink: 0;
}

.pagination-link:hover:not(.disabled) {
  background: var(--gris-5);
  color: var(--primario-oscuro);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border-color: var(--primario-oscuro);
}

.pagination-link.active {
  background: var(--primario);
  color: white;
  border-color: var(--primario);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pagination-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--gris-3);
}

.pagination-dots {
  color: var(--gris-2);
  font-weight: 500;
  padding: 0 var(--spacing-xs);
}
