/* ===================================================================
   UI Enhancements — Cosmepharm
   Curseur personnalise · Progress bar · Micro-interactions ·
   Transitions de page · Reveal engagements
   =================================================================== */

/* ─── 1. CURSEUR PERSONNALISE — cercle plein ─── */

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  background: var(--blue);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2147483647;
  will-change: transform;
  transform: translate(-50%, -50%);
  transition: width .2s ease, height .2s ease, opacity .2s ease, background .2s ease;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .25), 0 2px 8px rgba(0, 137, 209, .3);
  opacity: .7;
}

/* Etat hover — le cercle grossit */
.cursor-hover .cursor-dot {
  width: 36px;
  height: 36px;
  background: rgba(0, 137, 209, .7);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .15), 0 4px 16px rgba(0, 137, 209, .35);
}

/* Etat texte — le cercle devient un I-beam */
.cursor-text .cursor-dot {
  width: 3px;
  height: 20px;
  border-radius: 2px;
  mix-blend-mode: normal;
  background: var(--blue);
}

/* Masquer en quittant la fenetre */
.cursor-hidden .cursor-dot {
  opacity: 0;
}

/* Masquer le curseur natif desktop
   Note : les <select> ouverts et checkbox/radio natifs sont rendus
   par l'OS — le curseur personnalise ne peut pas les couvrir. */
@media (pointer: fine) {
  body.has-custom-cursor,
  body.has-custom-cursor * {
    cursor: none !important;
  }
}

/* Pas de curseur custom sur tactile ou reduced-motion */
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor-dot {
    display: none !important;
  }
}

/* ─── 2. BOUTON SCROLL-TO-TOP + PROGRESS RING ─── */

.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--navy);
  cursor: pointer;
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background: var(--blue);
  box-shadow: 0 4px 20px rgba(0, 137, 209, .35);
}

/* Anneau de progression SVG */
.scroll-top-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.scroll-top-ring circle {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-dasharray: 125.66;
  stroke-dashoffset: 125.66;
  stroke-linecap: round;
  transition: stroke .2s ease;
}

.scroll-top-btn:hover .scroll-top-ring circle {
  stroke: #fff;
}

/* Fleche vers le haut */
.scroll-top-arrow {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
  z-index: 1;
}

/* ─── 3. MICRO-INTERACTIONS BOUTONS ─── */

/* Ripple au clic */
.btn-cta,
.btn-outline {
  position: relative;
  overflow: hidden;
}

.btn-cta .ripple,
.btn-outline .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  transform: scale(0);
  animation: ripple-expand .6s ease forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Pulse subtil sur CTA principaux (hors navbar) */
.cta-final .btn-cta,
.hero-actions .btn-cta {
  animation: cta-pulse 3s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 137, 209, .3);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(0, 137, 209, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cta-final .btn-cta,
  .hero-actions .btn-cta {
    animation: none;
  }
}

/* Focus anime sur les champs de formulaire */
input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  transition: border-color .3s ease, box-shadow .3s ease;
}

input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 137, 209, .1) !important;
  outline: none;
}

/* ─── 5. REVEAL ENGAGEMENTS ─── */

/* Chaque feature arrive individuellement */
.engagement-feat {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity .5s ease, transform .5s ease;
}

.engagement-feat.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Icone check animee */
.engagement-feat.revealed .engagement-feat-icon {
  animation: icon-pop .4s ease forwards;
}

@keyframes icon-pop {
  0% {
    transform: scale(0) rotate(-45deg);
  }
  60% {
    transform: scale(1.2) rotate(0);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* Pharmacien card slide-up */
.pharmacien-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}

.pharmacien-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Hover interactif sur les features */
.engagement-feat {
  cursor: default;
  transition: opacity .5s ease, transform .5s ease, padding-left .25s ease, background .25s ease;
  padding: .5rem .75rem;
  border-radius: 6px;
  margin: -.5rem -.75rem;
  margin-bottom: 0;
}

.engagement-feat:hover {
  background: var(--blue-light);
  padding-left: 1rem;
}

.engagement-feat:hover .engagement-feat-icon {
  background: var(--blue);
  transition: background .25s ease;
}

.engagement-feat:hover .engagement-feat-icon svg {
  stroke: #fff;
  transition: stroke .25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .engagement-feat {
    opacity: 1;
    transform: none;
  }

  .pharmacien-card {
    opacity: 1;
    transform: none;
  }

  .engagement-feat.revealed .engagement-feat-icon {
    animation: none;
  }
}
