/* ════════════════════════════════════════════════════════════════════
   Brief Onboarding — modales d'accueil, tooltips d'aide, empty states
   Réutilisable sur toutes les pages via BriefOnboarding (onboarding.js)
════════════════════════════════════════════════════════════════════ */

/* ── Modal de bienvenue (premier passage) ───────────────────── */
.bo-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
  font-family: 'Nunito', sans-serif;
}
.bo-overlay.bo-open { opacity: 1; pointer-events: auto; }

.bo-modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: translateY(12px) scale(.98);
  transition: transform .22s ease;
  overflow: hidden;
}
.bo-overlay.bo-open .bo-modal { transform: translateY(0) scale(1); }

.bo-head {
  padding: 22px 24px 14px;
  background: linear-gradient(135deg, #4f8cff 0%, #6ba4ff 100%);
  color: #fff; position: relative;
  flex-shrink: 0;
}
.bo-head-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 10px;
}
.bo-head-title {
  font-size: 1.15rem; font-weight: 800; margin: 0;
  letter-spacing: -0.01em;
}
.bo-head-sub {
  font-size: 0.82rem; opacity: .92; margin-top: 4px;
}
.bo-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.2); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; transition: background .15s;
}
.bo-close:hover { background: rgba(255,255,255,.32); }

.bo-body {
  padding: 18px 24px 8px;
  overflow-y: auto;
  flex: 1; min-height: 0;
}

.bo-intro {
  font-size: 0.88rem; color: #475569;
  line-height: 1.5; margin-bottom: 16px;
  padding: 12px 14px; border-radius: 10px;
  background: #f6f8fd; border-left: 3px solid #4f8cff;
}

.bo-steps {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.bo-step {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px;
  background: #fafbfc; border: 1px solid #eef0f4;
  transition: transform .15s, box-shadow .15s;
}
.bo-step:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,140,255,.08);
  border-color: #dbe5ff;
}
.bo-step-num {
  flex-shrink: 0; width: 30px; height: 30px;
  border-radius: 50%; background: #4f8cff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
}
.bo-step-body { flex: 1; min-width: 0; }
.bo-step-title {
  font-weight: 700; color: #1e293b;
  font-size: 0.92rem; margin-bottom: 2px;
}
.bo-step-desc {
  font-size: 0.82rem; color: #64748b;
  line-height: 1.45;
}

.bo-foot {
  padding: 14px 24px 18px;
  border-top: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  flex-shrink: 0;
}
.bo-dontshow {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.78rem; color: #64748b; cursor: pointer;
  user-select: none;
}
.bo-dontshow input { accent-color: #4f8cff; cursor: pointer; }

.bo-cta {
  background: #4f8cff; color: #fff;
  border: none; border-radius: 10px;
  padding: 11px 22px; font-weight: 700;
  font-size: 0.88rem; cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background .15s, transform .1s;
  display: inline-flex; align-items: center; gap: 8px;
}
.bo-cta:hover { background: #3d78e8; }
.bo-cta:active { transform: scale(.98); }

/* ── Tooltip d'aide contextuel (?) ──────────────────────────── */
.bo-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #e2e8f0; color: #64748b;
  font-size: 0.65rem; font-weight: 800;
  cursor: help; margin-left: 6px;
  transition: background .15s, color .15s;
  font-family: 'Nunito', sans-serif;
  vertical-align: middle;
  border: none;
}
.bo-tip:hover { background: #4f8cff; color: #fff; }
.bo-tip::before { content: "?"; }

.bo-tip-pop {
  position: fixed; z-index: 2147483000;
  max-width: 260px;
  background: #1e293b; color: #fff;
  padding: 9px 12px; border-radius: 8px;
  font-size: 0.76rem; line-height: 1.45;
  font-family: 'Nunito', sans-serif;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none;
  transform: translateY(4px);
  transition: opacity .15s, transform .15s;
}
.bo-tip-pop.bo-open { opacity: 1; transform: translateY(0); }
.bo-tip-pop::before {
  content: ""; position: absolute;
  width: 8px; height: 8px; background: #1e293b;
  transform: rotate(45deg);
}
.bo-tip-pop[data-side="top"]::before    { bottom: -4px; left: 12px; }
.bo-tip-pop[data-side="bottom"]::before { top: -4px; left: 12px; }

/* ── Empty state amélioré (réutilisable) ────────────────────── */
.bo-empty {
  padding: 28px 18px; text-align: center;
}
.bo-empty-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #f0f4ff; color: #4f8cff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 12px;
}
.bo-empty-title {
  font-size: 0.98rem; font-weight: 800; color: #1e293b;
  margin-bottom: 6px;
}
.bo-empty-desc {
  font-size: 0.8rem; color: #64748b; line-height: 1.5;
  margin-bottom: 14px;
}
.bo-empty-options {
  display: flex; flex-direction: column; gap: 6px;
  text-align: left; max-width: 260px; margin: 0 auto 14px;
}
.bo-empty-option {
  padding: 8px 11px; border-radius: 8px;
  background: #f8fafc; border: 1px solid #eef0f4;
  font-size: 0.78rem; color: #475569;
  display: flex; align-items: center; gap: 8px;
}
.bo-empty-option-icon {
  color: #4f8cff; font-size: 0.85rem; flex-shrink: 0;
}
.bo-empty-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
}
.bo-empty-chip {
  background: #fff; border: 1px solid #dbe5ff;
  color: #4f8cff; font-size: 0.75rem; font-weight: 600;
  padding: 6px 12px; border-radius: 50px;
  cursor: pointer; transition: background .15s;
  font-family: 'Nunito', sans-serif;
}
.bo-empty-chip:hover { background: #f0f4ff; }

/* ── Bouton "Revoir la présentation" (inline, ex: dans empty state) ── */
.bo-replay {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none;
  color: #94a3b8; font-size: 0.72rem;
  cursor: pointer; padding: 6px 10px;
  font-family: 'Nunito', sans-serif;
  transition: color .15s;
}
.bo-replay:hover { color: #4f8cff; }

/* ── Bouton global topbar (même emplacement sur toutes les pages) ── */
.bo-replay-global {
  display: none;
  align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: 50px;
  background: linear-gradient(135deg, #4f8cff 0%, #6ba4ff 100%);
  color: #fff; border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  margin-right: 12px;
  box-shadow: 0 2px 8px rgba(79,140,255,.3);
  transition: transform .15s, box-shadow .15s, filter .15s;
  position: relative;
}
.bo-replay-global.is-available { display: inline-flex; }
.bo-replay-global:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,140,255,.45);
  filter: brightness(1.05);
}
.bo-replay-global:active { transform: translateY(0); }
.bo-replay-global:focus-visible {
  outline: 2px solid #4f8cff; outline-offset: 2px;
}
.bo-replay-global i {
  font-size: 0.95rem;
  animation: bo-bulb-glow 2.8s ease-in-out infinite;
}
.bo-replay-global-label { white-space: nowrap; }

/* Pulse d'attention tant que l'utilisateur n'a pas encore vu la modale */
.bo-replay-global.is-pulse {
  animation: bo-pulse-ring 1.8s ease-out infinite;
}
@keyframes bo-pulse-ring {
  0%   { box-shadow: 0 2px 8px rgba(79,140,255,.3), 0 0 0 0 rgba(79,140,255,.55); }
  70%  { box-shadow: 0 2px 8px rgba(79,140,255,.3), 0 0 0 12px rgba(79,140,255,0); }
  100% { box-shadow: 0 2px 8px rgba(79,140,255,.3), 0 0 0 0 rgba(79,140,255,0); }
}
@keyframes bo-bulb-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255,230,130,0)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 4px rgba(255,230,130,.9)); transform: scale(1.08); }
}

