/**
 * EXIPLAST v4 Unified - Estilos Globales Responsive, Táctiles y Alto Rendimiento (60 FPS)
 * Cero desbordes horizontales (320px a 3840px / 4K Smart TVs), arrastre nativo fluido,
 * accesibilidad TV (:focus-visible) y optimización de renderizado de grillas masivas.
 */

/* 1. CERO DESBORDES HORIZONTALES GLOBALES */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

/* 2. BLOQUEO DE ARRASTRE NATIVO DE FOTOS EN SLIDERS Y CARRUSELES */
#hero-slider-section img,
#new-arrivals-carousel img,
#kit-pasteleria-carousel img,
#kit-sushi-carousel img,
.cursor-grab img,
[id$="-carousel"] img {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* 3. SCROLL TÁCTIL ACELERADO POR HARDWARE EN CARRUSELES */
#new-arrivals-carousel,
#kit-pasteleria-carousel,
#kit-sushi-carousel,
[id$="-carousel"] {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  touch-action: pan-x pan-y;
}

#new-arrivals-carousel > div,
#kit-pasteleria-carousel > div,
#kit-sushi-carousel > div,
[id$="-carousel"] > div {
  scroll-snap-align: start;
}

.carousel-is-dragging,
.carousel-is-dragging * {
  scroll-snap-type: none !important;
  scroll-behavior: auto !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Hero Slider: permitir scroll vertical de página sin bloquear swipe horizontal */
#hero-slider-section {
  touch-action: pan-y;
  cursor: grab;
}
#hero-slider-section.hero-is-dragging {
  cursor: grabbing;
}

/* 4. ZONAS TÁCTILES Y ELIMINACIÓN DE RETRASO 300MS EN MÓVILES */
a,
button,
input,
select,
textarea,
label,
summary,
[role="button"],
.product-fav-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.qty-decrease,
.qty-increase,
.product-fav-btn,
.btn-theme-toggle-mobile,
.mobile-fav-link,
.mobile-account-link,
.mobile-cart-link,
#prev-slide-btn,
#next-slide-btn {
  min-width: 42px;
  min-height: 42px;
}

@media (max-width: 1023px) {
  .qty-decrease,
  .qty-increase,
  .product-fav-btn,
  #catalog-sort-select,
  .subcat-item-btn,
  .cat-accordion-trigger,
  .btn-theme-toggle-mobile,
  .mobile-fav-link,
  .mobile-account-link,
  .mobile-cart-link {
    min-height: 44px;
  }
}

/* 5. BUSCADOR PREDICTIVO AMPLIO, HEADER ANTI-ZOOM Y MEGAMENÚ */
.exiplast-search-dropdown {
  width: 540px;
  max-width: calc(100vw - 24px);
}
@media (min-width: 1024px) {
  .exiplast-search-dropdown {
    width: 600px;
  }
}

/* Header a prueba de Zoom (125% / 150% / 175%): ocultar accesos rápidos antes de colisionar con la lupa */
@media (max-width: 1359px) {
  .quick-links-group {
    display: none !important;
  }
}

@media (min-width: 1024px) and (max-width: 1359px) {
  .searchBox-wrapper.is-expanded .searchBox,
  .searchBox.is-expanded {
    max-width: min(380px, calc(100vw - 720px)) !important;
  }
}

/* Subcategorías completas en Megamenú sin recorte */
#dropSubcatGrid {
  max-height: 300px;
}

@media (max-width: 1023px) {
  .searchBox-wrapper.is-expanded {
    flex: 1 1 0% !important;
    width: auto !important;
    min-width: 0 !important;
    margin-left: 0 !important;
  }
  .searchBox-wrapper.is-expanded .searchBox,
  .searchBox.is-expanded {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    right: auto !important;
    top: auto !important;
  }
  .searchBox-wrapper.is-expanded .exiplast-search-dropdown {
    width: min(560px, calc(100vw - 24px)) !important;
    min-width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px) !important;
    right: 0 !important;
  }
}

/* Mega-Menú adaptable en móvil y tablet */
@media (max-width: 767px) {
  #megaMenuDropdown {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: 78vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  #megaMenuDropdown #dropdownCatList {
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0;
    max-height: 220px;
  }
  #megaMenuDropdown #dropdownCatList button,
  #megaMenuDropdown #dropSubcatGrid a {
    min-height: 44px;
  }
}

/* 6. RENDIMIENTO DE GRILLAS MASIVAS (273+ PRODUCTOS A 60 FPS) */
#products-grid > div,
#primer-compra-grid > div,
#ofertas-grid > div {
  content-visibility: auto;
  contain-intrinsic-size: 380px;
}

