/**
 * FAFA - Animations et Transitions Professionnelles
 * NSIA Assurances Togo
 */

/* ============================================
   ANIMATIONS GLOBALES
   ============================================ */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-7px);
  }
}

/* Glow */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(229, 62, 62, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(229, 62, 62, 0.8);
  }
}

/* Float */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Rotate */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 100% 0;
  }
}

/* ============================================
   CLASSES D'ANIMATION
   ============================================ */

.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 1; /* Visible par défaut */
}

.animate-slide-left {
  animation: slideInLeft 0.6s ease-out forwards;
  opacity: 1; /* Visible par défaut */
}

.animate-slide-right {
  animation: slideInRight 0.6s ease-out forwards;
  opacity: 1; /* Visible par défaut */
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out forwards;
  opacity: 1; /* Visible par défaut */
}

/* Cacher seulement si JavaScript est activé */
html.animations-loaded .animate-fade-in {
  opacity: 0;
}

html.animations-loaded .animate-slide-left {
  opacity: 0;
}

html.animations-loaded .animate-slide-right {
  opacity: 0;
}

html.animations-loaded .animate-scale-in {
  opacity: 0;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-bounce {
  animation: bounce 2s infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Délais d'animation */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* ============================================
   TRANSITIONS POUR ÉLÉMENTS INTERACTIFS
   ============================================ */

/* Transitions globales */
* {
  transition-property: none;
}

a, button, input, textarea, select, .card, .btn, .form-control {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Boutons */
button, .btn {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition: all 0.3s ease;
}

button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

button:active, .btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

/* Effet ripple pour boutons */
button::after, .btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::after, .btn:active::after {
  width: 300px;
  height: 300px;
}

/* Cards et conteneurs */
.card, .box, .panel {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover, .box:hover, .panel:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* Inputs et formulaires */
input, textarea, select {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

input:focus, textarea:focus, select:focus {
  transform: translateY(-2px);
  border-color: #e53e3e;
  box-shadow: 0 5px 15px rgba(229, 62, 62, 0.1);
  outline: none;
}

/* Images avec hover effect */
img {
  transition: transform 0.3s ease, filter 0.3s ease;
}

img:hover {
  transform: scale(1.05);
}

/* Links */
a {
  position: relative;
  text-decoration: none;
  transition: color 0.3s ease;
}

a::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #e53e3e;
  transition: width 0.3s ease;
}

a:hover::before {
  width: 100%;
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(229, 62, 62, 0.1);
  border-top-color: #e53e3e;
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

.loading-dots {
  display: inline-flex;
  gap: 5px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  background: #e53e3e;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

.scroll-reveal {
  opacity: 1; /* Visible par défaut */
  transform: translateY(0);
  transition: all 0.6s ease;
}

/* Cacher seulement si JavaScript est activé */
html.animations-loaded .scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */

.page-transition-enter {
  opacity: 0;
  transform: translateX(-20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: all 0.5s ease;
}

.page-transition-exit {
  opacity: 1;
  transform: translateX(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.5s ease;
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */

.modal-backdrop {
  animation: fadeIn 0.3s ease;
}

.modal-content {
  animation: scaleIn 0.3s ease;
}

/* ============================================
   NOTIFICATION ANIMATIONS
   ============================================ */

.notification {
  animation: slideInRight 0.5s ease;
}

.notification.success {
  border-left: 4px solid #48bb78;
}

.notification.error {
  border-left: 4px solid #f56565;
}

.notification.warning {
  border-left: 4px solid #ed8936;
}

.notification.info {
  border-left: 4px solid #4299e1;
}

/* ============================================
   SMOOTH SCROLLING
   ============================================ */

html {
  scroll-behavior: smooth;
}

/* ============================================
   SELECTION STYLE
   ============================================ */

::selection {
  background: rgba(229, 62, 62, 0.2);
  color: #e53e3e;
}

::-moz-selection {
  background: rgba(229, 62, 62, 0.2);
  color: #e53e3e;
}

/* ============================================
   SCROLLBAR STYLE
   ============================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #e53e3e;
  border-radius: 5px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #c53030;
}

/* ============================================
   MENU MOBILE HAMBURGER
   ============================================ */

/* Cacher le menu hamburger sur desktop */
.mobile-menu-toggle {
  display: none;
}

@media (max-width: 768px) {
  /* Menu hamburger mobile */
  .mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
  }
  
  .mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
  }
  
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }
  
  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }
  
  /* Menu mobile fullscreen */
  .nav-menu.mobile-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    transition: left 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  
  .nav-menu.mobile-nav.active {
    left: 0;
  }
  
  .nav-menu.mobile-nav a {
    font-size: 18px !important;
    color: #333 !important;
    text-decoration: none;
    padding: 15px;
    text-align: center;
    width: 100%;
    border-radius: 0;
  }
}

/* ============================================
   PROGRESSIVE ENHANCEMENT POUR ANIMATIONS
   ============================================ */

/* Les animations ne se déclenchent que si JavaScript est activé */
/* Cela garantit que le contenu est visible même sans JavaScript */

/* ============================================
   RESPONSIVE ANIMATIONS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Rendre tout visible immédiatement si animations réduites */
  .animate-fade-in,
  .animate-slide-left,
  .animate-slide-right,
  .animate-scale-in,
  .scroll-reveal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

@media (max-width: 768px) {
  .animate-fade-in,
  .animate-slide-left,
  .animate-slide-right {
    animation-duration: 0.4s;
  }
  
  /* Forcer la visibilité sur mobile en cas de problème */
  .animate-fade-in,
  .animate-slide-left,
  .animate-slide-right,
  .animate-scale-in,
  .scroll-reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  
  /* Animations plus légères sur mobile */
  .animate-float {
    animation: none;
  }
  
  /* S'assurer que le contenu principal est visible */
  .hero-content,
  .why-fafa-content,
  .middle-section,
  .left-section,
  .right-section,
  .form-group {
    opacity: 1 !important;
    transform: none !important;
  }
  
  /* Menu mobile responsive sur petit écran */
  .site-header {
    flex-wrap: wrap !important;
  }
  
  .step-indicator {
    order: 3;
    width: 100%;
    text-align: center;
    margin-top: 10px;
  }
}