/* =====================================================================
 * wizard.css  —  DesignCV Module 7 (Assistant de création guidée)
 * ---------------------------------------------------------------------
 * OVERLAY : ne modifie pas style.css. Réutilise les tokens (--primary,
 * --surface, --border, --text, --text-secondary, --text-muted, --radius,
 * --transition, --shadow) définis dans :root.
 * ===================================================================== */

/* --- Panel flottant ----------------------------------------------------- */
.wizard-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.35),
              0 4px 12px rgba(15, 23, 42, 0.1);
  z-index: 9000;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}

.wizard-panel.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --- Barre de progression ---------------------------------------------- */
.wizard-progress {
  height: 4px;
  background: color-mix(in srgb, var(--primary) 12%, var(--border));
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #10B981));
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

/* --- En-tête ------------------------------------------------------------ */
.wizard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.wizard-step-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.wizard-step-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 10px;
}

.wizard-step-counter {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 2px;
}

.wizard-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
  font-family: 'Playfair Display', serif;
}

.wizard-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.wizard-close:hover {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  color: var(--text);
}

.wizard-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Corps -------------------------------------------------------------- */
.wizard-body {
  padding: 12px 16px 14px;
}

.wizard-instructions {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.wizard-instructions strong {
  color: var(--text);
  font-weight: 600;
}

.wizard-tips {
  margin-top: 10px;
}

.wizard-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, #F59E0B 8%, var(--surface));
  border: 1px solid color-mix(in srgb, #F59E0B 25%, var(--border));
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.wizard-tip span {
  flex: 1;
}

/* --- Pied : boutons ----------------------------------------------------- */
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 50%, var(--surface));
}

.wizard-footer .btn-sm {
  font-size: 0.78rem;
  padding: 6px 12px;
  min-height: 32px;
}

.wizard-footer .btn-ghost {
  margin-right: auto;
}

.wizard-footer .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Bouton "Terminer" vert pour la dernière étape */
.wizard-footer .btn-success {
  background: #059669 !important;
  color: #fff !important;
  border-color: #059669 !important;
}

.wizard-footer .btn-success:hover {
  background: #047857 !important;
}

/* --- Spotlight sur la section active ----------------------------------- */
.wizard-spotlight {
  position: relative;
  z-index: 1;
  border-radius: 12px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent),
              0 0 0 6px color-mix(in srgb, var(--primary) 12%, transparent),
              0 8px 30px -8px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--surface);
}

/* Assombrit légèrement le reste quand le wizard est actif */
body.wizard-active .form-panel {
  position: relative;
}

body.wizard-active .form-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.04);
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

body.wizard-active .form-panel > * {
  position: relative;
  z-index: 2;
}

body.wizard-active .wizard-spotlight {
  z-index: 3;
}

/* Pulse discret sur le champ clé de l'étape */
.wizard-cta-pulse {
  animation: wizard-cta-pulse 2s ease-out 1;
}

@keyframes wizard-cta-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
  30% { box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.35); }
  70% { box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15); }
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 700px) {
  .wizard-panel {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }

  .wizard-header {
    padding: 12px 12px 8px;
  }

  .wizard-step-icon {
    width: 34px;
    height: 34px;
    font-size: 1.2rem;
  }

  .wizard-title {
    font-size: 0.92rem;
  }

  .wizard-instructions {
    font-size: 0.82rem;
  }

  .wizard-footer {
    padding: 8px 12px 12px;
    flex-wrap: wrap;
  }

  .wizard-footer .btn-sm {
    font-size: 0.74rem;
    padding: 6px 10px;
  }
}

/* --- Accessibilité ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .wizard-panel,
  .wizard-progress-fill,
  .wizard-spotlight,
  .wizard-cta-pulse {
    transition: none !important;
    animation: none !important;
  }
}

/* --- Dark mode --------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  .wizard-panel {
    background: #1E293B;
    border-color: #334155;
  }

  .wizard-title {
    color: #F1F5F9;
  }

  .wizard-instructions {
    color: #CBD5E1;
  }

  .wizard-instructions strong {
    color: #F8FAFC;
  }

  .wizard-footer {
    background: #0F172A;
  }
}
