/* ==========================================================================
   TUTORIEL D'ACCUEIL & SPOTLIGHT — DataGrandEst 2026
   - Overlay plein écran avec masque SVG (cutout spotlight précis)
   - Étape 1 : Grosse popup centrale d'accueil
   - Étape 2 : Popup en bas avec mise en valeur des contrôles de l'année
   ========================================================================== */

/* --- OVERLAY GLOBAL DU TUTORIEL --- */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9500;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
}

.tutorial-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* SVG Masque Spotlight */
.tutorial-svg-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
}

/* Rectangle de découpe animé dans le masque */
#tutorial-cutout-rect {
  transition: x 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              y 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              rx 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              ry 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Anneau lumineux autour de l'élément mis en valeur */
.tutorial-spotlight-glow {
  position: fixed;
  pointer-events: none;
  z-index: 9510;
  border: 2px solid #38bdf8;
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.3),
              0 0 25px rgba(56, 189, 248, 0.45);
  opacity: 0;
  transform: translateZ(0);
  transition: top 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.tutorial-spotlight-glow.active {
  opacity: 1;
}

.tutorial-spotlight-badge {
  display: none !important;
}

/* ==========================================================================
   POPUP ÉTAPE 1 : GROSSE POPUP CENTRALE D'ACCUEIL
   ========================================================================== */
.tutorial-modal-center {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 9600;
  width: 580px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.45),
              0 0 0 1px rgba(226, 232, 240, 0.9);
  padding: 34px 36px 28px 36px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease;
}

.tutorial-modal-center.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* En-tête de la popup centrale */
.tuto-modal-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tuto-contest-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  line-height: 1.35;
}

.tuto-contest-pill .contest-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b1bc04;
  flex-shrink: 0;
}

.tuto-modal-logo {
  height: 40px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

.tuto-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  width: fit-content;
  margin-bottom: 14px;
}

.tuto-badge-tag .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0284c7;
}

.tuto-modal-title {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.4px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.tuto-modal-subtitle {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 20px;
}

/* Corps descriptif sobre & épuré */
.tuto-modal-body {
  font-size: 14.5px;
  color: #334155;
  line-height: 1.6;
  margin-bottom: 24px;
}

.tuto-modal-body p {
  margin-bottom: 12px;
}

.tuto-highlights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.tuto-highlight-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tuto-highlight-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.tuto-highlight-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}

.tuto-highlight-desc {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.35;
}

/* ==========================================================================
   POPUP ÉTAPE 2 : CARTE EN BAS (EXPLICATION DES CONTRÔLES)
   ========================================================================== */
.tutorial-bottom-card {
  position: fixed;
  z-index: 9600;
  width: 550px;
  max-width: calc(100vw - 36px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.35),
              0 0 0 1px rgba(226, 232, 240, 0.9);
  padding: 22px 26px 18px 26px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  left: 50%;
  transition: opacity 0.3s ease,
              top 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-bottom-card.active {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-bottom-card.pos-center {
  top: 50%;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
}

.tutorial-bottom-card.pos-map,
.tutorial-bottom-card.pos-step3 {
  bottom: 24px;
  top: auto;
  left: 28px;
  right: auto;
  transform: none;
}

.tutorial-bottom-card.pos-station,
.tutorial-bottom-card.pos-step6 {
  bottom: 24px;
  top: auto;
  left: auto;
  right: 28px;
  transform: none;
}

@media (max-width: 1024px) {
  .tutorial-bottom-card {
    left: 50% !important;
    bottom: 18px !important;
    top: auto !important;
    transform: translateX(-50%) !important;
  }
}

.tuto-bottom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tuto-bottom-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tuto-bottom-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f0f9ff;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid #bae6fd;
}

.tuto-bottom-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

/* Liste des explications des contrôles de l'année */
.tuto-controls-guide {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.tuto-ctrl-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
}

.tuto-ctrl-keys {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 108px;
  flex-shrink: 0;
  padding-top: 2px;
}

.tuto-key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  gap: 5px;
}

.tuto-ctrl-info {
  flex: 1;
}

.tuto-ctrl-label {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.tuto-ctrl-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

/* ==========================================================================
   BARRE DE NAVIGATION COMMUNE (POPUP FOOTER)
   - Bouton passer les explications à gauche
   - Indicateur x/n au centre
   - Boutons Précédent & Suivant à droite
   ========================================================================== */
.tuto-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
}

/* Bouton "Passer les explications" */
.tuto-btn-skip {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 6px;
  transition: color 0.15s ease, text-decoration 0.15s ease;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tuto-btn-skip:hover {
  color: #0f172a;
}

/* Indicateur d'étape x/n */
.tuto-step-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

.tuto-step-counter span.step-highlight {
  color: #0284c7;
}

/* Groupe de boutons Précédent / Suivant */
.tuto-nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tuto-btn-prev {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tuto-btn-prev:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.tuto-btn-prev:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.tuto-btn-next {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  padding: 7px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
}

.tuto-btn-next:hover {
  background: #1e293b;
  border-color: #1e293b;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.2);
}

.tuto-btn-next:active {
  transform: translateY(0);
}

/* Variante bouton Terminer */
.tuto-btn-next.btn-finish {
  background: #0284c7;
  border-color: #0284c7;
}

.tuto-btn-next.btn-finish:hover {
  background: #0369a1;
  border-color: #0369a1;
}

/* --- BOUTON GUIDE DANS LE HEADER --- */
.header-tutorial-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 12px;
}

.header-tutorial-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.header-tutorial-btn .tuto-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}