/* Mobile : icône seule, format circulaire compact */
@media (max-width: 640px) {
  .bo-replay-global {
    width: 36px; height: 36px; padding: 0;
    border-radius: 50%; margin-right: 8px;
  }
  .bo-replay-global-label { display: none; }
  .bo-replay-global i { font-size: 1rem; }
}

/* ── Boutons modale (primaire + secondaire) ───────────────── */
.bo-cta-secondary {
  background: transparent; color: #64748b;
  border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 11px 18px; font-weight: 600;
  font-size: 0.85rem; cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background .15s, color .15s, border-color .15s;
}
.bo-cta-secondary:hover { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
.bo-foot-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ════════════════════════════════════════════════════════════
   Visite guidée interactive (tour)
═════════════════════════════════════════════════════════════ */

/* Les 4 zones sombres autour du target (forment un "trou" sur le target) */
.bo-tour-mask {
  position: fixed; z-index: 10000;
  background: rgba(15, 23, 42, 0.68);
  pointer-events: auto;
  transition: all .25s ease;
}

/* Contour lumineux autour de l'élément ciblé */
.bo-tour-highlight {
  position: fixed; z-index: 10001;
  border-radius: 8px;
  pointer-events: none;
  box-shadow:
    0 0 0 3px rgba(79, 140, 255, 0.85),
    0 0 0 6px rgba(79, 140, 255, 0.25),
    0 0 24px rgba(79, 140, 255, 0.5);
  transition: all .25s ease;
  animation: bo-tour-pulse 1.8s ease-in-out infinite;
}
@keyframes bo-tour-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(79,140,255,.85), 0 0 0 6px rgba(79,140,255,.25), 0 0 24px rgba(79,140,255,.5); }
  50%      { box-shadow: 0 0 0 3px rgba(79,140,255,.85), 0 0 0 10px rgba(79,140,255,.15), 0 0 32px rgba(79,140,255,.65); }
}

/* Bulle de la visite (tooltip positionnée près du target) */
.bo-tour-bubble {
  position: fixed; z-index: 10002;
  width: min(360px, calc(100vw - 32px));
  background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  font-family: 'Nunito', sans-serif;
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
  overflow: hidden;
}
.bo-tour-bubble.bo-open { opacity: 1; transform: translateY(0); }

