/* Estilos generales */
:root {
  --primary-color: #0077b6;
  --secondary-color: #00b4d8;
  --dark-color: #03045e;
  --light-color: #caf0f8; /* Celeste muy claro para fondos o acentos suaves */
  --gray-color: #f8f9fa; /* Gris claro para fondos de secciones */
  --text-color: #333;
  --text-light: #f8f9fa;
  --white-color: #fff;
  --danger-color: #c62828;
  --success-color: #2e7d32;
  --stock-bg-in: #e8f5e9;
  --stock-bg-out: #ffebee;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--white-color);
}

a {
  text-decoration: none;
  color: var(--primary-color);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.btn {
  display: inline-block;
  background: var(--primary-color);
  color: var(--white-color);
  padding: 12px 25px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s ease, transform 0.2s ease;
}

.btn:hover {
  background: var(--dark-color);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* Header */
header {
  background-color: var(--white-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 70px;
}

.logo {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary-color);
}

.logo span {
  color: var(--secondary-color);
}

nav#main-nav ul {
  /* Especificidad aumentada */
  display: flex;
}

nav#main-nav ul li {
  margin-left: 30px;
}

nav#main-nav ul li a {
  font-weight: 500;
  transition: color 0.3s ease;
  padding: 5px 0;
  color: var(--dark-color);
}

nav#main-nav ul li a:hover,
nav#main-nav ul li a.active-link {
  /* Para futura implementación de link activo */
  color: var(--secondary-color);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--primary-color);
  padding: 10px;
}

/* Hero Section */
.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white-color);
  margin-top: 70px;
  position: relative;
  overflow: hidden;
  padding: 40px 0;
}

.hero::before {
  content: "";
  position: absolute;
  top: -10px;
  right: -10px;
  bottom: -10px;
  left: -10px;
  background: linear-gradient(rgba(3, 4, 94, 0.65), rgba(3, 4, 94, 0.8)),
    url("../imagenes/sir.jpg");
  background-size: cover;
  background-position: center;
  filter: blur(4px);
  z-index: -1;
}

.hero-content {
  max-width: 800px;
  position: relative;
  z-index: 1;
  padding: 20px;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3rem);
  margin-bottom: 20px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}

.hero p {
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  margin-bottom: 30px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Sections General */
.section {
  padding: 70px 0;
}
.section:nth-of-type(even) {
  /* Alternar fondo para algunas secciones */
  background-color: var(--gray-color);
}

.section-title {
  text-align: center;
  margin-bottom: 50px;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  color: var(--primary-color);
  font-weight: 600;
}

/* About Section */
.about-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px;
}

.about-text {
  flex: 1;
  min-width: 300px;
}
.about-text p {
  margin-bottom: 15px;
}

.about-image {
  flex: 1;
  min-width: 300px;
  text-align: center; /* Centrar imagen si el contenedor es más grande */
}

.about-image img {
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Products Section */
.products {
  background-color: var(--white-color); /* O mantener el fondo alterno */
}

.search-container {
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
}

#search-bar {
  width: 100%;
  max-width: 600px;
  padding: 14px 20px;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-bar:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--light-color), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
}

.products-grid .error-message,
.products-grid .no-products-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 15px;
  font-size: 1.1rem;
  color: #555;
  background-color: var(--gray-color);
  border-radius: 8px;
}

.products-grid .error-message {
  color: var(--danger-color);
  font-weight: 500;
}

.product-card {
  background: var(--white-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.product-image {
  height: 220px;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.08);
}

.product-info {
  padding: 20px;
  flex-grow: 1; /* Asegura que el contenido empuje el footer de la card hacia abajo */
  display: flex;
  flex-direction: column;
}

.product-brand {
  color: var(--secondary-color);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 5px;
  display: block;
}

.product-name {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--dark-color);
  font-weight: 600;
  line-height: 1.3;
}

.product-model {
  color: #777;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: block;
}

.product-description {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 15px;
  line-height: 1.5;
  flex-grow: 1; /* Permite que la descripción ocupe el espacio disponible */
}

.product-price {
  font-weight: bold;
  font-size: 1.4rem;
  color: var(--primary-color);
  margin: 10px 0 15px 0;
}

