/* ============================================================
   WeliaStore — Modal Produit Immersif
   Style Jumia × Apple × AliExpress
   Mobile-first, animations fluides, zoom avancé
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --pm-orange:    #f68b1e;
  --pm-orange-dk: #e07b0e;
  --pm-dark:      #1a1d27;
  --pm-border:    #ebebeb;
  --pm-radius:    16px;
  --pm-ease:      cubic-bezier(.4,0,.2,1);
  --pm-shadow:    0 24px 80px rgba(0,0,0,.22);
}

/* ── Overlay ────────────────────────────────────────────────── */
#wpm-overlay {
  position: fixed; inset: 0; z-index: 99990;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  pointer-events: none;
  transition: background .28s var(--pm-ease), backdrop-filter .28s var(--pm-ease);
}
#wpm-overlay.open {
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  pointer-events: all;
}

/* ── Modal Box ──────────────────────────────────────────────── */
#wpm-box {
  position: relative;
  background: #fff;
  border-radius: var(--pm-radius);
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--pm-shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  transform: translateY(32px) scale(.96);
  opacity: 0;
  transition: transform .32s var(--pm-ease), opacity .28s var(--pm-ease);
}
#wpm-overlay.open #wpm-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}
@media (max-width: 768px) {
  #wpm-overlay { padding: 0; align-items: flex-end; }
  #wpm-box {
    grid-template-columns: 1fr;
    border-radius: var(--pm-radius) var(--pm-radius) 0 0;
    max-height: 82vh;
    overflow-y: auto;
    transform: translateY(60px);
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Close button ───────────────────────────────────────────── */
#wpm-close {
  position: absolute; top: 14px; right: 14px; z-index: 10;
  background: rgba(0,0,0,.45); color: #fff;
  border: none; border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; cursor: pointer;
  transition: background .18s, transform .18s;
}
#wpm-close:hover { background: var(--pm-orange); transform: rotate(90deg); }

/* ── GALERIE ────────────────────────────────────────────────── */
.wpm-gallery {
  position: relative;
  background: #f8f8f8;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* Image principale avec zoom hover */
.wpm-main-img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: crosshair;
  background: #f8f8f8;
  flex-shrink: 0;
}
.wpm-main-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity .22s;
  pointer-events: none;
  padding: 12px;
}
.wpm-main-img.loading { opacity: .4; }

/* Lentille de zoom hover */
.wpm-lens {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(246,139,30,.6);
  background: rgba(246,139,30,.08);
  pointer-events: none;
  display: none;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 0 1px rgba(246,139,30,.3), 0 4px 16px rgba(0,0,0,.2);
  z-index: 2;
}

/* Fenêtre zoom (desktop) */
.wpm-zoom-window {
  position: absolute;
  top: 0; left: 105%;
  width: 400px; height: 400px;
  background: #fff;
  border: 1px solid var(--pm-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  overflow: hidden;
  display: none;
  z-index: 9999;
}
.wpm-zoom-window img {
  position: absolute;
  width: auto; height: auto;
  max-width: none;
  pointer-events: none;
}
@media (max-width: 768px) { .wpm-zoom-window { display: none !important; } }

/* Promo badge sur galerie */
.wpm-gallery-badge {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  background: var(--pm-orange); color: #fff;
  font-weight: 800; font-size: .78rem;
  padding: 4px 10px; border-radius: 20px;
  pointer-events: none;
}

/* Boutons prev / next */
.wpm-nav {
  position: absolute; top: 50%; z-index: 4;
  transform: translateY(-50%);
  background: rgba(255,255,255,.92); color: var(--pm-dark);
  border: none; border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .9rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.14);
  transition: background .18s, transform .18s, opacity .18s;
  opacity: .0;
}
.wpm-main-img-wrap:hover .wpm-nav,
.wpm-gallery:focus-within .wpm-nav { opacity: 1; }
@media (max-width: 768px) { .wpm-nav { opacity: 1; } }
.wpm-nav:hover { background: var(--pm-orange); color: #fff; transform: translateY(-50%) scale(1.1); }
.wpm-nav-prev { left: 10px; }
.wpm-nav-next { right: 10px; }
.wpm-nav:disabled { opacity: .25 !important; cursor: not-allowed; }

/* Miniatures */
.wpm-thumbs {
  display: flex; gap: 8px;
  padding: 10px 14px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
}
.wpm-thumbs::-webkit-scrollbar { display: none; }
.wpm-thumb {
  flex-shrink: 0;
  width: 58px; height: 58px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #f8f8f8;
  cursor: pointer;
  transition: border-color .18s, transform .18s;
}
.wpm-thumb.active, .wpm-thumb:hover { border-color: var(--pm-orange); transform: scale(1.05); }
.wpm-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

/* Indicateurs de slide (mobile) */
.wpm-dots {
  display: none;
  justify-content: center; gap: 6px;
  padding: 0 0 10px;
}
@media (max-width: 768px) { .wpm-dots { display: flex; } }
.wpm-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ddd; border: none; cursor: pointer;
  transition: background .18s, transform .18s;
  padding: 0;
}
.wpm-dot.active { background: var(--pm-orange); transform: scale(1.3); }