/* Si aucun target : bulle centrée façon modale compacte */
.bo-tour-bubble.bo-center {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) translateY(4px);
}
.bo-tour-bubble.bo-center.bo-open {
  transform: translate(-50%, -50%) translateY(0);
}

.bo-tour-arrow {
  position: absolute; width: 14px; height: 14px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: -2px -2px 4px rgba(0,0,0,.04);
}
.bo-tour-bubble[data-placement="bottom"] .bo-tour-arrow {
  top: -6px; left: 50%; margin-left: -7px;
}
.bo-tour-bubble[data-placement="top"] .bo-tour-arrow {
  bottom: -6px; left: 50%; margin-left: -7px;
  box-shadow: 2px 2px 4px rgba(0,0,0,.04);
}
.bo-tour-bubble[data-placement="right"] .bo-tour-arrow {
  left: -6px; top: 50%; margin-top: -7px;
  box-shadow: -2px 2px 4px rgba(0,0,0,.04);
}
.bo-tour-bubble[data-placement="left"] .bo-tour-arrow {
  right: -6px; top: 50%; margin-top: -7px;
  box-shadow: 2px -2px 4px rgba(0,0,0,.04);
}
.bo-tour-bubble.bo-center .bo-tour-arrow { display: none; }

.bo-tour-head {
  padding: 14px 16px 8px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.bo-tour-counter {
  font-size: 0.7rem; font-weight: 700;
  color: #94a3b8; letter-spacing: .08em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.bo-tour-progress {
  display: inline-flex; gap: 3px; margin-left: 4px;
}
.bo-tour-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #e2e8f0; transition: background .2s;
}
.bo-tour-dot.is-done { background: #cbd5e1; }
.bo-tour-dot.is-current { background: #4f8cff; width: 18px; border-radius: 6px; }
.bo-tour-close {
  width: 24px; height: 24px; border-radius: 50%;
  background: transparent; border: none;
  color: #94a3b8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: background .15s;
}
.bo-tour-close:hover { background: #f1f5f9; color: #334155; }

.bo-tour-body {
  padding: 2px 16px 8px;
}
.bo-tour-title {
  font-size: 0.98rem; font-weight: 800; color: #1e293b;
  margin-bottom: 5px;
}
.bo-tour-desc {
  font-size: 0.85rem; color: #475569;
  line-height: 1.5;
}

.bo-tour-foot {
  padding: 10px 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.bo-tour-skip {
  background: transparent; border: none;
  color: #94a3b8; font-size: 0.78rem;
  cursor: pointer; font-family: 'Nunito', sans-serif;
  padding: 6px 4px;
}
.bo-tour-skip:hover { color: #64748b; text-decoration: underline; }

.bo-tour-nav {
  display: flex; gap: 6px; align-items: center;
}
.bo-tour-btn {
  background: #4f8cff; color: #fff;
  border: none; border-radius: 8px;
  padding: 8px 14px; font-weight: 700;
  font-size: 0.82rem; cursor: pointer;
  font-family: 'Nunito', sans-serif;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.bo-tour-btn:hover { background: #3d78e8; }
.bo-tour-btn.bo-tour-btn-prev {
  background: #f1f5f9; color: #475569;
}
.bo-tour-btn.bo-tour-btn-prev:hover { background: #e2e8f0; }

/* Bouton "Terminer la visite" (dernière étape) — mise en valeur */
.bo-tour-btn.bo-tour-btn-finish {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  padding: 10px 18px;
  font-size: 0.88rem;
  box-shadow: 0 3px 10px rgba(34,197,94,.3);
}
.bo-tour-btn.bo-tour-btn-finish:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 4px 14px rgba(34,197,94,.4);
}

/* Étape "attente d'action" (waitForClick) */
.bo-tour-waithint {
  margin-top: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  color: #9a3412; font-size: 0.78rem; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
  animation: bo-tour-hint-pulse 1.6s ease-in-out infinite;
}
@keyframes bo-tour-hint-pulse {
  0%, 100% { opacity: .9; }
  50%      { opacity: 1; }
}

/* Responsive bulle */
@media (max-width: 480px) {
  .bo-tour-bubble { width: calc(100vw - 24px); }
  .bo-tour-head { padding: 12px 14px 6px; }
  .bo-tour-body { padding: 0 14px 8px; }
  .bo-tour-foot { padding: 10px 14px 12px; }
  .bo-tour-title { font-size: 0.92rem; }
  .bo-tour-desc { font-size: 0.8rem; }
}

/* ── Responsive mobile — modale ──────────────────────────────── */
@media (max-width: 560px) {
  .bo-modal { max-width: 100%; border-radius: 14px; }
  .bo-head { padding: 18px 18px 12px; }
  .bo-head-title { font-size: 1.05rem; }
  .bo-body { padding: 14px 18px 6px; }
  .bo-foot { padding: 12px 18px 14px; }
  .bo-step { padding: 9px 10px; gap: 11px; }
  .bo-step-num { width: 26px; height: 26px; font-size: 0.78rem; }
  .bo-step-title { font-size: 0.88rem; }
  .bo-step-desc { font-size: 0.78rem; }
}
