:root {
  --primary-color: #1e3a8a;
  --secondary-color: #3b82f6;
  --accent-color: #fbbf24;
  --background-gradient-start: #e0f2fe;
  --background-gradient-end: #c7d2fe;
  --text-color: #4b5563;
  --text-color-light: #e0e7ff;
  --white: #ffffff;
  --success-color: #22c55e;
  --error-color: #dc2626;
  --error-background: #fee2e2;
  --success-background: #bbf7d0;
  --border-color: #e0e7ef;
  --button-hover-color: #1e40af;
  --remove-btn-background: #e20000;
  --remove-btn-hover-text: #ff0000;
  --clear-cart-btn-background: #ef4444;
  --clear-cart-btn-hover-background: #b91c1c;
  --whatsapp-green: #25d366;
  --whatsapp-green-dark: #128c7e;
  --price-color: #219ebc;
  --input-background: #f1f5f9;
  --form-error-border: #fca5a5;
  --form-success-text: #166534;
  --form-success-border: #4ade80;
  --error-border: crimson;
  --error-background-dark: #2c2c2c;
  --btn-up-background: #555;
  --btn-up-hover-background: #007bff;
}

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(
    to bottom right,
    var(--background-gradient-start),
    var(--background-gradient-end)
  );
  color: var(--text-color);
  margin: 0;
  padding: 0;

  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

header {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: var(--white);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
}

nav a {
  color: white;
  text-decoration: none;
  transition: color 0.3s;
  font-size: 1.1rem;
}

nav a:hover {
  color: var(--accent-color);
}

main {
  padding: 2rem;
}

section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

footer {
  background: var(--primary-color);
  color: var(--white);
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

/*redes sociales*/
.social-label {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--text-color-light);
}
.social-icons {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}
.social-link {
  color: var(--white); /* íconos en blanco */
  font-size: 1.4rem;
  transition:
    transform 0.3s ease,
    color 0.3s ease;
}
.social-link:hover {
  color: var(--text-color-light); /* un azul claro o blanco suave al pasar */
  transform: scale(1.2); /* animación de escala */
}

.logo {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--accent-color);
}

figure {
  position: relative;
  width: 100%;
  height: auto;
  margin: 0;
}
figure img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.section-content {
  display: none;
}
.section-content.active {
  display: block;
}

.About-text {
  font-size: 20px;
  line-height: 1.75;
  margin-top: 1rem;
}

#product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.product-card {
  display: grid;
  grid-template-columns: auto;
  place-items: center;

  background: var(--white);
  border-radius: 1rem;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.1);
  padding: 1.5rem 1rem 1.5rem 1rem;
  width: 260px;
  text-align: center;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  border: 1px solid var(--border-color);
  position: relative;
}
.product-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 8px 24px rgba(30, 58, 138, 0.18);
}
.product-card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: 0.7rem;
  margin-bottom: 1rem;
}
.product-card h3 {
  margin: 0.5rem 0 0.25rem 0;
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 700;
}
.product-card .existencia {
  margin: 0.5rem 0 0.25rem 0;
  font-size: 0.875rem;
  color: red;
  font-weight: 100;
}
.product-card p {
  color: var(--text-color);
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  text-align: justify;
  min-height: 48px;
}
.product-card .precio {
  display: block;
  margin: 0.5rem 0 1rem 0;
  font-weight: bold;
  color: var(--price-color);
  font-size: 1.25rem;
}
.product-card button {
  width: 100px;
  background: var(--secondary-color);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}
.product-card button:hover {
  background: var(--button-hover-color);
  transform: scale(1.05);
}
.product-card button.added {
  background: var(--success-color);
  color: var(--white);
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--success-background);
  transition:
    background 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

/* Modal overlay */
.modal-img {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}
.modal-img img {
  max-width: 85%;
  max-height: 85%;
  border-radius: 1rem;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
}
.cerrar-modal {
  position: absolute;
  top: 2rem;
  right: 2.5rem;
  font-size: 2rem;
  color: var(--white);
  cursor: pointer;
}

/*Formualrio de Contacto*/
#contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}
#contact-form input,
#contact-form textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: var(--input-background);
  transition: border 0.2s;
  resize: none;
}
#contact-form textarea {
  field-sizing: content;
}
#contact-form input:focus,
#contact-form textarea:focus {
  border: 1.5px solid var(--secondary-color);
  outline: none;
  background: var(--white);
  transition: border 0.3s ease;
}
#contact-form button {
  background: var(--secondary-color);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}
#contact-form button:hover {
  background: var(--button-hover-color);
  transform: scale(1.05);
}