/* ── INFOS PRODUIT ──────────────────────────────────────────── */
.wpm-info {
  padding: 28px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 90vh;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
  .wpm-info { padding: 20px 18px; max-height: none; overflow: visible; }
}

.wpm-category {
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--pm-orange);
  text-decoration: none;
}
.wpm-category:hover { text-decoration: underline; }

.wpm-title {
  font-size: 1.25rem; font-weight: 800; line-height: 1.3;
  color: var(--pm-dark); margin: 0;
}
@media (max-width: 480px) { .wpm-title { font-size: 1.05rem; } }

/* Prix */
.wpm-price-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.wpm-price {
  font-size: 1.9rem; font-weight: 900;
  color: var(--pm-orange); letter-spacing: -.5px;
}
.wpm-old-price {
  font-size: .95rem; color: #aaa; text-decoration: line-through;
}
.wpm-discount {
  background: #fff3e0; color: var(--pm-orange);
  font-size: .78rem; font-weight: 800;
  padding: 3px 9px; border-radius: 20px;
}
@media (max-width: 480px) { .wpm-price { font-size: 1.5rem; } }

/* Disponibilité (style Jumia — pas de quantité) */
.wpm-avail {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .87rem; font-weight: 700;
  padding: 6px 14px; border-radius: 20px;
  width: fit-content;
}
.wpm-avail.ok { background: #e8f5e9; color: #2e7d32; }
.wpm-avail.out { background: #fce4e4; color: #c62828; }
.wpm-avail .dot { width: 8px; height: 8px; border-radius: 50%; }
.wpm-avail.ok .dot { background: #43a047; }
.wpm-avail.out .dot { background: #e53935; }

/* Garanties */
.wpm-features {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.wpm-features li {
  display: flex; align-items: center; gap: 9px;
  font-size: .84rem; color: #555;
}
.wpm-features li i { color: var(--pm-orange); width: 16px; flex-shrink: 0; }

/* Séparateur */
.wpm-divider { border: none; border-top: 1px solid var(--pm-border); margin: 0; }

/* Boutons CTA */
.wpm-cta-group {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.wpm-btn-cart {
  flex: 1; min-width: 160px;
  background: var(--pm-orange); color: #fff;
  border: none; border-radius: 10px;
  height: 50px; font-size: 1rem; font-weight: 800;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(246,139,30,.35);
}
.wpm-btn-cart:hover {
  background: var(--pm-orange-dk);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(246,139,30,.45);
}
.wpm-btn-cart:active { transform: translateY(0); }
.wpm-btn-cart:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }
.wpm-btn-cart.added { background: #27ae60; box-shadow: 0 4px 14px rgba(39,174,96,.35); }

.wpm-btn-detail {
  background: #fff; color: var(--pm-dark);
  border: 2px solid var(--pm-border); border-radius: 10px;
  height: 50px; padding: 0 18px; font-size: .9rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 7px;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
  text-decoration: none;
}
.wpm-btn-detail:hover { border-color: var(--pm-orange); color: var(--pm-orange); }

.wpm-btn-wa {
  width: 100%;
  background: #25d366; color: #fff;
  border: none; border-radius: 10px;
  height: 46px; font-size: .93rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 9px;
  transition: background .2s, transform .15s;
  text-decoration: none;
}
.wpm-btn-wa:hover { background: #1ebe5a; transform: translateY(-1px); }

/* View full page link */
.wpm-see-full {
  text-align: center;
  font-size: .8rem; color: #aaa;
}
.wpm-see-full a { color: var(--pm-orange); text-decoration: none; font-weight: 600; }
.wpm-see-full a:hover { text-decoration: underline; }

/* ── Skeleton Loader ────────────────────────────────────────── */
.wpm-skeleton { animation: wpmPulse 1.4s ease-in-out infinite; }
.wpm-skeleton-img { background: #eee; width: 100%; aspect-ratio: 1; }
.wpm-skeleton-line {
  background: #eee; border-radius: 6px; height: 16px; margin-bottom: 10px;
}
.wpm-skeleton-line.w75 { width: 75%; }
.wpm-skeleton-line.w50 { width: 50%; }
.wpm-skeleton-line.h32 { height: 32px; }
@keyframes wpmPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}

/* ── Lightbox (click zoom HD) ───────────────────────────────── */
#wpm-lightbox {
  position: fixed; inset: 0; z-index: 999999;
  background: rgba(0,0,0,.95);
  display: none; align-items: center; justify-content: center;
  cursor: zoom-out;
}
#wpm-lightbox.open { display: flex; }
#wpm-lightbox img {
  max-width: 92vw; max-height: 92vh;
  object-fit: contain; border-radius: 8px;
  cursor: default;
  transition: transform .25s var(--pm-ease);
}
#wpm-lb-close {
  position: fixed; top: 16px; right: 20px;
  background: none; border: none; color: #fff;
  font-size: 2.2rem; cursor: pointer; line-height: 1; z-index: 10;
}
#wpm-lb-close:hover { color: var(--pm-orange); }
#wpm-lb-prev, #wpm-lb-next {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); color: #fff;
  border: none; border-radius: 50%;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer;
  transition: background .18s;
}
#wpm-lb-prev { left: 16px; }
#wpm-lb-next { right: 16px; }
#wpm-lb-prev:hover, #wpm-lb-next:hover { background: var(--pm-orange); }

/* ── Toast notification ─────────────────────────────────────── */
#wpm-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(60px);
  background: var(--pm-dark); color: #fff;
  padding: 12px 24px; border-radius: 30px;
  font-size: .9rem; font-weight: 600;
  z-index: 999998; opacity: 0;
  transition: transform .3s var(--pm-ease), opacity .3s;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
#wpm-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
#wpm-toast.success { background: #27ae60; }
#wpm-toast.error   { background: #e74c3c; }
#wpm-toast.cart    { background: var(--pm-orange); }

/* ── Mobile UX — modal compact & lisible ───────────────────── */
@media (max-width: 768px) {
  /* Image compacte : max 26vh pour que prix + boutons soient visibles sans scroller */
  .wpm-main-img-wrap {
    aspect-ratio: 4 / 3;
    max-height: 26vh;
  }

  /* Miniatures plus compactes */
  .wpm-thumbs {
    padding: 6px 12px 8px;
    gap: 6px;
  }
  .wpm-thumb {
    width: 44px;
    height: 44px;
  }

  /* Infos : espacement réduit, padding latéral confortable */
  .wpm-info {
    gap: 11px;
    padding: 14px 16px 20px;
  }

  /* Boutons CTA collés en bas, toujours visibles */
  .wpm-cta-group {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px 0 6px;
    box-shadow: 0 -4px 16px rgba(0,0,0,.07);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 5;
  }

  /* Bouton panier plein largeur sur mobile */
  .wpm-btn-cart {
    height: 46px;
    font-size: .93rem;
  }

  /* Bouton WhatsApp légèrement réduit */
  .wpm-btn-wa {
    height: 42px;
    font-size: .88rem;
  }
}