/**
 * Live Sales Proof – Frontend CSS
 * Design premium : dark navy / or / blanc, animations fluides
 *
 * @package LiveSalesProof
 * @version 1.0.0
 */

/* ═══════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (overridden by PHP inline style)
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --lsp-primary:        #1a2e4a;
  --lsp-text:           #ffffff;
  --lsp-accent:         #f0a500;
  --lsp-radius:         12px;
  --lsp-shadow:         0 8px 32px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.18);
  --lsp-img-size:       60px;
  --lsp-popup-width:    320px;
  --lsp-anim-in:        0.42s;
  --lsp-anim-out:       0.32s;
  --lsp-easing:         cubic-bezier(0.34, 1.56, 0.64, 1);
  --lsp-easing-out:     cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ═══════════════════════════════════════════════════════════════════════════
   WRAPPER – positionné en bas de page
   ═══════════════════════════════════════════════════════════════════════════ */
#lsp-popup-wrapper {
  position: fixed;
  bottom: 24px;
  left: 24px; /* overridden inline for bottom-right */
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POPUP PRINCIPAL
   ═══════════════════════════════════════════════════════════════════════════ */
.lsp-popup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: var(--lsp-popup-width);
  max-width: calc(100vw - 32px);
  padding: 14px 16px 20px 14px;
  background: var(--lsp-primary);
  color: var(--lsp-text);
  border-radius: var(--lsp-radius);
  box-shadow: var(--lsp-shadow);
  pointer-events: auto;
  cursor: default;
  overflow: hidden;

  /* Bordure lumineuse subtile */
  outline: 1px solid rgba(255, 255, 255, 0.10);
  outline-offset: -1px;
}

/* Grain de texture discret */
.lsp-popup::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  opacity: 0.4;
}

/* Ligne accentuée en haut */
.lsp-popup::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--lsp-accent), transparent 70%);
  border-radius: var(--lsp-radius) var(--lsp-radius) 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ÉTATS D'ANIMATION
   ═══════════════════════════════════════════════════════════════════════════ */

/* Caché par défaut */
.lsp-popup.lsp-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

/* Entrée */
.lsp-popup.lsp-enter {
  animation: lsp-slide-in var(--lsp-anim-in) var(--lsp-easing) forwards;
  visibility: visible;
}

/* Sortie */
.lsp-popup.lsp-leave {
  animation: lsp-slide-out var(--lsp-anim-out) var(--lsp-easing-out) forwards;
}

@keyframes lsp-slide-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes lsp-slide-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   IMAGE PRODUIT
   ═══════════════════════════════════════════════════════════════════════════ */
.lsp-image-wrap {
  flex-shrink: 0;
  width: var(--lsp-img-size);
  height: var(--lsp-img-size);
  border-radius: calc(var(--lsp-radius) - 4px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.10);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

#lsp-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.lsp-image-wrap:hover #lsp-product-img {
  transform: scale(1.06);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENU TEXTE
   ═══════════════════════════════════════════════════════════════════════════ */
.lsp-content {
  flex: 1;
  min-width: 0;
}

.lsp-message {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--lsp-text);
  /* Tronquage sur 3 lignes max */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Prénom en accent */
.lsp-name {
  color: var(--lsp-accent);
  font-weight: 700;
}

/* Nom produit en gras */
.lsp-product {
  font-weight: 700;
}

/* Ville en italique subtil */
.lsp-city {
  font-style: italic;
}

.lsp-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.60);
  line-height: 1;
}

.lsp-verified-icon {
  display: flex;
  align-items: center;
  color: #4ade80; /* vert validation */
}

.lsp-dot {
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOUTON FERMETURE
   ═══════════════════════════════════════════════════════════════════════════ */
.lsp-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.70);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  z-index: 1;
}

.lsp-close:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: rotate(90deg);
}

.lsp-close:focus {
  outline: 2px solid var(--lsp-accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BARRE DE PROGRESSION
   ═══════════════════════════════════════════════════════════════════════════ */
.lsp-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0 0 var(--lsp-radius) var(--lsp-radius);
  overflow: hidden;
}

.lsp-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--lsp-accent), rgba(240, 165, 0, 0.6));
  transform-origin: left;
  transform: scaleX(1);
  transition: transform linear;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGE FAKE MODE (discret, visible uniquement en développement)
   ═══════════════════════════════════════════════════════════════════════════ */
.lsp-fake-badge {
  position: absolute;
  bottom: 5px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  .lsp-popup {
    /* Le dark mode renforce l'ombre */
    --lsp-shadow: 0 12px 40px rgba(0, 0, 0, 0.50), 0 2px 10px rgba(0, 0, 0, 0.30);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE – petit écran
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  #lsp-popup-wrapper {
    bottom: 0;
    left: 0 !important;
    right: 0 !important;
    padding: 0;
  }

  .lsp-popup {
    width: 100%;
    max-width: 100%;
    border-radius: var(--lsp-radius) var(--lsp-radius) 0 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITÉ – réduire les animations
   ═══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .lsp-popup.lsp-enter {
    animation: none;
    opacity: 1;
    transform: none;
    visibility: visible;
  }
  .lsp-popup.lsp-leave {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }
  .lsp-progress-fill {
    transition: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMPATIBILITÉ ELEMENTOR
   (éviter les conflits de z-index et de position)
   ═══════════════════════════════════════════════════════════════════════════ */
.elementor-editor-active #lsp-popup-wrapper {
  display: none !important;
}
