/* =========================================================
   FICHA DE PRODUCTO  ·  responsive (celular, tablet, laptop)
   ========================================================= */
.fp-wrap {
  --fp-primary: var(--bs-primary, #0d6efd);
  --fp-borde: #e5e7eb;
  --fp-gris: #6b7280;
  --fp-verde: #16a34a;
  --fp-rojo: #dc2626;
  --fp-oferta: #ee4d2d;
  /* espacio para que la barra fija del celular no tape el final */
  padding-bottom: 96px;
}
@media (min-width: 992px) { .fp-wrap { padding-bottom: 0; } }

.fp-wrap [hidden] { display: none !important; }

/* ---------- Galería ---------- */
@media (min-width: 992px) {
  .fp-gallery { position: sticky; top: 20px; }
}

.fp-main {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 560px;
  border-radius: 16px;
  overflow: hidden;
  background: #f1f5f9;
  cursor: zoom-in;
}
.fp-main img { width: 100%; height: 100%; object-fit: cover; display: block; }

.fp-noimg {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #94a3b8;
}
.fp-noimg i { font-size: 3rem; }

.fp-zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: .75rem;
}

.fp-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 2px 4px;
  scrollbar-width: thin;
}
.fp-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.fp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fp-thumb.is-active { border-color: var(--fp-primary); }

/* ---------- Información ---------- */
.fp-desc { line-height: 1.6; }

