/* Variables CSS para colores corporativos */
:root {
  --color-primary: #436092;
  --color-secondary: #f39200;
  --color-primary-light: #5a7bb8;
  --color-secondary-light: #ff9f1a;
}

/* Hero Section */
.hero-productos {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  position: relative;
  overflow: hidden;
}

.hero-productos::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("/images/pattern-autocaravana.svg") repeat;
  opacity: 0.1;
  z-index: 1;
}

.hero-productos > * {
  position: relative;
  z-index: 2;
}

/* Barra de búsqueda */
#buscadorProductos {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#buscadorProductos:focus {
  box-shadow: 0 4px 12px rgba(67, 96, 146, 0.15);
}

/* === NUEVO SISTEMA DE FILTROS MOBILE-FIRST === */

.filtros-container {
  width: 100%;
}

.filtro-seccion {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
}

.filtro-titulo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filtros-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Scroll indicators sutiles */
.filtros-scroll::-webkit-scrollbar {
  height: 4px;
}

.filtros-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 2px;
}

.filtros-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.filtros-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Botones de filtro optimizados para móvil */
.categoria-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  background-color: white;
  color: #374151;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.875rem;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 44px; /* Mínimo recomendado para touch */
  touch-action: manipulation;
}

.categoria-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.categoria-btn:hover::before {
  left: 100%;
}

.categoria-btn:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 96, 146, 0.15);
}

.categoria-btn:active {
  transform: translateY(0);
}

/* Estados activos específicos por sección */
.categoria-btn.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(67, 96, 146, 0.3);
}

/* Botón de favoritos con estilo especial */
.favoritos-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-color: #ef4444;
}

.favoritos-btn:hover {
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.favoritos-btn.active {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* Etiquetas con colores sutiles */
.etiqueta-btn.active {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-light) 100%);
  color: white;
  border-color: var(--color-secondary);
  box-shadow: 0 4px 12px rgba(243, 146, 0, 0.3);
}

.contador {
  background-color: rgba(255, 255, 255, 0.2);
  color: inherit;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.5rem;
  text-align: center;
}

.categoria-btn.active .contador {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Indicadores de scroll en móvil */
.filtro-seccion::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 100%;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.8), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.filtro-seccion:hover::after {
  opacity: 1;
}

/* Responsive Design */
@media (min-width: 640px) {
  .filtro-titulo {
    font-size: 1.125rem;
  }

  .categoria-btn {
    font-size: 0.9rem;
    padding: 0.875rem 1.25rem;
  }

  .filtros-scroll {
    gap: 0.75rem;
  }
}

