/* ========= Variables (responsive + carrito) ========= */
:root {
  --page-h-mobile: clamp(70svh, 82svh, 88svh);
  --page-h-desktop: clamp(78svh, 86svh, 92svh);

  --cart-bg: rgba(15, 17, 26, 0.96);
  --cart-card: rgba(24, 27, 39, 0.75);
  --cart-bord: #1f2937;
  --cart-text: #e7e9ee;
  --cart-muted: #9aa3b2;
  --cart-accent: #3b82f6;
  --cart-accent-2: #22c55e;

  --topbar-h: calc(56px + env(safe-area-inset-top, 0px));
}

/* Si el navegador soporta svh, usamos los tuyos */
@supports (height: 1svh){
  :root{
    --page-h-mobile: clamp(70svh, 82svh, 88svh);
    --page-h-desktop: clamp(78svh, 86svh, 92svh);
  }
}

/* Página al 100% del viewport, sin márgenes ni scroll */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: "Montserrat", sans-serif;
}


/* =============== FLIPBOOK =============== */
.flipbook {
  margin-top: 25px;
  height: 100%;
  width: 100%;
  display: grid; /* centra el spread */
  place-items: center;
  max-width: 1700px;
  min-height: 100vh;     /* fallback universal */
  min-height: 100dvh;    /* viewport dinámico moderno */
  min-height: 100svh;    /* iOS 16+ */
  margin-inline: auto;
  perspective: 1600px;
  user-select: none;
  overflow: hidden;
  touch-action: pan-y; /* el horizontal lo maneja JS */
}

.spread {
  display: grid;
  grid-template-columns: auto; /* 1 pág mobile */
  justify-items: center;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
  transform: translateX(0);
  transition: transform 0.45s ease;
}
.flipbook.dragging .spread {
  transition: none;
  cursor: grabbing;
}

@media (min-width: 1024px) {
  .spread {
    grid-template-columns: auto auto;
  } /* 2 págs desktop */
}

/* Página (siempre centrada y contenida) */
.page {
  position: relative;
  height: var(--page-h-mobile);
  max-width: 100%;
  aspect-ratio: 0.707/1; /* A4 aprox */
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);

  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 1024px) {
  .page {
    height: var(--page-h-desktop);
    max-width: 50vw; /* mitad de la pantalla en desktop */
    border-radius: 16px;
  }
}
.page img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Hotspots */
.hotspot {
  position: absolute;
  border-radius: 10px;
}
.add-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.2s ease;
}
.add-btn::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: url("../img/agregar-producto.png") center/contain no-repeat;
  filter: drop-shadow(0 6px 18px rgba(59, 130, 246, 0.35));
}
.add-btn:hover {
  transform: translateY(-1px);
}
.add-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* Feedback “sombra” al agregar */
@keyframes addBtnEffect {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(59,130,246,0));
  }
  25% {
    transform: scale(1.3) rotate(-8deg);
    filter: drop-shadow(0 0 25px rgba(59,130,246,0.9));
  }
  50% {
    transform: scale(1.15) rotate(6deg);
    filter: drop-shadow(0 0 18px rgba(59,130,246,0.7));
  }
  75% {
    transform: scale(1.25) rotate(-4deg);
    filter: drop-shadow(0 0 12px rgba(59,130,246,0.5));
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 0 rgba(59,130,246,0));
  }
}

.add-btn.clicked {
  animation: addBtnEffect 0.6s ease;
}

/* Animación de cambio de página */
.enter-from-right {
  transform-origin: right center;
  transform: rotateY(-75deg);
  opacity: 0;
}
.enter-from-left {
  transform-origin: left center;
  transform: rotateY(75deg);
  opacity: 0;
}
.enter-active {
  transition: transform 0.5s ease, opacity 0.5s ease;
  transform: rotateY(0);
  opacity: 1;
}
.exit-to-left {
  transform-origin: left center;
  transition: transform 0.5s ease, opacity 0.5s ease;
  transform: rotateY(-75deg);
  opacity: 0;
}
.exit-to-right {
  transform-origin: right center;
  transition: transform 0.5s ease, opacity 0.5s ease;
  transform: rotateY(75deg);
  opacity: 0;
}

