/* ==========================================================================
   1. TOKENS DE DISEÑO (VARIABLES GLOBALES)
   ========================================================================== */
:root {
  /* Paleta de Colores - Ecar */
  --color-brand-primary: #2bae50;
  --color-brand-dark: #218c40;
  --color-brand-light: #eaf7ed;
  --color-brand-neon: #34d05f;

  /* Escala de Grises y Neutros */
  --color-text-main: #1a1a1a;
  --color-text-muted: #6c757d;
  --color-bg-body: #f8f9fa;
  --color-bg-surface: #ffffff;
  --color-border: #eaeaea;
  --color-border-hover: #d1d1d1;

  /* Espaciados (Spacing Scale) */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  /* Sombras y Elevación */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-brand: 0 10px 30px rgba(43, 174, 80, 0.15);
  --shadow-focus: 0 0 0 3px rgba(43, 174, 80, 0.4);

  /* Animaciones y Transiciones */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Layout */
  --max-width-container: 1400px;
  --max-width-content: 1200px;
  --height-navbar: 75px;
}

/* ==========================================================================
   2. RESETEO MODERNO Y NORMALIZACIÓN ABSOLUTA
   ========================================================================== */
/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Evitar márgenes por defecto y padding */
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
  padding: 0;
}

/* Comportamiento del scroll y altura mínima */
html {
  scroll-behavior: smooth;
  /* Evita que el navbar fijo tape el contenido al hacer anclas (#) */
  scroll-padding-top: calc(var(--height-navbar) + 20px);
}

body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.6;
  font-family:
    "Montserrat",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--color-text-main);
  background-color: var(--color-bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accesibilidad: Quitar animaciones si el usuario lo prefiere a nivel SO */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Medias y elementos integrados responsivos */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
  font-style: italic; /* Por si falla la carga, el texto alt se ve distinto */
}

/* Quitar estilos de listas por defecto en elementos que sean listas */
ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

/* Formularios más limpios y consistentes */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  border: none;
  background: transparent;
  margin: 0;
}

/* Evitar que los enlaces de ancla se comporten raro */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Enfoque accesible universal */
:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 4px;
}

/* Selección de texto */
::selection {
  background-color: var(--color-brand-primary);
  color: var(--color-bg-surface);
}

/* ==========================================================================
   3. TIPOGRAFÍA BASE (EL HTML5 OUTLINE FIX)
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-main);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}
h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}
h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}
h4 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}
h5 {
  font-size: 1.1rem;
}
h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--space-md);
  max-width: 70ch; /* Longitud de línea ideal para lectura */
}

/* Títulos de sección estandarizados */
.section-title {
  font-size: clamp(2rem, 5vw, 2.5rem);
  text-align: center;
  margin-bottom: var(--space-3xl);
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-text-main);
}

.section-title::after {
  content: "";
  position: absolute;
  width: 60px;
  height: 4px;
  background: var(--color-brand-primary);
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
}

/* ==========================================================================
   4. UTILERÍAS Y LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.center {
  text-align: center;
}

.btn-main,
.btn-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: linear-gradient(
    135deg,
    var(--color-brand-primary) 0%,
    var(--color-brand-neon) 100%
  );
  color: var(--color-bg-surface) !important;
  font-weight: 700;
  border-radius: 50px;
  transition: all var(--transition-bounce);
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(43, 174, 80, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 2px solid transparent;
}

.btn-main:hover,
.btn-more:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(43, 174, 80, 0.4);
}

.btn-main:active,
.btn-more:active {
  transform: translateY(1px);
}

/* ==========================================================================
   5. COMPONENTE: NAVBAR (GLASSMORPHISM)
   ========================================================================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5%;
  height: var(--height-navbar);
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  transition: background-color var(--transition-base);
}

.logo a {
  display: block;
}

.logo img {
  height: 45px;
  width: auto;
  transition: transform var(--transition-bounce);
}

.logo img:hover {
  transform: scale(1.05);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-links li a {
  color: var(--color-text-main);
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
  padding: var(--space-sm) 0;
  transition: color var(--transition-base);
}

.nav-links li a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--color-brand-primary);
  transition: width var(--transition-base);
}

.nav-links li a:hover,
.nav-links li a:focus-visible {
  color: var(--color-brand-primary);
  outline: none;
}
.nav-links li a:hover::after,
.nav-links li a:focus-visible::after {
  width: 100%;
}

/* ==========================================================================
   6. COMPONENTE: HERO SLIDER
   ========================================================================== */
