/* ============================================================
   Visite guidée Kit IA Pro — bulles fléchées sur les vrais champs
   + « scènes » plein écran sur des captures (PayPal, etc.).
   Chargé sur l'espace revendeur (/app) et les formations.
   ============================================================ */

:root {
  --tour-bg: #131c31;
  --tour-bg-2: #172138;
  --tour-line: #2c3b5c;
  --tour-txt: #e8eefc;
  --tour-soft: #c9d4ec;
  --tour-dim: #8391b3;
  --tour-acc: #3b82f6;
  --tour-acc-2: #2563eb;
  --tour-amber: #fbbf24;
  --tour-veil: rgba(4, 8, 18, .76);
}

/* ---------- Spot (le halo autour du vrai élément) ---------- */
.tour-spot {
  position: absolute;
  z-index: 9990;
  pointer-events: none;
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .95), 0 0 0 200vmax var(--tour-veil);
  transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease;
}
.tour-spot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid rgba(96, 165, 250, .9);
  animation: tour-pulse 1.7s ease-out infinite;
}
@keyframes tour-pulse {
  0%   { transform: scale(1);    opacity: .9; }
  100% { transform: scale(1.05); opacity: 0; }
}

/* Voile plein écran (étape sans cible, ou scène) */
.tour-veil {
  position: fixed;
  inset: 0;
  z-index: 9989;
  background: var(--tour-veil);
}

/* ---------- La bulle ---------- */
.tour-pop {
  position: absolute;
  z-index: 9995;
  width: min(370px, calc(100vw - 24px));
  box-sizing: border-box;
  background: var(--tour-bg);
  color: var(--tour-txt);
  border: 1px solid var(--tour-line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .3);
  padding: 18px 18px 14px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  overflow: visible;
}
.tour-pop.is-fixed { position: fixed; }
.tour-pop.is-center {
  position: fixed;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
}
.tour-pop::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--tour-bg);
  border: 1px solid var(--tour-line);
  transform: rotate(45deg);
  display: none;
}
.tour-pop[data-side="bottom"]::before { display: block; top: -8px;    left: var(--ax, 30px); border-right: 0; border-bottom: 0; }
.tour-pop[data-side="top"]::before    { display: block; bottom: -8px; left: var(--ax, 30px); border-left: 0;  border-top: 0; }
.tour-pop[data-side="right"]::before  { display: block; left: -8px;   top: var(--ay, 30px);  border-top: 0;   border-right: 0; }
.tour-pop[data-side="left"]::before   { display: block; right: -8px;  top: var(--ay, 30px);  border-bottom: 0; border-left: 0; }

.tour-bar {
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: #23304d;
  overflow: hidden;
}
.tour-bar i { display: block; height: 100%; background: var(--tour-acc); transition: width .3s ease; }

