/* ==========================================================================
   CSS DIRECTORY & DESIGN SYSTEM - CATÁLOGO PREMIUM ESTILO BARBOUR 2026
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Lora:ital,wght@0,400..700;1,400..700&display=swap');

:root {
  /* Paleta de Colores (Estilo Barbour Lujo Clásico Gris Estudio para fundir fotos) */
  --color-bg-primary: #e3e3e3;       /* Gris estudio oficial Barbour para fundir fotos y siluetas */
  --color-bg-secondary: #e3e3e3;     /* Gris estudio oficial Barbour */
  --color-card-bg: rgba(255, 255, 255, 0.95); /* Vidrio blanco traslúcido para contraste premium */
  --color-text-primary: #1c1c1c;     /* Negro carbón profundo */
  --color-text-secondary: #666666;   /* Gris medio neutral */
  --color-accent: #0a3a20;           /* Verde Bosque Barbour */
  --color-accent-hover: #072715;     
  --color-wpp: #25d366;              /* Verde oficial WhatsApp */
  
  /* Fuentes */
  --font-title: 'Lora', serif;
  --font-body: 'Inter', sans-serif;
  
  /* Transiciones y Sombras */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --shadow-premium: 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-inset: inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Configuración Base e Inmersiva
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-bg-primary);
  font-family: var(--font-body);
  color: var(--color-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Enmarcar en Escritorio (Mobile First Premium) */
@media (min-width: 768px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #fcfbf9 0%, #dcdbd7 100%);
  }
}

/* Contenedor Envolvente de la Aplicación (Simula móvil en Escritorio, inamovible) */
.app-viewport {
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background-color: var(--color-bg-primary);
}

@media (min-width: 768px) {
  .app-viewport {
    width: 480px;
    height: 900px;
    height: 90vh;
    border-radius: 32px;
    border: 8px solid #dcdbd7;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    position: relative;
  }
}

/* Contenedor Principal con Scroll Snapping (Hijo de app-viewport) */
.catalog-container {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Pantalla de Carga (Loader)
   ========================================================================== */
.loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-primary);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(10, 58, 32, 0.1);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin-bottom: 16px;
}

.loader-text {
  font-family: var(--font-title);
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--color-text-primary);
  text-transform: uppercase;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Cabecera Flotante Premium Estilo Barbour
   ========================================================================== */
.floating-header {
  position: absolute; /* Cambiado a absolute dentro del viewport estático inamovible */
  top: 0;
  left: 0;
  width: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px 20px; /* Soporte dinámico para muescas (Notch / Dynamic Island) */
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(227, 227, 227, 0.98) 0%, rgba(227, 227, 227, 0) 100%); /* Fusión perfecta con el color gris de fondo */
  backdrop-filter: blur(4px); /* Aumentado sutilmente para mayor elegancia */
  -webkit-backdrop-filter: blur(4px);
  transition: var(--transition-smooth);
}

.floating-header.scrolled {
  background: rgba(227, 227, 227, 0.96); /* Fusión perfecta al hacer scroll */
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

/* Logo Oficial Barbour Vectorial */
.brand-logo-container {
  display: flex;
  align-items: center;
}

.barbour-official-logo {
  height: 20px;
  width: auto;
  color: var(--color-accent);
  display: block;
  transition: var(--transition-smooth);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-header {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.03);
  color: var(--color-text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-header:hover, .btn-header:active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.page-indicator {
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Secciones (Páginas Individuales)
   ========================================================================== */
.catalog-page {
  width: 100%;
  height: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
  background-color: var(--color-bg-primary);
}

/* Alternancia sutil de color de fondo */
.catalog-page:nth-child(even) {
  background-color: var(--color-bg-secondary);
}

/* ==========================================================================
   Área del Producto (Imagen Central y Controles)
   ========================================================================== */
.page-content-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: calc(env(safe-area-inset-top, 0px) + 54px); /* Espacio exacto libre para la cabecera floating-header */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 44px); /* Espacio libre para el scroll-next-indicator */
  padding-left: 0; /* Eliminado para permitir que la imagen vaya de lado a lado (edge-to-edge) en móviles */
  padding-right: 0;
}

.product-hero-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1; /* Ocupa dinámicamente todo el espacio vertical sobrante de la pantalla */
  width: 100%;
  position: relative;
  min-height: 0; /* Habilita que el flexbox encoja las imágenes en pantallas de baja resolución */
  z-index: 10;
}

.image-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
}

.image-viewport.switching {
  opacity: 0.3;
  transform: scale(0.97);
}

.product-main-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.04));
  transition: transform 0.4s ease;
  user-select: none;
}