.hero-slider {
  position: relative;
  height: 70vh;
  min-height: 500px;
  max-height: 800px;
  overflow: hidden;
  background-color: var(--color-text-main); /* Fallback mientras carga img */
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.slide.active {
  opacity: 1;
  z-index: 2;
}

.hero-content {
  text-align: center;
  color: var(--color-bg-surface);
  max-width: 800px;
  padding: var(--space-xl);
  transform: translateY(30px);
  transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.hero-content h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: var(--space-md);
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.6);
  color: var(--color-bg-surface);
}

.hero-content p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: var(--space-xl);
  text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.6);
  margin-left: auto;
  margin-right: auto;
}

.slide.active .hero-content {
  transform: translateY(0);
}

/* ==========================================================================
   7. COMPONENTE: CATÁLOGO Y FILTROS
   ========================================================================== */
.catalog {
  padding: var(--space-3xl) 5%;
  max-width: var(--max-width-container);
  margin: 0 auto;
}

.category-title {
  border-bottom: 2px solid var(--color-brand-primary);
  padding-bottom: var(--space-sm);
  display: inline-block;
  margin-bottom: var(--space-xl);
}

.category-block {
  margin-bottom: var(--space-3xl);
}

.filter-pills {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3xl);
}

.pill {
  padding: 12px 24px;
  background: var(--color-bg-surface);
  border: 2px solid var(--color-border);
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all var(--transition-base);
  user-select: none;
}

.pill:hover,
.pill.active,
.pill:focus-visible {
  background: var(--color-brand-primary);
  color: var(--color-bg-surface);
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   8. COMPONENTE: TARJETAS DE PRODUCTO (GRID)
   ========================================================================== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 40px 30px;
}

.product-card {
  background: var(--color-bg-surface);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition-bounce);
  border: 1px solid var(--color-border);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card a {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card:hover,
.product-card:focus-within {
  transform: translateY(-8px);
  box-shadow: var(--shadow-brand);
  border-color: rgba(43, 174, 80, 0.4);
}

.product-img-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--color-bg-body);
  overflow: hidden;
}

.product-img-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    opacity 0.4s ease,
    transform 0.6s ease;
}

.img-hover {
  opacity: 0;
  transform: scale(1.05);
}

.product-card:hover .img-base,
.product-card:focus-within .img-base {
  opacity: 0;
  transform: scale(0.97);
}

.product-card:hover .img-hover,
.product-card:focus-within .img-hover {
  opacity: 1;
  transform: scale(1);
}

.product-card p {
  padding: var(--space-lg) var(--space-md);
  font-weight: 700;
  text-align: center;
  margin: auto 0 0 0;
  color: var(--color-text-main);
  transition: color var(--transition-base);
}

.product-card:hover p,
.product-card:focus-within p {
  color: var(--color-brand-dark);
}

/* ==========================================================================
   9. COMPONENTE: VISTA DETALLE DE PRODUCTO
   ========================================================================== */
.product-detail {
  padding: var(--space-3xl) 5%;
}

.product-detail .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 60px;
  align-items: start;
}

.product-gallery {
  position: sticky;
  top: calc(var(--height-navbar) + 20px);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.main-image {
  width: 100%;
  border-radius: 12px;
  background: var(--color-bg-surface);
  overflow: hidden;
  border: 1px solid var(--color-border);
  aspect-ratio: 4 / 5;
  cursor: crosshair;
  position: relative;
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
}

.thumbnail-list {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid var(--color-border);
  transition: all var(--transition-bounce);
  background-color: var(--color-bg-surface);
}

.thumbnail:hover,
.thumbnail.active,
.thumbnail:focus-visible {
  border-color: var(--color-brand-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.product-info {
  display: flex;
  flex-direction: column;
}

.product-info h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: var(--space-sm);
}

.product-category {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-md);
}

.product-description {
  font-size: 1.1rem;
  color: var(--color-text-main);
  margin-bottom: var(--space-2xl);
}

/* ==========================================================================
   10. COMPONENTE: FOOTER PREMIUM
   ========================================================================== */
.footer {
  background: #0a0a0a; /* Fondo ultra oscuro para resaltar el logo blanco */
  color: var(--color-bg-surface);
  padding: var(--space-3xl) 5% var(--space-xl);
  position: relative;
  margin-top: auto; /* Empuja el footer abajo si hay poco contenido */
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--color-brand-primary),
    var(--color-brand-neon)
  );
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 50px;
  margin-bottom: var(--space-3xl);
  max-width: var(--max-width-container);
  margin-left: auto;
  margin-right: auto;
}

