/* ============================================
   FICHIER : guide.css
   VERSION : 2026.08.29
   OBJET   : Guide "1ère connexion" (walkthrough)
             - Overlay assombri + spotlight ("trou" lumineux
               autour de la cible via box-shadow)
             - Bulle explicative avec flèche + navigation
             - Bouton aide ❓ dans le header (relance du guide)
   CHANGTS :
     - Création initiale
   ============================================ */

/* === Variables du guide (compatibles thèmes clair/sombre) === */
:root {
  --guide-bg: #ffffff;
  --guide-text: #222;
  --guide-sub: #666;
  --guide-border: rgba(0, 0, 0, 0.15);
  --guide-shadow: rgba(0, 0, 0, 0.35);
  --guide-overlay: rgba(15, 15, 15, 0.55);
  --guide-spotlight: rgba(15, 15, 15, 0.72);
}

body[data-theme="dark"] {
  --guide-bg: #2b2b2b;
  --guide-text: #eee;
  --guide-sub: #bbbbbb;
  --guide-border: rgba(255, 255, 255, 0.14);
  --guide-shadow: rgba(0, 0, 0, 0.6);
  --guide-overlay: rgba(0, 0, 0, 0.68);
  --guide-spotlight: rgba(0, 0, 0, 0.78);
}

/* === Overlay général === */
#guideOverlay.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--guide-overlay);
  transition: opacity 0.25s ease;
}

#guideOverlay.guide-overlay.guide-hidden {
  display: none;
}

/* === Spotlight (trou lumineux autour de la cible) === */
.guide-spotlight {
  position: fixed;
  z-index: 5001;
  border-radius: 12px;
  border: 2px dashed var(--accent);
  box-shadow: 0 0 0 9999px var(--guide-spotlight);
  pointer-events: none;
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.guide-spotlight.guide-hidden {
  display: none;
}

.guide-spotlight.guide-pop {
  animation: guidePulse 1.4s ease-in-out infinite;
}

@keyframes guidePulse {
  0%, 100% {
    box-shadow: 0 0 0 9999px var(--guide-spotlight);
  }
  50% {
    box-shadow: 0 0 0 9999px var(--guide-spotlight), 0 0 0 18px rgba(255, 204, 136, 0.22);
  }
}

/* === Bulle explicative === */
.guide-bubble {
  position: fixed;
  z-index: 5002;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--guide-bg);
  color: var(--guide-text);
  border: 1px solid var(--guide-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--guide-shadow);
  padding: 14px 16px 12px;
  box-sizing: border-box;
  transition: left 0.3s ease, top 0.3s ease, opacity 0.2s ease;
}

/* Flèche (alignée avec la cible via --guide-arrow-left) */
.guide-bubble::after {
  content: "";
  position: absolute;
  left: var(--guide-arrow-left, 50%);
  margin-left: -10px;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  pointer-events: none;
}

/* Bulle SOUS la cible → flèche vers le haut */
.guide-bubble.guide-below::after {
  top: -20px;
  border-bottom-color: var(--guide-bg);
}

/* Bulle AU-DESSUS de la cible → flèche vers le bas */
.guide-bubble.guide-above::after {
  bottom: -20px;
  border-top-color: var(--guide-bg);
}

.guide-title {
  display: block;
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--guide-text);
}

.guide-text {
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 0 0 10px;
  color: var(--guide-sub);
  white-space: pre-line; /* préserve les sauts de ligne (\n) dans le texte du guide */
}

.guide-counter {
  font-size: 0.78rem;
  color: var(--guide-sub);
  margin-bottom: 8px;
  text-align: right;
}

.guide-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.guide-btn {
  border: 1px solid var(--guide-border);
  background: transparent;
  color: var(--guide-text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.guide-btn:hover {
  background: rgba(128, 128, 128, 0.15);
}

.guide-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.guide-btn-skip {
  margin-right: auto;
}

.guide-btn-next {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: bold;
}

.guide-btn-next:hover {
  background: #ffddaa;
}

.guide-btn-close {
  border-color: transparent;
  font-size: 0.9rem;
  padding: 6px 8px;
}

/* === Bouton Aide ❓ dans le header === */
#guideBtn.guide-btn-help {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  line-height: 1;
  font-size: 0.95rem;
  cursor: pointer;
  margin-left: 10px;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.3s ease, color 0.3s ease;
}

#guideBtn.guide-btn-help:hover {
  background: var(--accent);
  color: #000;
}

/* En mode "shrink" du header, on garde le bouton discret */
.page-header.mid #guideBtn.guide-btn-help,
.page-header.shrink #guideBtn.guide-btn-help {
  width: 24px;
  height: 24px;
  font-size: 0.8rem;
}

/* === Responsive : en mobile, la bulle s'adapte (position gérée en JS) === */
@media (max-width: 768px) {
  .guide-bubble {
    width: auto;
  }
}