@media (min-width: 768px) {
  .filtros-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .filtro-seccion {
    padding: 1.5rem;
  }

  .filtros-scroll {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .filtro-seccion::after {
    display: none;
  }
}

@media (min-width: 1024px) {
  .filtros-container {
    grid-template-columns: 1fr;
  }

  .categoria-btn {
    font-size: 1rem;
  }
}

/* Grid de productos FORZADO - Sobrescribir Tailwind */
.productos-grid-custom {
  display: grid !important;
  gap: 1.5rem !important;
  grid-template-columns: 1fr !important;
  width: 100% !important;
}

/* Forzar responsive breakpoints */
@media (min-width: 480px) {
  .productos-grid-custom {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 768px) {
  .productos-grid-custom {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  .productos-grid-custom {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (min-width: 1280px) {
  .productos-grid-custom {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Asegurar que las tarjetas no se estiren */
.producto-card {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Alternativa con flexbox si grid no funciona */
.productos-grid-custom.flex-fallback {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 1.5rem !important;
}

.productos-grid-custom.flex-fallback .producto-card {
  flex: 1 1 calc(25% - 1.125rem) !important;
  min-width: 280px !important;
  max-width: calc(25% - 1.125rem) !important;
}

@media (max-width: 1279px) {
  .productos-grid-custom.flex-fallback .producto-card {
    flex: 1 1 calc(33.333% - 1rem) !important;
    max-width: calc(33.333% - 1rem) !important;
  }
}

@media (max-width: 1023px) {
  .productos-grid-custom.flex-fallback .producto-card {
    flex: 1 1 calc(50% - 0.75rem) !important;
    max-width: calc(50% - 0.75rem) !important;
  }
}

@media (max-width: 767px) {
  .productos-grid-custom.flex-fallback .producto-card {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
}

/* Tarjetas de producto mejoradas */
.producto-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.producto-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(67, 96, 146, 0.15);
}

.producto-imagen {
  position: relative;
  overflow: hidden;
}

/* Botón de favoritos */
.btn-favorito {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
  touch-action: manipulation;
}

.btn-favorito:hover {
  background: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-favorito svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #ef4444;
  transition: all 0.2s ease;
}

.btn-favorito.favorito .corazon-vacio {
  display: none;
}

.btn-favorito.favorito .corazon-lleno {
  display: block;
}

.btn-favorito:not(.favorito) .corazon-lleno {
  display: none;
}

.btn-favorito:not(.favorito) .corazon-vacio {
  display: block;
}

.producto-contenido {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.producto-titulo {
  margin-bottom: 0.75rem;
}

.producto-titulo a {
  color: var(--color-primary);
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.4;
  display: block;
  transition: color 0.2s ease;
}

.producto-titulo a:hover {
  color: var(--color-secondary);
}

.producto-descripcion {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
  flex-grow: 1;
  margin-bottom: 1rem;
}

.producto-precio {
  color: var(--color-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.producto-acciones {
  margin-top: auto;
}

/* Botones de acción mejorados */
.btn-producto {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  width: 100%;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-producto::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-producto:hover::before {
  left: 100%;
}

.btn-afiliado {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
}

.btn-afiliado:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 96, 146, 0.3);
}

.btn-stripe {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-light) 100%);
  color: white;
}

.btn-stripe:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(243, 146, 0, 0.3);
}

.btn-shopify {
  background: linear-gradient(135deg, #96bf48 0%, #7ba428 100%);
  color: white;
}

.btn-shopify:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(150, 191, 72, 0.3);
}

/* Resaltado de búsqueda */
.highlight {
  background-color: #fef3c7;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

/* Animaciones de entrada */
.bloque-categoria {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estados de carga */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* === BADGES SISTEMA === */
.badges-container {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: calc(100% - 4rem); /* Espacio para botón favoritos */
}

/* Posiciones configurables */
.badges-top-left {
  top: 0.75rem;
  left: 0.75rem;
}

.badges-top-center {
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

.badges-bottom-left {
  bottom: 0.75rem;
  left: 0.75rem;
}

.badges-bottom-right {
  bottom: 0.75rem;
  right: 0.75rem;
}

.badges-bottom-center {
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

/* Estilos base de badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(4px);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Colores específicos por etiqueta */
.badge-mas-vendido {
  background-color: #ef4444;
}
.badge-mejor-valorado {
  /*background-color: #f59e0b;*/
  background-color: #7dc48b;
}
.badge-novedad {
  background-color: #10b981;
}
.badge-oferta {
  background-color: #8b5cf6;
}
.badge-recomendado {
  background-color: #436092;
}
.badge-esencial {
  background-color: #dc2626;
}
.badge-premium {
  background-color: #7c3aed;
}
.badge-eco {
  background-color: #059669;
}
.badge-obligatorio {
  background-color: #dc2626;
}
.badge-invierno {
  background-color: #3b82f6;
}
.badge-principiante {
  background-color: #f97316;
}
.badge-amazon-prime {
  background-color: #FF9900; /* Naranja Amazon */
  /*background-color: #232f3e; /* Azul oscuro Amazon */
  /*background-color: #00A8E1; /* Azul celeste Amazon */
}


/* Badges en página de detalle */
.badges-detalle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.badge-detalle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Colores para badges de detalle (mismo esquema) */
.badge-detalle.badge-mas-vendido {
  background-color: #ef4444;
}
.badge-detalle.badge-mejor-valorado {
  /*background-color: #f59e0b;*/
  background-color: #7dc48b;
}
.badge-detalle.badge-novedad {
  background-color: #10b981;
}
.badge-detalle.badge-oferta {
  background-color: #8b5cf6;
}
.badge-detalle.badge-recomendado {
  background-color: #436092;
}
.badge-detalle.badge-esencial {
  background-color: #dc2626;
}
.badge-detalle.badge-premium {
  background-color: #7c3aed;
}
.badge-detalle.badge-eco {
  background-color: #059669;
}
.badge-detalle.badge-obligatorio {
  background-color: #dc2626;
}
.badge-detalle.badge-invierno {
  background-color: #3b82f6;
}
.badge-detalle.badge-principiante {
  background-color: #f97316;
}
.badge-detalle.badge-amazon-prime {
  background-color: #FF9900; /* Naranja Amazon */
  /*background-color: #232f3e; /* Azul oscuro Amazon */
  /*background-color: #00A8E1; /* Azul celeste Amazon */
}

/* Responsive Design para móviles */
@media (max-width: 640px) {
  .filtro-seccion {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  .filtro-titulo {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .categoria-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.8rem;
    min-height: 40px;
  }

  .contador {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
  }

  .producto-contenido {
    padding: 1rem;
  }

  .hero-productos .container {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .hero-productos h1 {
    font-size: 2rem;
  }

  .hero-productos p {
    font-size: 1rem;
  }

  .btn-favorito {
    width: 2rem;
    height: 2rem;
  }

  .btn-favorito svg {
    width: 1rem;
    height: 1rem;
  }

  .badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
  }

  .badges-container {
    max-width: calc(100% - 3rem);
  }

  .badge-detalle {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
  }
  
  .breadcrumbs { font-size: .75rem; }
}

/* Mejoras de accesibilidad */
.categoria-btn:focus,
.btn-producto:focus,
.btn-favorito:focus {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Smooth scroll para las secciones de filtros */
.filtros-scroll {
  scroll-snap-type: x mandatory;
}

.categoria-btn {
  scroll-snap-align: start;
}

/* Estados de focus mejorados para accesibilidad */
.categoria-btn:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px white, 0 0 0 5px var(--color-secondary);
}

/* Animación sutil para cambios de estado */
.filtros-scroll {
  transition: opacity 0.2s ease;
}

.loading .filtros-scroll {
  opacity: 0.7;
}

.breadcrumbs { font-size: .875rem; color: #6b7280; }
.breadcrumbs a { color: var(--color-primary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--color-secondary); }
.breadcrumbs .sep { margin: 0 .5rem; opacity: .6; }

/* === Barra superior de controles (buscador + favoritos) === */
.barra-controles {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.barra-controles .bc-busqueda { order: 1; }
.barra-controles .bc-favoritos { order: 2; }

/* Desktop: en una fila, con buscador ancho y favoritos a la derecha */
@media (min-width: 1024px) {
  .barra-controles {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }
  .barra-controles .bc-busqueda { order: 1; }
  .barra-controles .bc-favoritos { order: 2; }
}

/* Ajuste visual del botón de favoritos para esta barra */
.barra-controles .favoritos-btn {
  padding: 0.625rem 1rem;
}

@media (max-width: 640px) {
  iframe[title="Suscripción a novedades de Productos Recomendados"] {
    height: 420px !important;
  }
}