.product-stock {
  display: inline-block;
  align-self: flex-start; /* Alinea el stock a la izquierda */
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}
.product-stock:not(.out) {
  /* Estilo para "En stock" */
  background: var(--stock-bg-in);
  color: var(--success-color);
}

.product-stock.out {
  /* Estilo para "Agotado" */
  background: var(--stock-bg-out);
  color: var(--danger-color);
}

.btn-whatsapp {
  background-color: #25d366; /* Color verde de WhatsApp */
  color: white;
  margin-top: 10px; /* Un poco de espacio arriba */
  display: inline-block; /* Para que el padding y margin funcionen bien */
  text-align: center; /* Centrar el texto e ícono */
}

.btn-whatsapp:hover {
  background-color: #1dae50; /* Un verde un poco más oscuro al pasar el mouse */
}

.btn-whatsapp .fab.fa-whatsapp {
  /* Estilo para el ícono dentro del botón */
  margin-right: 8px;
}

/* Contact Section */
.contact-form {
  max-width: 650px;
  margin: 0 auto;
  background: var(--white-color);
  padding: 35px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}
.section.products + .section#contacto {
  /* Si la sección de contacto está después de productos con fondo blanco */
  background-color: var(--gray-color);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--light-color);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* Footer */
footer {
  background-color: var(--dark-color);
  color: var(--text-light);
  padding: 60px 0 25px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 35px;
  margin-bottom: 40px;
}

.footer-column h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--secondary-color);
  font-weight: 600;
}

.footer-column p,
.footer-column ul li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #ccc;
  margin-bottom: 8px;
}

.footer-column ul li a {
  color: #ddd;
  transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-column ul li a:hover {
  color: var(--secondary-color);
  padding-left: 5px;
}

.social-links {
  display: flex;
  gap: 18px;
}

.social-links a {
  color: var(--white-color);
  font-size: 1.6rem;
  transition: color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
  color: var(--secondary-color);
  transform: scale(1.15) translateY(-2px);
}

.copyright {
  text-align: center;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  color: #aaa;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-container {
    padding: 0 15px;
    min-height: 60px;
  }

  nav#main-nav {
    position: fixed;
    top: 60px;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 60px);
    background: var(--white-color);
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.15);
    transition: left 0.35s ease-in-out;
    overflow-y: auto;
    z-index: 999;
  }

  nav#main-nav.active {
    left: 0;
  }

  nav#main-nav ul {
    flex-direction: column;
    padding: 10px 0;
  }

  nav#main-nav ul li {
    margin: 0;
  }
  nav#main-nav ul li a {
    display: block;
    padding: 15px 25px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1rem;
  }
  nav#main-nav ul li:last-child a {
    border-bottom: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .hero {
    min-height: 60vh;
    margin-top: 60px;
  }

  .hero::before {
    filter: blur(3px);
  }

  .section {
    padding: 60px 15px;
  }

  .about-content {
    flex-direction: column;
    gap: 30px;
  }
  .about-image {
    margin-top: 20px;
  }
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-column {
    margin-bottom: 25px;
  }
  .social-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
  }

  .hero p {
    font-size: clamp(1rem, 5vw, 1.2rem);
  }

  .section-title {
    font-size: clamp(1.6rem, 7vw, 2rem);
  }

  .products-grid {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .contact-form {
    padding: 25px;
  }
  #search-bar {
    padding: 12px 18px;
    font-size: 0.95rem;
  }
  .btn {
    padding: 10px 20px;
    font-size: 0.95rem;
  }
}

.btn-pay {
    background-color: var(--primary-color); /* Usamos el color primario para el botón de pago */
    color: white;
    margin-top: 10px;
    width: 100%; /* Para que ocupe todo el ancho disponible */
}

.btn-pay:hover {
    background-color: var(--dark-color);
}

/* Estilo para cuando el botón está desactivado (sin stock o procesando) */
.btn-pay:disabled {
    background-color: #a0a0a0; /* Un color gris */
    cursor: not-allowed;
    transform: none; /* Quitamos el efecto de hover */
}