/* =============== FAB CARRITO (arriba-derecha) =============== */
.cart-fab {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  color: #fff;
  font-weight: 800;
  border-radius: 999px;
  background: linear-gradient(180deg, #111, #1f1f1f);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.cart-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #111, #1f1f1f);
  pointer-events: none;
  mix-blend-mode: screen;
}
.cart-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.cart-fab:active {
  transform: translateY(0);
  filter: brightness(0.95);
}
.cart-fab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35),
    0 10px 26px rgba(0, 0, 0, 0.4);
}
.cart-icon {
  width: 28px;
  height: 28px;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}
.cart-count {
  display: inline-block;
  min-width: 24px;
  padding: 3px 8px;
  text-align: center;
  border-radius: 999px;
  font: 800 12px/1 "Montserrat", system-ui;
  color: #111;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Micro-animaciones para el FAB y contador */
@keyframes bump {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}
.cart-count.bump {
  animation: bump 0.25s ease;
}
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 12px rgba(59, 130, 246, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}
.cart-fab.attention {
  animation: pulse 2s infinite;
}

/* ——— Responsivo FAB ——— */
@media (max-width: 640px) {
  .page-header { top: 12px; left: 12px; } 
  .cart-fab {
    top: 12px;
    right: 12px;
    padding: 12px 16px;
    min-height: 48px;
  }
  .cart-icon {
    width: 30px;
    height: 30px;
  }
  .cart-count {
    min-width: 26px;
  }
}
@media (min-width: 1280px) {
  .cart-fab {
    top: 20px;
    right: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cart-fab {
    transition: none;
  }
}

/* =============== DRAWER DEL CARRITO (estilo moderno) =============== */
.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 39;
}
.cart-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(92vw, 420px);
  height: 100svh; /* alto real en mobile */
  background: var(--cart-bg);
  color: var(--cart-text);
  border-left: 1px solid var(--cart-bord);
  transform: translateX(100%);
  transition: transform 0.25s;
  z-index: 40;

  display: grid; /* header, columnas, LISTA (scroller), footer */
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden; /* el drawer no scrollea */
}
.cart-drawer.open {
  transform: translateX(0);
}

/* Header */
.cart-header{
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 56px 10px;
  border-bottom: 1px solid var(--cart-bord);
}

.cart-header h2 {
  margin: 0;
  font: 800 clamp(20px, 4vw, 24px) / 1 "Montserrat", system-ui;
  letter-spacing: 0.3px;
}
.cart-close {
  position: absolute;
  right: 14px;
  top: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--cart-bord);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: transform 0.08s ease, background 0.2s ease;
}
.cart-close:hover {
  background: rgba(255, 255, 255, 0.08);
}
.cart-close:active {
  transform: scale(0.96);
}

.cart-logo{
  position: absolute;
  left: 16px;
  top: 12px;
  display: inline-flex;
  align-items: center;

    filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.cart-logo img{
  height: 100px;          /* ajustá tamaño según tu logo */
  width: auto;
  display: block;
}

/* Encabezado de columnas */
.cart-cols {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 10px 16px;
  color: var(--cart-muted);
  font: 600 13px/1 Montserrat, system-ui;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Lista de items (siempre arriba; scrollea solo aquí) */
.cart-item .meta {
  margin-top: 4px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--cart-muted);
  font-weight: 600;
  font-size: 12px;
}

.cart-item .controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.cart-items {
  padding: 8px 12px 12px;
  overflow: auto; /* ← scroller */
  -webkit-overflow-scrolling: touch; /* inercia iOS */
  overscroll-behavior: contain; /* no “rebota” al body */
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 8px 8px 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
/* Tarjeta de ítem */
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--cart-card);
  border: 1px solid var(--cart-bord);
  border-radius: 14px;
}

