/* ===== VARIABLES CSS ===== */
:root {
  /* Colores principales */
  --primary-purple: #6366f1;
  --secondary-purple: #8b5cf6;
  --accent-pink: #f472b6;
  --light-purple: #c4b5fd;
  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-600: #4b5563;
  --gray-800: #1f2937;

  /* Tipografía */
  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Espaciado */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Bordes y sombras */
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ===== RESET Y BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background: var(--gray-100);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== FONDO DECORATIVO ===== */
.background-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.03;
  background-image: radial-gradient(
      circle at 20% 80%,
      var(--primary-purple) 2px,
      transparent 2px
    ),
    radial-gradient(
      circle at 80% 20%,
      var(--secondary-purple) 2px,
      transparent 2px
    ),
    radial-gradient(circle at 40% 40%, var(--accent-pink) 1px, transparent 1px);
  background-size: 60px 60px, 80px 80px, 40px 40px;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: var(--spacing-lg);
}

/* ===== TARJETA PRINCIPAL ===== */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  display: grid;
  grid-template-columns: 1fr 2fr;
  max-width: 1200px;
  width: 100%;
  height: 80vh;
  max-height: 800px;
  min-height: 600px;
  overflow: hidden;
  animation: slideUp 0.8s ease-out;
}

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

/* ===== ASIDE IZQUIERDO ===== */
.card-aside {
  background: linear-gradient(
    135deg,
    var(--primary-purple) 0%,
    var(--secondary-purple) 100%
  );
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: var(--spacing-xl);
  position: relative;
  overflow: hidden;
}

.card-aside::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 1px,
    transparent 1px
  );
  background-size: 40px 40px;
  animation: rotate 30s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.brand-section {
  text-align: center;
  z-index: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: var(--spacing-lg);
}

