/*
 * Tutorial amélioré pour l'étape 2 du configurateur solaire
 * Design moderne avec animations ludiques
 */

/* Variables CSS pour le tutoriel */
:root {
  --tutorial-primary: #f6d13b;
  --tutorial-primary-light: #fef6db;
  --tutorial-secondary: #f59e0b;
  --tutorial-success: #10b981;
  --tutorial-gradient: linear-gradient(135deg, #ff8a00 0%, #ecae53 100%);
  --tutorial-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --tutorial-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --tutorial-border-radius: 16px;
  --tutorial-animation-duration: 0.3s;
  --tutorial-bounce-duration: 1.2s;
}

/* Bulle de tutoriel principale - Design moderne */
.tutorial-bubble {
  position: absolute;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--tutorial-border-radius);
  padding: 1.5rem;
  box-shadow: var(--tutorial-shadow);
  z-index: 10000;
  max-width: 320px;
  min-width: 280px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transform: scale(0.8) translateY(10px);
  opacity: 0;
  animation: tutorialAppear var(--tutorial-animation-duration) ease-out forwards;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* Effet de bordure colorée */
.tutorial-bubble::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: var(--tutorial-gradient);
  border-radius: var(--tutorial-border-radius);
  z-index: -1;
  animation: borderGlow 2s ease-in-out infinite alternate;
}

/* Flèche moderne avec dégradé */
.tutorial-bubble::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 15px 15px 0 15px;
  border-color: #ffffff transparent transparent transparent;
  bottom: -15px;
  left: 30px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.1));
  animation: arrowBounce var(--tutorial-bounce-duration) ease-in-out infinite;
}

/* Contenu de la bulle */
.tutorial-content {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.6;
  color: #514d37;
  position: relative;
}

/* Icône décorative au début du contenu */
.tutorial-content::before {
  content: "💡";
  font-size: 1.5rem;
  position: absolute;
  left: -2.5rem;
  top: -0.25rem;
  animation: iconPulse 2s ease-in-out infinite;
}

/* Indicateur d'étape */
.tutorial-step-indicator {
  position: absolute;
  top: 5px;
  right: 15px;
  background: var(--tutorial-gradient);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(246, 193, 59, 0.3);
  animation: stepIndicatorFloat 3s ease-in-out infinite;
}

/* Actions de la bulle */
.tutorial-bubble-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Boutons de navigation modernes */
.tutorial-prev,
.tutorial-next,
.tutorial-close {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--tutorial-animation-duration) ease;
  position: relative;
  overflow: hidden;
}

.tutorial-prev {
  background: linear-gradient(45deg, #807e6b, #afab9c);
  color: white;
  box-shadow: 0 4px 12px rgba(128, 125, 107, 0.3);
}

.tutorial-next {
  background: var(--tutorial-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(246, 209, 59, 0.4);
  animation: nextButtonPulse 2s ease-in-out infinite;
}

.tutorial-close {
  background: transparent;
  color: #807C6B;
  border: 2px solid #e5e7eb;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
}

/* Effets hover sur les boutons */
.tutorial-prev:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.tutorial-next:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(246, 209, 59, 0.5);
}

.tutorial-close:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: scale(1.05);
}

/* Highlight des éléments - Effet néon moderne */
.tutorial-highlight {
  position: relative;
  z-index: 10001;
  border-radius: 12px;
  animation: highlightPulse 2s ease-in-out infinite;
  transition: all 0.3s ease;
  padding: 5px;
}

.tutorial-highlight::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  background: var(--tutorial-gradient);
  border-radius: 16px;
  z-index: -1;
  opacity: 0.8;
  animation: glowEffect 1.5s ease-in-out infinite alternate;
}

.tutorial-highlight::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  background: var(--tutorial-gradient);
  border-radius: 20px;
  z-index: -2;
  opacity: 0.3;
  animation: outerGlow 2s ease-in-out infinite;
}

/* Bouton d'aide moderne */
.help-btn {
  margin-left: 0.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tutorial-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all var(--tutorial-animation-duration) ease;
  box-shadow: 0 4px 12px rgba(246, 193, 59, 0.3);
  animation: helpButtonFloat 3s ease-in-out infinite;
}

.help-btn:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 6px 20px rgba(246, 202, 59, 0.5);
  animation: helpButtonSpin 0.6s ease-in-out;
}

/* Overlay de fond pour le focus */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9999;
  backdrop-filter: blur(2px);
  opacity: 0;
  animation: overlayFadeIn var(--tutorial-animation-duration) ease-out forwards;
}

/* Indicateur de progression du tutoriel */
.tutorial-progress {
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 10001;
}

.tutorial-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: all var(--tutorial-animation-duration) ease;
}

.tutorial-progress-dot.active {
  background: var(--tutorial-primary);
  transform: scale(1.5);
  box-shadow: 0 0 12px rgba(246, 181, 59, 0.6);
}

/* Animations */
@keyframes tutorialAppear {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes borderGlow {
  from {
    filter: hue-rotate(0deg) brightness(1);
  }
  to {
    filter: hue-rotate(20deg) brightness(1.1);
  }
}

@keyframes arrowBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes iconPulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
}

@keyframes stepIndicatorFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.05);
  }
}

@keyframes nextButtonPulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(246, 202, 59, 0.4);
  }
  50% {
    box-shadow: 0 6px 20px rgba(246, 230, 59, 0.6);
  }
}

@keyframes highlightPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes glowEffect {
  from {
    opacity: 0.6;
    filter: blur(2px);
  }
  to {
    opacity: 0.9;
    filter: blur(0px);
  }
}

@keyframes outerGlow {
  0%, 100% {
    opacity: 0.2;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.02);
  }
}

@keyframes helpButtonFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  33% {
    transform: translateY(-2px) rotate(2deg);
  }
  66% {
    transform: translateY(2px) rotate(-2deg);
  }
}

@keyframes helpButtonSpin {
  from {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  to {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Confettis pour célébrer la fin du tutoriel */
.tutorial-confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--tutorial-secondary);
  z-index: 10002;
  animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .tutorial-bubble {
    max-width: 280px;
    min-width: 250px;
    padding: 1.25rem;
  }

  .tutorial-content::before {
    left: -2rem;
  }

  .tutorial-bubble-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tutorial-prev,
  .tutorial-next,
  .tutorial-close {
    width: 100%;
    justify-content: center;
  }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
  .tutorial-bubble {
    background: linear-gradient(145deg, #37321f 0%, #272411 100%);
    color: #f9fafb;
  }

  .tutorial-content {
    color: #272411 ;
  }

  .tutorial-bubble::after {
    border-color: #1f2937 transparent transparent transparent;
  }
}