.cart-item h4 {
  margin: 0;
  font: 700 clamp(14px, 3.2vw, 16px) / 1.25 "Montserrat", system-ui;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.cart-item small {
  display: none;
}

.cart-item.has-off{
  border: 1px solid #a855f7;                /* violeta */
  box-shadow: 0 0 0 2px rgba(168,85,247,.22);
  background:
    linear-gradient(180deg, rgba(168,85,247,.08), transparent) /* leve glow */,
    var(--cart-card);
}

/* Pill -% junto al nombre */
.off-pill{
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font: 800 12px/1 "Montserrat", system-ui;
  color: #fff;
  background: linear-gradient(135deg,#7c3aed,#a855f7);
  border-radius: 999px;
  vertical-align: middle;
  letter-spacing: .2px;
}

/* Controles cantidad */
.qty {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qty button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--cart-bord);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.2s ease, border-color 0.2s ease;
}
.qty button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #2a3446;
}
.qty button:active {
  transform: scale(0.95);
}
.qty input {
  width: 56px;
  height: 36px;
  border-radius: 10px;
  text-align: center;
  font: 700 15px/36px "Montserrat", system-ui;
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--cart-bord);
}

/* Footer + WhatsApp */
.cart-footer{
  position: sticky;   /* extra por si el contenedor cambiara */
  bottom: 0;
  z-index: 1;
  padding: 14px;
  border-top: 1px solid var(--cart-bord);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.wa-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #0f5c2b;
  color: #10321b;
  background: linear-gradient(180deg, #baf6c6, #a9efbb);
  font: 800 16px/1 "Montserrat", system-ui;
  box-shadow: 0 10px 0 #0f5c2b, 0 18px 34px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.wa-btn:active {
  transform: translateY(2px);
  box-shadow: 0 8px 0 #0f5c2b;
}
.wa-ico {
  width: 22px;
  height: 22px;
  display: inline-block;
  background: url("../img/whatsapp.png") center/contain no-repeat;
}

/* Scrollbar sutil */
.cart-items::-webkit-scrollbar {
  width: 10px;
}
.cart-items::-webkit-scrollbar-thumb {
  background: #1f2937;
  border-radius: 999px;
}

.remove {
  background: #ef4444;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  font-family: "Montserrat", sans-serif;
}
.remove:hover {
  background: #dc2626;
}
.remove:active {
  transform: scale(0.96);
}
.remove::before {
  content: "🗑️"; /* icono simple */
  font-size: 14px;
}

.totals {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.totals .tot-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.totals .tot-line span {
  font-size: 13px;
  color: var(--cart-muted);
}
.totals .tot-line strong {
  font-size: 16px;
  color: var(--cart-text);
}


/* Header fijo arriba de la página */
.page-header {
  position: fixed;
  top: 2px;
  left: 16px;
  left: 15px;
  z-index: 10;               /* por encima del flipbook */
}

.page-logo img {
  height: 80px;               /* ajustá el tamaño del logo */
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
  transition: transform .15s ease;
}

.page-logo:hover img {
  transform: scale(1.05);
}


/* ================= Fix para quitar fondo/borde azul de botones ================= */
button:focus {
  outline: none;
  box-shadow: none;
}

/* opcional: mantener un focus visible solo al navegar con teclado */
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--cart-accent);
  border-radius: inherit;
}

/* ===== Quitar highlight azul en click/tap y focus UA ===== */

/* 1) Eliminar highlight de toque en WebKit (iOS/Android) */
* { -webkit-tap-highlight-color: transparent; }

/* 2) Normalizar elementos clickeables */
a, button, .add-btn, .qty button, .wa-btn, .cart-close, .cart-fab, .page-logo,
input, textarea, select {
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 3) Quitar borde/halo/fondo en focus/active para mouse/touch */
a:focus, a:active,
button:focus, button:active,
.add-btn:focus, .add-btn:active,
.qty button:focus, .qty button:active,
.wa-btn:focus, .wa-btn:active,
.cart-close:focus, .cart-close:active,
.cart-fab:focus, .cart-fab:active,
input:focus, input:active,
textarea:focus, textarea:active,
select:focus, select:active {
  outline: none !important;
  box-shadow: none !important;
  background-image: none !important;
  /* evita que algunos navegadores pinten un fondo azul */
}