.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* 7. BOTÓN FLOTANTE DE WHATSAPP COMPACTO (52x52px), ANIMADO E IMANTADO A LATERALES */
.exiplast-wa-float {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 60;
  height: 52px;
  min-width: 52px;
  padding: 0;
  border-radius: 9999px;
  background-color: #007b55;
  color: #ffffff;
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  box-shadow: 0 10px 25px -5px rgba(0, 123, 85, 0.45), 0 4px 12px -2px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  overflow: hidden;
  transition: background-color 0.22s ease, box-shadow 0.22s ease, transform 0.2s ease;
}

/* Imantado a la derecha (default): el ícono permanece a la derecha y "Escribinos" se expande hacia la izquierda */
.exiplast-wa-float.wa-snapped-right {
  flex-direction: row-reverse;
}

/* Imantado a la izquierda: el ícono permanece a la izquierda y "Escribinos" se expande hacia la derecha */
.exiplast-wa-float.wa-snapped-left {
  flex-direction: row;
}

.exiplast-wa-float .exiplast-wa-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  color: #ffffff;
}

.exiplast-wa-float .exiplast-wa-label {
  max-width: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
  pointer-events: none;
  transition:
    max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease,
    padding-left 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    padding-right 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    margin-left 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    margin-right 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .exiplast-wa-float:not(.is-dragging):not(.is-snapping):hover {
    background-color: #006042;
    box-shadow: 0 14px 28px -6px rgba(0, 96, 66, 0.52), 0 6px 14px -2px rgba(0, 0, 0, 0.24);
  }
  .exiplast-wa-float:not(.wa-snapped-left):not(.is-dragging):not(.is-snapping):hover .exiplast-wa-label {
    max-width: 112px;
    opacity: 1;
    padding-left: 18px;
    margin-right: -4px;
  }
  .exiplast-wa-float.wa-snapped-left:not(.is-dragging):not(.is-snapping):hover .exiplast-wa-label {
    max-width: 112px;
    opacity: 1;
    padding-right: 18px;
    margin-left: -4px;
  }
}

.exiplast-wa-float:focus-visible {
  border-radius: 9999px;
}

.exiplast-wa-float:not(.wa-snapped-left):not(.is-dragging):not(.is-snapping):focus-visible .exiplast-wa-label {
  max-width: 112px;
  opacity: 1;
  padding-left: 18px;
  margin-right: -4px;
}

.exiplast-wa-float.wa-snapped-left:not(.is-dragging):not(.is-snapping):focus-visible .exiplast-wa-label {
  max-width: 112px;
  opacity: 1;
  padding-right: 18px;
  margin-left: -4px;
}

.exiplast-wa-float.is-snapping {
  transition:
    left 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    right 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.2s ease !important;
}

.exiplast-wa-float.is-dragging {
  cursor: grabbing;
  background-color: #006042;
  transform: scale(1.06);
  box-shadow: 0 18px 34px -6px rgba(0, 96, 66, 0.55), 0 8px 18px -4px rgba(0, 0, 0, 0.3);
  transition: transform 0.14s ease, box-shadow 0.14s ease !important;
}

.exiplast-wa-float.is-dragging .exiplast-wa-label,
.exiplast-wa-float.is-snapping .exiplast-wa-label {
  max-width: 0 !important;
  opacity: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  transition: none !important;
}

@media (max-width: 639px) {
  .exiplast-wa-float {
    bottom: 20px;
    right: 16px;
  }
}

/* 8. NAVEGACIÓN POR CONTROL REMOTO DE SMART TV / TECLADO (:focus-visible) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #ea580c !important;
  outline-offset: 2px !important;
  border-radius: 12px;
}

/* 9. RESPETAR PREFERENCIA DE MOVIMIENTO REDUCIDO */
@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;
  }
}


/* Control anti-flash de accesos Mayoristas y Modo Upgrade */
html.exiplast-wholesale [data-reseller-cta="true"],
html.exiplast-wholesale .reseller-cta-link {
  display: none !important;
}
html.exiplast-upgrade-mode #authSwitcherWrap,
html.exiplast-upgrade-mode #panelLogin,
html.exiplast-upgrade-mode #cardConsumidor,
html.exiplast-upgrade-mode .upgrade-hide-field {
  display: none !important;
}

/* Consistencia táctil del botón 3D Productos */
.btn-3d-productos:hover {
  background-color: #f97316 !important;
  transform: translateY(0) !important;
  box-shadow: 0px 4px 0 #9a2c04, 0px 8px 12px rgba(234, 88, 12, 0.25) !important;
}
.btn-3d-productos:active,
.btn-3d-productos.is-pressed {
  transform: translateY(3px) !important;
  box-shadow: 0px 1px 0 #9a2c04, 0px 3px 6px rgba(0, 0, 0, 0.15) !important;
}