.tour-k {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #93c5fd;
  margin: 0 28px 4px 0;
}
.tour-t {
  margin: 0 28px 8px 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
  text-wrap: balance;
}
.tour-x {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--tour-dim);
  font-size: 18px;
  line-height: 28px;
  cursor: pointer;
}
.tour-x:hover { background: var(--tour-bg-2); color: #fff; }

.tour-b { color: var(--tour-soft); margin: 0; }
.tour-b b { color: #fff; }
.tour-b code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #0f172a;
  border: 1px solid var(--tour-line);
  border-radius: 6px;
  padding: 1px 6px;
  color: #dbeafe;
}
.tour-b p { margin: 0 0 8px; }
.tour-b p:last-child { margin-bottom: 0; }

.tour-do {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(245, 158, 11, .10);
  border: 1px solid rgba(245, 158, 11, .45);
  color: #fde68a;
  font-weight: 600;
  font-size: 13.5px;
}
.tour-do::before { content: "👉 "; }

.tour-img {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  border-radius: 8px;
  border: 1px solid var(--tour-line);
  background: #fff;
}

.tour-f {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--tour-line);
}
.tour-n { color: var(--tour-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tour-btns { display: flex; gap: 8px; }
.tour-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  background: var(--tour-acc-2);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
  text-decoration: none;
  white-space: nowrap;
}
.tour-btn:hover { background: var(--tour-acc); }
.tour-btn.ghost { background: transparent; color: var(--tour-soft); border-color: var(--tour-line); box-shadow: none; }
.tour-btn.ghost:hover { background: var(--tour-bg-2); color: #fff; }
.tour-btn:disabled { opacity: .4; cursor: default; }
.tour-cta {
  display: inline-block;
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 9px;
  background: rgba(59, 130, 246, .14);
  border: 1px solid rgba(59, 130, 246, .5);
  color: #dbeafe;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
}
.tour-cta:hover { background: rgba(59, 130, 246, .26); }

/* ---------- Scène (capture plein écran + point qui pulse) ---------- */
.tour-scene {
  position: fixed;
  inset: 0;
  z-index: 9992;
  background: #05080f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px 24px;
  box-sizing: border-box;
}
.tour-scene .where {
  position: absolute;
  top: 16px; left: 0; right: 0;
  text-align: center;
  color: var(--tour-dim);
  font-size: 13px;
}
.tour-scene .where b { color: var(--tour-soft); }
.tour-scene .shot { position: relative; line-height: 0; }
.tour-scene img {
  display: block;
  max-width: min(1120px, 94vw);
  max-height: calc(100vh - 150px);
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--tour-line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65);
  background: #fff;
}
.tour-dot {
  position: absolute;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: rgba(59, 130, 246, .95);
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(59, 130, 246, .35), 0 4px 14px rgba(0, 0, 0, .5);
  box-sizing: border-box;
}
.tour-dot::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid rgba(96, 165, 250, .9);
  animation: tour-pulse-dot 1.5s ease-out infinite;
}
@keyframes tour-pulse-dot {
  0%   { transform: scale(.6); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.tour-scene .cap { margin-top: 12px; color: var(--tour-dim); font-size: 12.5px; text-align: center; }

/* ---------- Bouton flottant + menu ---------- */
.tour-fab {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 9980;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--tour-acc-2);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(37, 99, 235, .45);
}
.tour-fab:hover { background: var(--tour-acc); }
.tour-menu {
  position: fixed;
  right: 18px; bottom: 68px;
  z-index: 9981;
  width: min(360px, calc(100vw - 36px));
  background: var(--tour-bg);
  border: 1px solid var(--tour-line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.tour-menu h4 { margin: 6px 10px 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--tour-dim); }
.tour-mi {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tour-txt);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tour-mi:hover { background: var(--tour-bg-2); }
.tour-mi .e { font-size: 22px; line-height: 1.1; }
.tour-mi b { display: block; color: #fff; font-size: 14.5px; }
.tour-mi span { display: block; color: var(--tour-dim); font-size: 13px; line-height: 1.35; }
.tour-mi.done b::after { content: " ✓"; color: #4ade80; }

/* Cartes / boutons de lancement dans les pages */
.tour-launch {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, .18), rgba(59, 130, 246, .06));
  border: 1px solid rgba(59, 130, 246, .5);
  color: #dbeafe;
  text-decoration: none;
  font-weight: 700;
}
.tour-launch .e { font-size: 24px; }
.tour-launch small { display: block; font-weight: 400; color: #a9b6d3; }
.tour-launch:hover { border-color: #60a5fa; }
.tour-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.tour-card {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-2, #172138);
  border: 1px solid var(--line-2, #2c3b5c);
  color: var(--txt, #e8eefc);
  text-decoration: none;
}
.tour-card:hover { border-color: var(--brand, #3b82f6); }
.tour-card .e { font-size: 22px; }
.tour-card b { display: block; margin-top: 6px; color: #fff; }
.tour-card span { display: block; font-size: 13px; color: var(--txt-soft, #a9b6d3); margin-top: 2px; }
.tour-card.done b::after { content: " ✓"; color: #4ade80; }

/* ---------- Mobile : bulle en tiroir bas ---------- */
@media (max-width: 640px) {
  .tour-pop,
  .tour-pop.is-fixed {
    position: fixed;
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: 8px;
    width: auto;
    max-height: 58vh;
    overflow: auto;
    transform: none;
  }
  .tour-pop::before { display: none !important; }
  .tour-scene { justify-content: flex-start; padding: 52px 10px 0; }
  .tour-scene img { max-height: 36vh; }
  .tour-fab { right: 12px; bottom: 12px; padding: 9px 13px; }
  .tour-menu { right: 12px; bottom: 60px; }
  /* Laisse de la place sous la page pour que le champ visé reste au-dessus du tiroir */
  body.tour-on { padding-bottom: 62vh !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot { transition: none; }
  .tour-spot::after, .tour-dot::after { animation: none; }
}

/* L'attribut hidden doit gagner sur nos display:flex/block */
.tour-spot[hidden], .tour-veil[hidden], .tour-scene[hidden], .tour-pop[hidden], .tour-menu[hidden], .tour-fab[hidden] { display: none !important; }