.hero-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.hero-image:hover {
  transform: scale(1.02);
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-title {
  font-size: 2.2rem;
  font-weight: var(--font-weight-bold);
  text-transform: none;
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  line-height: 1.2;
}

/* ===== MAIN DERECHO ===== */
.card-main {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.main-content {
  padding: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Estilos personalizados para el scrollbar */
.main-content::-webkit-scrollbar {
  width: 8px;
}

.main-content::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb {
  background: var(--primary-purple);
  border-radius: 4px;
  transition: background 0.3s ease;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-purple);
}

.content-header {
  /* Re-styled to hold the logo and SEO title */
  background: none;
  padding: 0;
  margin: 0 0 var(--spacing-lg) 0;
  text-align: center;
}

.header-logo {
  margin-bottom: var(--spacing-sm);
}

.header-logo img {
  max-height: 108px;
  width: auto;
}

.seo-title {
  font-size: 1.1rem;
  font-weight: var(--font-weight-medium);
  color: var(--gray-600);
  margin: 0;
}

.section-title {
  font-size: 1.6rem;
  font-weight: var(--font-weight-bold);
  background: linear-gradient(135deg, var(--accent-pink) 0%, #f97316 100%);
  color: var(--white);
  padding: var(--spacing-sm);
  border-radius: var(--border-radius);
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  margin-bottom: var(--spacing-md);
}

/* ===== DESCRIPCIÓN ===== */
.description {
  line-height: 1.6;
}

.intro-text {
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
  color: var(--gray-800);
  margin-bottom: var(--spacing-sm);
}

.detail-text {
  color: var(--gray-600);
  font-size: 0.95rem;
}

/* ===== GUÍA DE USO ===== */
.how-to-use {
  padding: var(--spacing-md);
  background-color: var(--gray-100);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--gray-200);
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.step-item:not(:last-child) {
  margin-bottom: var(--spacing-sm);
}

.step-number {
  background-color: var(--primary-purple);
  color: var(--white);
  font-weight: var(--font-weight-bold);
  min-width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.step-text {
  color: var(--gray-800);
  font-size: 0.9rem;
}

/* ===== GALERÍA DE PRODUCTOS ===== */
.product-gallery {
  flex: 1;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.product-item {
  background: var(--gray-100);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.product-item a {
  display: block;
  position: relative;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-item:hover .product-image {
  transform: scale(1.1);
}

.product-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(99, 102, 241, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-item:hover .product-overlay {
  opacity: 1;
}

.product-overlay i {
  color: var(--white);
  font-size: 2rem;
}

.product-name {
  padding: var(--spacing-sm);
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: var(--gray-800);
  text-align: center;
  line-height: 1.3;
}

.product-btn {
  width: 100%;
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  color: var(--white);
  border: none;
  padding: var(--spacing-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  margin-top: auto;
}

.product-btn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  transform: translateY(-1px);
}

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

.product-btn.selected {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--white);
}

.product-btn.selected:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.product-btn.selected i {
  margin-right: 4px;
  font-size: 1em;
  vertical-align: middle;
}

/* ===== FOOTER DENTRO DE MAIN ===== */
.main-footer {
  padding: var(--spacing-lg) 0 var(--spacing-md);
  margin-top: var(--spacing-lg);
  border-top: 1px solid var(--gray-200);
  text-align: center;
  color: var(--gray-600);
  font-size: 0.85rem;
  line-height: 1.6;
}

.main-footer p {
  margin-bottom: var(--spacing-xs);
}

/* Link de Piwa */
.main-footer p a {
  color: var(--primary-purple);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: color 0.3s ease;
}

.main-footer p a:hover {
  color: var(--secondary-purple);
  text-decoration: underline;
}

.social-links {
  margin-top: var(--spacing-sm);
}

/* Links de redes sociales */
.social-links a {
  display: inline-block;
  color: var(--gray-600);
  font-size: 1.5rem;
  margin: 0 var(--spacing-sm);
  transition: color 0.3s ease, transform 0.3s ease;
  text-decoration: none; /* Evita el subrayado en los iconos */
}

.social-links a:hover {
  color: var(--primary-purple);
  transform: translateY(-3px);
}

/* ===== BOTÓN Y MODAL DE COMPARTIR ===== */
.share-button-container {
  text-align: center;
  margin-top: var(--spacing-lg);
}

.share-btn {
  background: linear-gradient(135deg, var(--accent-pink) 0%, #f97316 100%);
  color: var(--white);
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  box-shadow: var(--shadow-md);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.share-modal {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  padding: 0;
  width: 90%;
  max-width: 450px;
  margin: auto; /* CLAVE: Asegura el centrado vertical y horizontal */
  animation: modal-fade-in 0.3s ease-out;
}

.share-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
  font-size: 1.25rem;
  color: var(--gray-800);
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-600);
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--primary-purple);
}

.modal-body {
  padding: var(--spacing-md);
  text-align: center;
}

.modal-body p {
  margin-bottom: var(--spacing-md);
  color: var(--gray-600);
}

.qr-code-container {
  margin-bottom: var(--spacing-md);
}

.qr-code-image {
  max-width: 200px;
  width: 100%;
  height: auto;
  border: 4px solid var(--white);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-xs);
}

.share-links-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-sm);
}

.share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  color: var(--white);
  font-weight: var(--font-weight-medium);
  transition: transform 0.2s ease, opacity 0.2s ease;
  width: 100%;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.share-link:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.share-link.whatsapp {
  background-color: #25d366;
}
.share-link.facebook {
  background-color: #1877f2;
}
.share-link.twitter {
  background-color: #14171a;
}
.share-link.telegram {
  background-color: #26a5e4;
}
.share-link.email {
  background-color: #7f8c8d;
}
.share-link.copy-link {
  background-color: var(--primary-purple);
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== SECCIÓN DE CONTACTO Y REDES SOCIALES ===== */
.contact-section {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--gray-200);
  text-align: center;
}

.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  border: 1px solid var(--gray-200);
  background-color: var(--white);
  color: var(--gray-800);
  font-weight: var(--font-weight-medium);
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-purple);
  color: var(--primary-purple);
}

.social-legend {
  color: var(--gray-600);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--spacing-sm);
}

/* ===== CARRITO DE COMPRAS FLOTANTE Y MODAL ===== */
.cart-fab {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 60px;
  height: 60px;
  background: linear-gradient(
    135deg,
    var(--primary-purple) 0%,
    var(--secondary-purple) 100%
  );
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 999;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: scale(0) rotate(-90deg); /* Estado inicial oculto */
  opacity: 0;
}

.cart-fab.visible {
  transform: scale(1) rotate(0deg); /* Estado visible */
  opacity: 1;
}

.cart-fab:hover {
  transform: scale(1.1);
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--accent-pink);
  color: var(--white);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: var(--font-weight-bold);
  border: 2px solid var(--white);
}

.cart-modal {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  padding: 0;
  width: 90%;
  max-width: 500px;
  margin: auto;
  animation: modal-fade-in 0.3s ease-out;
}

.cart-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.cart-modal .modal-body {
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.cart-product-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cart-product-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--gray-200);
}

.cart-product-item:last-child {
  border-bottom: none;
}