/* Flechas de Navegación del Carrusel (Estilo Barbour: Linear y Sin Fondo) */
.btn-arrow {
  position: absolute;
  top: 50%; /* Centrado vertical absoluto respecto al área real del producto */
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  width: 44px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 20;
  transition: var(--transition-smooth);
}

.btn-arrow:active, .btn-arrow:hover {
  color: var(--color-accent);
  transform: translateY(-50%) scale(1.2);
}

.btn-arrow.prev { left: 6px; }
.btn-arrow.next { right: 6px; }

.btn-arrow svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5; /* Ligeramente más grueso para dar una apariencia vectorial lujosa y nítida */
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Flechas en Jerseys habilitadas para ciclar por colores en lugar de vistas */

/* Miniaturas Secundarias Flotantes Verticales - Completamente Ocultas */
.thumbnails-container {
  display: none !important;
}

/* ==========================================================================
   Detalles del Producto (Ficha Técnica Flotante Estilo Barbour)
   ========================================================================== */
.product-details {
  width: auto; /* Permite que respete los márgenes laterales */
  background: var(--color-card-bg);
  border-radius: 16px;
  padding: 10px 16px; /* Padding ultra optimizado y compacto para un look de alta costura */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: var(--shadow-inset), var(--shadow-premium);
  display: flex;
  flex-direction: column;
  gap: 6px; /* Espaciado sutil y compacto */
  z-index: 30;
  flex-shrink: 0; /* Garantiza que la tarjeta nunca se deforme ni se encoja en pantallas pequeñas */
  margin-top: 12px; /* Separación armónica respecto a la imagen superior */
  margin-bottom: 24px; /* Empuja la tarjeta hacia arriba, centrándola simétricamente entre la imagen y el texto de deslizar */
  margin-left: 14px; /* Margen lateral elegante para compensar la imagen de lado a lado */
  margin-right: 14px;
}

/* Ficha técnica más amplia y holgada para las dos Chaquetas (con solo 3 colores) */
#section-ashby-jacket .product-details,
#section-corbridge-jacket .product-details {
  padding: 16px 20px; /* Más padding arriba/abajo y a los lados para mayor holgura */
  gap: 12px; /* Más espacio cómodo entre elementos para que se sienta libre */
  margin-bottom: 28px; /* Ajuste de margen inferior para compensar la altura con simetría */
}

.details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.details-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-meta {
  display: flex;
  flex-direction: column;
}

.product-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.product-tagline {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

/* Selector de Colores (Swatches) */
.color-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-label-row {
  display: none !important; /* Ocultamos por completo la línea de texto de color */
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px; /* Ligeramente más holgado */
  justify-content: flex-start;
  align-items: center;
}

.swatch {
  width: 30px; /* Círculos de color ampliados para chaquetas */
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--color-card-bg);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: var(--transition-fast);
  position: relative;
}

.swatch.active {
  transform: scale(1.1); /* Resaltado sutil */
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3.5px var(--color-accent); /* Anillo doble de alto contraste (perfecto para swatches claros y oscuros) */
}

/* Jerseys: paleta de 11 swatches perfectamente alineados y más grandes */
#section-jerseys-mkn1074 .swatches {
  gap: 6px;
}
#section-jerseys-mkn1074 .swatch {
  width: 24px; /* Ampliado de 20px a 24px para mejor interacción táctil */
  height: 24px;
}

/* ==========================================================================
   Botón Circular Flotante Blanco (WhatsApp FAB con Icono Arena Sutil)
   ========================================================================== */