.fp-pricebox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
}
.fp-price { font-size: 1.7rem; font-weight: 800; color: var(--fp-verde); line-height: 1.1; }
.fp-old   { font-size: .6em; font-weight: 500; color: #9ca3af; text-decoration: line-through; margin-right: 4px; }
.fp-new   { color: var(--fp-oferta); }
.fp-desde { font-size: .5em; font-weight: 600; color: var(--fp-gris); }

.fp-stock { font-weight: 600; color: var(--fp-gris); text-align: right; }
.fp-stock.is-low { color: #d97706; }
.fp-stock.is-out { color: var(--fp-rojo); }

/* ---------- Selectores ---------- */
.fp-sec { margin-bottom: 16px; }
.fp-label { margin-bottom: 8px; font-weight: 700; font-size: .95rem; color: #111827; }

.fp-variants, .fp-sizes { display: flex; flex-wrap: wrap; gap: 8px; }

.fp-variant {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 76px;
  max-width: 96px;
  padding: 6px;
  background: #fff;
  border: 2px solid var(--fp-borde);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.fp-variant:active:not(:disabled) { transform: scale(.96); }
.fp-variant img,
.fp-variant-ph { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.fp-variant-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
}
.fp-variant-name { font-size: .78rem; font-weight: 600; line-height: 1.15; text-align: center; word-break: break-word; }
.fp-variant-out  { font-size: .7rem; color: var(--fp-rojo); }
.fp-variant.is-active { border-color: var(--fp-primary); background: rgba(13, 110, 253, .08); }
.fp-variant.is-out { opacity: .45; cursor: not-allowed; }

.fp-size {
  min-width: 68px;
  min-height: 48px;
  padding: 8px 14px;
  background: #fff;
  border: 2px solid var(--fp-borde);
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.fp-size small { display: block; font-size: .7rem; font-weight: 500; color: var(--fp-gris); }
.fp-size.is-active { border-color: var(--fp-primary); background: rgba(13, 110, 253, .08); }
.fp-size.is-out { opacity: .45; text-decoration: line-through; cursor: not-allowed; }

.fp-solo {
  margin-bottom: 16px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: .9rem;
  font-weight: 600;
}

.fp-aviso {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  color: var(--fp-rojo);
  font-size: .9rem;
}

/* Sacudida suave cuando falta elegir algo */
@keyframes fp-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.fp-shake { animation: fp-shake .35s ease; }

/* ---------- Cantidad ---------- */
.fp-qty-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.fp-qty {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--fp-borde);
  border-radius: 12px;
  overflow: hidden;
}
.fp-qty button {
  width: 44px;
  height: 44px;
  border: 0;
  background: #f8fafc;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
}
.fp-qty button:active { background: rgba(13, 110, 253, .12); }
.fp-qty input {
  width: 56px;
  height: 44px;
  border: 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  -moz-appearance: textfield;
}
.fp-qty input::-webkit-outer-spin-button,
.fp-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Botón de añadir ---------- */
.fp-bar { display: flex; align-items: center; gap: 12px; }
/* "Añadir al carrito" en lila, como el botón "Añadir" de las tarjetas (antes celeste
   de btn-primary). Las variables de Bootstrap cubren hover, clic y deshabilitado. */
.fp-btn {
  flex: 1; min-height: 52px; border-radius: 12px; font-size: 1.05rem;
  --bs-btn-bg: #6d3fe0;
  --bs-btn-border-color: #6d3fe0;
  --bs-btn-hover-bg: #5927ce;
  --bs-btn-hover-border-color: #5927ce;
  --bs-btn-active-bg: #4c1fb8;
  --bs-btn-active-border-color: #4c1fb8;
  --bs-btn-disabled-bg: #6d3fe0;
  --bs-btn-disabled-border-color: #6d3fe0;
  --bs-btn-focus-shadow-rgb: 109, 63, 224;
  background-image: linear-gradient(135deg, #5927ce, #7a58b1);
  box-shadow: 0 6px 16px rgba(89, 39, 206, .28);
}
/* Gris mientras falta elegir algo (sigue siendo tocable para avisar qué falta) */
.fp-btn.is-pending { background: #94a3b8; border-color: #94a3b8; }

/* En celular y tablet la barra queda fija abajo */
@media (max-width: 991.98px) {
  .fp-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--fp-borde);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .1);
  }
  .fp-bar-price { display: flex; flex-direction: column; line-height: 1.15; min-width: 96px; }
  .fp-bar-price strong { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fp-shake { animation: none; }
  .fp-variant, .fp-size { transition: none; }
}
/* =========================================================
   Galería deslizable (scroll-snap nativo): todas las fotos en una fila. El dedo arrastra la
   foto en vivo, siempre se detiene en una completa y nunca salta dos (scroll-snap-stop).
   ========================================================= */
.fp-carril {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;        /* deslizar la foto no mueve la página */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  outline: none;
}
.fp-carril::-webkit-scrollbar { display: none; }
.fp-slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.fp-slide img { cursor: zoom-in; }

/* Flechas (computadora) y contador "2 / 5" */
.fp-flecha {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #111827;
  font-size: 1.1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  transform: translateY(-50%);
}
.fp-flecha-ant { left: 10px; }
.fp-flecha-sig { right: 10px; }
.fp-flecha:hover { background: #fff; }
/* En el celular se desliza con el dedo: las flechas de la galería no hacen falta */
@media (hover: none) {
  .fp-main .fp-flecha { display: none; }
}
.fp-contador {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  pointer-events: none;
}
.fp-zoom { z-index: 2; pointer-events: none; }

/* ---------- Visor a pantalla completa ---------- */
.fp-visor [hidden] { display: none !important; }
.fp-visor-contenido {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgba(10, 10, 12, .96);
}
.fp-visor-carril {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  outline: none;
  opacity: 0;                             /* aparece ya ubicado en la foto que se veía */
}
.fp-visor-carril.is-listo { opacity: 1; transition: opacity .15s; }
.fp-visor-carril::-webkit-scrollbar { display: none; }
.fp-visor-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 8px 24px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.fp-visor-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}
.fp-visor-cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 1.1rem;
}
.fp-visor-cerrar:hover { background: rgba(255, 255, 255, .28); }
.fp-visor-contador {
  position: absolute;
  top: 20px;
  left: 18px;
  z-index: 3;
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
}
.fp-visor-flecha { z-index: 3; background: rgba(255, 255, 255, .85); }

@media (prefers-reduced-motion: reduce) {
  .fp-carril, .fp-visor-carril { scroll-behavior: auto; }
}