.cart-product-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--border-radius-sm);
}

.cart-product-details {
  flex: 1;
}

.cart-product-name {
  font-weight: var(--font-weight-semibold);
  color: var(--gray-800);
}

.remove-from-cart-btn {
  background: none;
  border: none;
  color: var(--gray-600);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.remove-from-cart-btn:hover {
  color: var(--accent-pink);
  transform: scale(1.1);
}

.cart-empty-message {
  padding: var(--spacing-xl);
  text-align: center;
  color: var(--gray-600);
}

.cart-empty-message i {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--spacing-sm);
  color: var(--gray-200);
}

.cart-modal .modal-footer {
  padding: var(--spacing-md);
  border-top: 1px solid var(--gray-200);
  background-color: var(--gray-100);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablets */
@media (max-width: 1024px) {
  .container {
    padding: var(--spacing-md);
  }

  .card {
    grid-template-columns: 1fr 1.5fr;
    min-height: 500px;
  }

  .catalog-title {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.8rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-sm);
  }
}

/* Móviles */
@media (max-width: 768px) {
  .container {
    padding: 0; /* El padding se gestiona dentro de la tarjeta */
    align-items: flex-start;
    min-height: 0; /* Permitir que el body controle el scroll */
  }

  .card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    min-height: auto;
    /* Se añade max-height: none para sobreescribir el valor de escritorio */
    max-height: none;
    max-width: 100%;
    overflow: visible;
    border-radius: 0; /* Ocupar toda la pantalla en móvil */
    box-shadow: none; /* Diseño más plano en móvil */
  }

  .card-aside {
    order: 1;
    padding: var(--spacing-lg);
  }

  .brand-section {
    gap: var(--spacing-md);
    cursor: pointer;
  }

  /* Indicador para hacer scroll hacia abajo, solo en móvil */
  .brand-section::after {
    content: "\f282"; /* Bootstrap Icons: chevron-down */
    font-family: "bootstrap-icons";
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.8rem;
    animation: bounce 2s infinite;
    margin-top: -0.5rem; /* Ajuste fino de la posición */
  }

  .card-main {
    order: 2;
    height: auto;
    overflow: visible;
  }

  .main-content {
    padding: var(--spacing-lg);
    height: auto;
    overflow-y: visible;
  }

  .logo-circle {
    width: 120px;
    height: 120px;
    margin-bottom: var(--spacing-md);
  }

  .logo-content i {
    font-size: 2rem;
  }

  .brand-text {
    font-size: 1rem;
  }

  .subtitle {
    font-size: 0.55rem;
  }

  .catalog-title {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .content-header {
    margin: 0 0 var(--spacing-md) 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }

  .product-image {
    height: 120px;
  }

  .product-name {
    font-size: 0.8rem;
    padding: var(--spacing-xs);
  }

  .product-btn {
    padding: var(--spacing-xs);
    font-size: 0.75rem;
  }
}

/* Móviles pequeños */
@media (max-width: 480px) {
  .container {
    padding: var(--spacing-xs);
    padding-top: var(--spacing-md);
  }

  .card-aside,
  .main-content {
    padding: var(--spacing-md);
  }

  .catalog-title {
    font-size: 1.6rem;
  }

  .content-header {
    margin: 0 0 var(--spacing-sm) 0;
    padding: var(--spacing-sm);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-xs);
  }

  .product-image {
    height: 180px;
  }
}

/* ===== ANIMACIONES ADICIONALES ===== */
.product-item {
  animation: fadeIn 0.6s ease-out;
  animation-fill-mode: both;
}

.product-item:nth-child(1) {
  animation-delay: 0.1s;
}
.product-item:nth-child(2) {
  animation-delay: 0.2s;
}
.product-item:nth-child(3) {
  animation-delay: 0.3s;
}
.product-item:nth-child(4) {
  animation-delay: 0.4s;
}
.product-item:nth-child(5) {
  animation-delay: 0.5s;
}
.product-item:nth-child(6) {
  animation-delay: 0.6s;
}

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

/* ===== PERSONALIZACIÓN FANCYBOX ===== */
.fancybox__container {
  --fancybox-bg: rgba(24, 24, 27, 0.92);
}

.fancybox__backdrop {
  backdrop-filter: blur(6px);
}

.fancybox__content > .carousel__button.is-close {
  --f-button-bg: var(--primary-purple);
  --f-button-hover-bg: var(--secondary-purple);
}

.fancybox__content > .carousel__button svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