.btn-whatsapp-fab {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff; /* Fondo blanco nítido para que el icono arena flote de forma premium */
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: var(--transition-smooth);
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-whatsapp-fab img {
  width: 24px; /* Mucho más pequeño y sutil, ideal para el lookbook de Barbour */
  height: 24px;
  object-fit: contain;
  border-radius: 0; /* Sin redondear la imagen para evitar que se corte la colita del logo */
}

.btn-whatsapp-fab:hover, .btn-whatsapp-fab:active {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(235, 214, 187, 0.45); /* Sombra beige arena personalizada */
}

/* ==========================================================================
   Indicadores de Scroll / Puntos de Paginación Flotantes
   ========================================================================== */

/* Puntos de Paginación Laterales Flotantes */
.navigation-dots {
  position: absolute; /* Cambiado a absolute dentro del viewport estático inamovible */
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.dot.active {
  background: var(--color-accent);
  transform: scale(1.4);
  box-shadow: 0 0 10px rgba(10, 58, 32, 0.3);
}

/* Indicador de Deslizar Interactivo en la base absoluta del viewport */
.scroll-next-indicator {
  position: absolute;
  bottom: 8px; /* Ubicación balanceada que evita superponerse sobre la tarjeta de detalles */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  z-index: 40;
  width: auto;
  gap: 2px;
}

/* Soporte de desvanecimiento suave para scroll tracking */
.scroll-next-indicator.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.scroll-text-bottom {
  font-family: var(--font-body);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  color: var(--color-text-secondary);
  opacity: 0.8;
  transition: var(--transition-smooth);
}

.scroll-next-indicator:hover, .scroll-next-indicator:active {
  color: var(--color-accent);
}

.scroll-next-indicator:hover .scroll-text-bottom, .scroll-next-indicator:active .scroll-text-bottom {
  color: var(--color-accent);
  opacity: 1;
}

.scroll-next-indicator svg {
  width: 18px;
  height: 18px;
  animation: bounceMini 2s infinite ease-in-out;
}

.scroll-next-indicator.last svg {
  animation: bounceMiniUp 2s infinite ease-in-out;
}

@keyframes bounceMini {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(4px); opacity: 1; }
}

@keyframes bounceMiniUp {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* ==========================================================================
   Modales (Lightbox y Toasts)
   ========================================================================== */

/* Toast de Enlace Copiado */
.share-toast {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--color-accent);
  color: var(--color-text-primary);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0;
  visibility: hidden;
  z-index: 1001;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
  pointer-events: none;
  white-space: nowrap;
}

.share-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* Modal Lightbox (Visualización en Pantalla Completa) */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.98);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img-wrapper {
  max-width: 90%;
  max-height: 80%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 20px 45px rgba(0,0,0,0.05));
  animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 24px); /* Soporte seguro para muescas (notch) físicas en el modal de pantalla completa */
  right: 24px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--color-text-primary);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.lightbox-close:active, .lightbox-close:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.lightbox-close svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Ajustes y Parches Responsive Móviles (Safari, etc.)
   ========================================================================== */
@supports (-webkit-touch-callout: none) {
  .catalog-page, .catalog-container {
    height: -webkit-fill-available;
  }
}

/* ==========================================================================
   DISEÑO DESKTOP NATIVO Y PREMIUM (Pantallas Grandes >= 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
  /* Quitar el marco de teléfono móvil simulado en pantallas de ordenador y expandir nativamente */
  body {
    background: #e3e3e3 !important;
    display: block;
    height: auto;
    overflow: auto;
  }

  .app-viewport {
    width: 100% !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden;
  }

  /* Cabecera flotante en desktop */
  .floating-header {
    padding: 24px 6% 18px 6% !important;
    background: linear-gradient(to bottom, rgba(227, 227, 227, 0.98) 0%, rgba(227, 227, 227, 0) 100%) !important;
  }

  .floating-header.scrolled {
    background: rgba(227, 227, 227, 0.96) !important;
  }

  /* Puntos de paginación lateral en desktop */
  .navigation-dots {
    right: 3% !important;
    gap: 12px !important;
  }

  .dot {
    width: 12px !important;
    height: 12px !important;
  }

  /* Distribución en fila (Row/Split Layout) en desktop */
  .page-content-wrapper {
    flex-direction: row !important;
    padding: 80px 10% 50px 10% !important;
    gap: 6% !important;
    justify-content: center !important;
    align-items: center !important;
  }

  /* Área de la imagen en desktop (izquierda) */
  .product-hero-container {
    flex: 1.2 !important;
    height: 100% !important;
    max-height: 75vh !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }

  .product-main-image {
    max-height: 75vh !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }

  /* Ficha de detalles en desktop (derecha) */
  .product-details {
    flex: 0.8 !important;
    max-width: 440px !important;
    width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important; /* Resetear márgenes de móvil en desktop */
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 28px 36px !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05), var(--shadow-inset) !important;
  }

  .product-title {
    font-size: 1.8rem !important;
  }

  .product-tagline {
    font-size: 0.85rem !important;
    margin-top: 4px !important;
  }

  .swatch {
    width: 32px !important;
    height: 32px !important;
  }

  .btn-whatsapp-fab {
    width: 56px !important;
    height: 56px !important;
  }

  .btn-whatsapp-fab img {
    width: 28px !important;
    height: 28px !important;
  }

  /* Flechas de navegación en desktop */
  .btn-arrow {
    width: 60px !important;
    height: 80px !important;
  }

  .btn-arrow.prev { left: -40px !important; }
  .btn-arrow.next { right: -40px !important; }

  /* Indicador de scroll inferior en desktop */
  .scroll-next-indicator {
    bottom: 20px !important;
  }

  .scroll-text-bottom {
    font-size: 0.7rem !important;
  }
}