.form-error {
  color: var(--error-color);
  background: var(--error-background);
  border: 1px solid var(--form-error-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  text-align: center;
  font-weight: 500;
}
.form-success {
  color: var(--form-success-text);
  background: var(--success-background);
  border: 1px solid var(--form-success-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  text-align: center;
  font-weight: 500;
}
input.error,
textarea.error {
  border: 2px solid var(--error-border);
  background-color: var(--error-background-dark);
}

.mapa-contacto {
  margin-top: 2rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cart-indicator {
  font-size: 1.3rem;
  background: var(--accent-color);
  color: var(--primary-color);
  padding: 0.3rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  margin-right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
#cart-count {
  font-size: 1.1rem;
}

/*Carrito de compras*/
.cart-panel {
  position: fixed;
  top: 0;
  right: -325px;
  width: 100%;
  max-width: 325px;
  height: 100vh; /* ocupa todo el viewport */
  background: var(--white);
  box-shadow: -4px 0 24px rgba(30, 58, 138, 0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 2rem 0 0 0;
}
.cart-panel.open {
  right: 0;
  box-shadow: -8px 0 32px rgba(30, 58, 138, 0.18);
}
.cart-panel-content {
  padding: 0 1.5rem;
}
.cart-panel h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}
#cart-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  overflow-y: auto;
  max-height: 50vh; /* controla cuánto puede crecer */
}
#cart-list li {
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}
.close-cart-btn {
  background: var(--secondary-color);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.close-cart-btn:hover {
  background: var(--button-hover-color);
}
.whatsapp-btn {
  background-color: var(--whatsapp-green); /* WhatsApp green */
  color: var(--white);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.whatsapp-btn:hover {
  background-color: var(--whatsapp-green-dark); /* Darker green on hover */
}
.remove-btn {
  background: var(--remove-btn-background);
  border-radius: 5px;
  color: var(--white);
  cursor: pointer;
  font-size: 1rem;
  transition:
    color 0.2s,
    background-color 0.5s;
}
.remove-btn:hover {
  color: var(--remove-btn-hover-text);
  background-color: var(--white);
}

.clear-cart-btn {
  background: var(--clear-cart-btn-background);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-bottom: 0.7rem;
  transition: background 0.2s;
}
.clear-cart-btn:hover {
  background: var(--clear-cart-btn-hover-background);
}

/*menu hamburguesa*/
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--primary-color);
  cursor: pointer;
  margin-left: auto;
}

/*Ventanas emergentes*/
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.toast {
  background: var(--primary-color);
  color: var(--white);
  padding: 1rem 1.5rem;
  border-radius: 0.7rem;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.13);
  font-weight: 600;
  opacity: 0.97;
}

/*Boton hacia*/
#btn-ir-arriba {
  display: none; /* Oculto por defecto */
  position: fixed; /* Posición fija en la pantalla */
  bottom: 20px; /* A 20px del borde inferior */
  right: 30px; /* A 30px del borde derecho */
  z-index: 99; /* Asegura que esté sobre otros elementos */
  border: none; /* Sin borde */
  outline: none; /* Sin el contorno al hacer clic */
  background-color: var(--btn-up-background); /* Color de fondo oscuro */
  color: var(--white); /* Color del texto (flecha) */
  cursor: pointer; /* Cursor de mano al pasar por encima */
  padding: 20px; /* Relleno interno */
  border-radius: 10px; /* Bordes redondeados */
  font-size: 20px; /* Tamaño de la flecha */
  transition:
    background-color 0.3s,
    opacity 0.5s; /* Transiciones suaves */
}
#btn-ir-arriba:hover {
  background-color: var(
    --btn-up-hover-background
  ); /* Cambia de color al pasar el mouse */
}

/* Animaciones suaves */
.section-content {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}
.section-content.active {
  animation: fadeIn 0.6s ease-out forwards;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*media queries para responsividad */
@media (max-width: 900px) {
  #product-grid {
    gap: 1rem;
  }
  .product-card {
    width: 45vw;
    min-width: 180px;
    max-width: 320px;
  }
  .logo {
    font-size: 2rem;
  }
}
@media (max-width: 796px) {
  .logo {
    font-size: 1.5rem;
  }
}
@media (max-width: 715px) {
  nav {
    flex-wrap: wrap;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--white);
    position: absolute;
    top: 60px;
    left: 0;
    box-shadow: 0 4px 16px rgba(30, 58, 138, 0.07);
    z-index: 100;
  }
  .nav-links.open {
    display: flex !important;
  }
  .nav-links.open a {
    color: var(--primary-color);
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    display: block;
    text-align: left;
  }
  .nav-links.open a:hover {
    color: var(--accent-color);
    background: var(--border-color);
  }
  .menu-toggle {
    display: block;
  }
  .cart-indicator {
    margin-left: 0;
  }
  .logo {
    font-size: 1.5rem;
  }
  .About-text {
    font-size: 16px;
    line-height: 1.6;
    margin-top: 1rem;
  }
}
@media (max-width: 600px) {
  #product-grid {
    flex-direction: column;
    align-items: center;
  }
  .product-card {
    width: 95vw;
    min-width: unset;
    max-width: 200px;
  }
  .logo {
    font-size: 1.2rem;
  }
  .About-text {
    font-size: 14px;
    line-height: 1.6;
    margin-top: 1rem;
  }
  .toast {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem 1rem; /* ← reducido */
    border-radius: 0.5rem; /* ← más compacto */
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.1); /* ← sombra más suave */
    font-weight: 500; /* ← ligeramente menos grueso */
    font-size: 0.75rem; /* ← texto más pequeño */
    opacity: 0.92; /* ← opcionalmente menos presente */
    max-width: 260px; /* ← límite visual opcional */
  }
}