/* 4) Mantener accesibilidad con teclado (solo Tab) */
a:focus-visible,
button:focus-visible,
.wa-btn:focus-visible,
.qty button:focus-visible,
.cart-close:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--cart-accent);
  border-radius: 12px; /* ajustá si tu botón es más redondo */
}

/* 5) (Opcional) Quitar flechas de inputs number WebKit */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}


/* ===== Modal Seleccionar Vendedor (mínimo necesario) ===== */
.seller-backdrop{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 60; /* por encima del carrito */
}
.seller-modal{
  position: fixed; inset: 0;
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 61;
}
.seller-backdrop.open, .seller-modal.open{ opacity: 1; pointer-events: all; }

.seller-card{
  width: min(92vw, 520px);
  max-height: min(78svh, 540px);
  display: grid; grid-template-rows: auto 1fr;
  background: var(--cart-bg);
  color: var(--cart-text);
  border: 1px solid var(--cart-bord);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,.45);
  overflow: hidden;
  font-family: "Montserrat", system-ui, sans-serif;
}

/* Header con título y botón cerrar */
.seller-head{
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 12px 48px 10px;
  border-bottom: 1px solid var(--cart-bord);
}
.seller-head h3{
  margin:0; font-weight:800; font-size: clamp(18px,3.2vw,20px);
}
.seller-close{
  position: absolute; right: 12px; top: 10px;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--cart-bord);
  background: rgba(255,255,255,.06); color:#fff; cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}
.seller-close:hover{ background: rgba(255,255,255,.1); }

/* Lista de vendedores (clickeable) */
.seller-body{ padding: 10px 12px; overflow: auto; }
.seller-list{ list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.seller-item{ padding:0; }

.seller-pick{
  width:100%;
  display:grid; grid-template-columns: 1fr auto;
  gap:8px; padding:12px;
  background: linear-gradient(90deg,#ff3131 0%,  #ff914d 100%);
  border:1px solid var(--cart-bord);
  border-radius:12px;
  cursor:pointer; text-align:left; color:var(--cart-text);
  -webkit-tap-highlight-color: transparent;
}
.seller-pick:hover{ background: rgba(255,255,255,.06); }

.seller-name{ font-weight:700; }
.seller-phone{ color: var(--cart-muted); font-size:13px; }

/* iOS Safari – fixes visuales para imágenes en 3D */
.flipbook { -webkit-perspective: 1600px; perspective: 1600px; }
.leaf {
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.leaf .face {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.page img, .leaf .face img {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

.swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 40px;
  background: rgba(0,0,0,0.35);
  border-radius: 90%;
  display: grid;
  place-items: center;
  color: #ED5023;
  font-size: 24px;
  font-weight: 800;
  cursor: default;
  user-select: none;
  pointer-events: none; /* no bloquea swipe/click */
  z-index: 15;
  animation: pulseSwipe 2s infinite;
}

.swipe-indicator.left {
  left: 12px;
}
.swipe-indicator.right {
  right: 12px;
}

/* Flechas con pseudo-elementos */
.swipe-indicator.left::before {
  content: "‹"; /* flecha izquierda */
}
.swipe-indicator.right::before {
  content: "›"; /* flecha derecha */
}

/* Animación sutil */
@keyframes pulseSwipe {
  0%   { transform: translateY(-50%) scale(1); opacity: .8; }
  50%  { transform: translateY(-50%) scale(1.2); opacity: 1; }
  100% { transform: translateY(-50%) scale(1); opacity: .8; }
}

/* Opcional: solo mostrar en mobile (ocultar en desktop) */
@media (min-width: 1024px) {
  .swipe-indicator { display: none; }
}