.footer-logo {
  width: 100%;
  max-width: 180px;
  margin-bottom: var(--space-lg);
  background: transparent; /* Se ve el PNG en su esplendor */
  display: block;
}

.footer h3 {
  color: var(--color-bg-surface);
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
}

.footer h4 {
  color: var(--color-brand-primary);
  margin-bottom: var(--space-lg);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1.1rem;
}

.footer p {
  color: #a0a0a0;
  margin-bottom: var(--space-sm);
}

.footer ul li {
  margin-bottom: var(--space-sm);
}

.footer ul li a,
.footer p a {
  color: #a0a0a0;
  transition:
    color var(--transition-base),
    transform var(--transition-base);
  display: inline-block;
}

.footer ul li a:hover,
.footer ul li a:focus-visible,
.footer p a:hover,
.footer p a:focus-visible {
  color: var(--color-brand-neon);
  transform: translateX(4px);
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-xl);
  color: #777;
  font-size: 0.9rem;
}

/* ==========================================================================
   11. MEDIA QUERIES (RESPONSIVE DESIGN)
   ========================================================================== */
@media screen and (max-width: 992px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .product-detail .container {
    gap: 40px;
  }
}

@media screen and (max-width: 768px) {
  :root {
    --height-navbar: auto; /* Permite que el navbar crezca en móvil */
  }

  .navbar {
    flex-direction: column;
    padding: var(--space-md) var(--space-xl);
  }

  .nav-links {
    margin-top: var(--space-md);
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
  }

  .hero-slider {
    height: 60vh;
    min-height: 400px;
  }

  .product-detail .container {
    grid-template-columns: 1fr;
  }

  .product-gallery {
    position: relative;
    top: 0;
  }

  .footer-grid {
    text-align: center; /* Centrar contenido del footer en móvil */
  }

  .footer-logo {
    margin-left: auto;
    margin-right: auto;
  }

  .footer ul li a:hover,
  .footer ul li a:focus-visible {
    transform: translateY(
      -2px
    ); /* Cambia el hover horizontal por vertical en móvil */
  }
}

@media screen and (max-width: 480px) {
  .grid-container {
    grid-template-columns: 1fr;
  }

  .product-img-container {
    aspect-ratio: 1 / 1;
  }

  .thumbnail {
    width: 60px;
    height: 60px;
  }
}

/* ==========================================================================
   CARRUSEL DE DESTACADOS
   ========================================================================== */
.featured-carousel {
  padding: var(--space-3xl) 0;
  background-color: var(--color-bg-surface);
  overflow: hidden; /* Corta los clones que salen del viewport */
}

.carousel-wrapper {
  position: relative;
  width: 100%;
  cursor: grab;
}

.carousel-wrapper:active {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  gap: var(--space-xl);
  overflow-x: auto;
  padding: var(--space-xl) 0;
  scrollbar-width: none; /* Oculta scrollbar en Firefox */
  -ms-overflow-style: none; /* Oculta scrollbar en IE/Edge */
}

.carousel-track::-webkit-scrollbar {
  display: none; /* Oculta scrollbar en Chrome/Safari */
}

.carousel-item {
  flex: 0 0 280px; /* Ancho fijo para cada producto */
  transition: transform var(--transition-base);
}

/* Pausar animación al pasar el mouse por toda la sección */
.carousel-wrapper:hover .carousel-track {
  animation-play-state: paused;
}

.filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: bold;
  font-size: 0.9rem;
}

.filter-group select {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  min-width: 180px;
}

.clear-btn {
  background: #333;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.clear-btn:hover {
  background: #555;
}

.btn-mode {
    background: #f0f0f0;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 1rem;
}
.btn-mode.active {
    background-color: var(--color-brand-primary);
    color: #ffffff;
}
.opciones {
  background-color: var(--color-bg-body);
  color: #0a0a0a;
  appearance: none;
  padding-right: 2.5rem;
}


/* Botón flotante WhatsApp */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
    opacity: 1;
    visibility: visible;
}

.whatsapp-float a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.whatsapp-float a:hover {
    transform: scale(1.1);
    background-color: #128C7E;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Ocultar botón flotante cuando el footer está visible */
.whatsapp-float.hide {
    opacity: 0;
    visibility: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
    }
    .whatsapp-float a {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
}