/* ============================================
   PRELOADER MODERNE ET ÉLÉGANT
   ============================================ */

.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a0a2e 50%, #0a0a0a 100%);
  background-size: 200% 200%;
  animation: backgroundMove 8s ease infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  overflow: hidden;
}

@keyframes backgroundMove {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-content {
  text-align: center;
  position: relative;
}

/* Logo animé */
.preloader-logo {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2.5rem;
  animation: gradientShift 2s ease infinite, logoFloat 2s ease-in-out infinite, logoGlow 2s ease-in-out infinite;
  letter-spacing: 0.15em;
  filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
  will-change: transform;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.05);
  }
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 40px rgba(118, 75, 162, 0.9));
  }
}

/* Cercles de chargement */
.preloader-circles {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.preloader-circle {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  animation: circleWave 1.4s ease-in-out infinite !important;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
  will-change: transform;
}

.preloader-circle:nth-child(1) {
  animation-delay: 0s !important;
}

.preloader-circle:nth-child(2) {
  animation-delay: 0.2s !important;
}

.preloader-circle:nth-child(3) {
  animation-delay: 0.4s !important;
}

@keyframes circleWave {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.9);
  }
}

/* Barre de progression */
.preloader-progress {
  width: 320px;
  max-width: 85vw;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin: 0 auto;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.preloader-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #667eea);
  background-size: 300% 100%;
  border-radius: 10px;
  width: 0%;
  transition: width 0.2s ease-out;
  animation: progressShine 1.5s linear infinite !important;
  box-shadow: 0 0 30px rgba(102, 126, 234, 0.8), 0 0 60px rgba(118, 75, 162, 0.4);
  will-change: width;
  position: relative;
}

.preloader-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6));
  animation: progressGlare 1s ease infinite;
}

@keyframes progressShine {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 300% 0%;
  }
}

@keyframes progressGlare {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* Texte de chargement */
.preloader-text {
  margin-top: 2rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  animation: textPulse 1.5s ease-in-out infinite !important;
  text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

@keyframes textPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* Particules décoratives */
.preloader-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(102, 126, 234, 0.6);
  border-radius: 50%;
  animation: particleFloat 3s ease-in-out infinite;
  pointer-events: none;
}

.preloader-particle:nth-child(1) {
  top: 20%;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 3s;
}

.preloader-particle:nth-child(2) {
  top: 60%;
  left: 80%;
  animation-delay: 0.5s;
  animation-duration: 3.5s;
}

.preloader-particle:nth-child(3) {
  top: 80%;
  left: 20%;
  animation-delay: 1s;
  animation-duration: 4s;
}

.preloader-particle:nth-child(4) {
  top: 30%;
  left: 70%;
  animation-delay: 1.5s;
  animation-duration: 3.2s;
}

.preloader-particle:nth-child(5) {
  top: 70%;
  left: 60%;
  animation-delay: 2s;
  animation-duration: 3.8s;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  50% {
    transform: translate(30px, -30px) scale(1.5);
    opacity: 1;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translate(60px, -60px) scale(0.5);
    opacity: 0;
  }
}

/* Anneau de chargement alternatif */
.preloader-ring {
  width: 140px;
  height: 140px;
  margin: 0 auto 2rem;
  position: relative;
  filter: drop-shadow(0 0 30px rgba(102, 126, 234, 0.5));
}

.preloader-ring-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: #667eea;
  border-right-color: #764ba2;
  border-bottom-color: rgba(102, 126, 234, 0.2);
  border-left-color: rgba(118, 75, 162, 0.2);
  border-radius: 50%;
  animation: ringRotate 1.2s linear infinite !important;
  will-change: transform;
}

.preloader-ring-circle:nth-child(2) {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-top-color: #764ba2;
  border-right-color: #f093fb;
  border-bottom-color: rgba(118, 75, 162, 0.2);
  border-left-color: rgba(240, 147, 251, 0.2);
  animation: ringRotateReverse 1.6s linear infinite !important;
}

.preloader-ring-circle:nth-child(3) {
  width: 60%;
  height: 60%;
  top: 20%;
  left: 20%;
  border-top-color: #f093fb;
  border-right-color: #667eea;
  border-bottom-color: rgba(240, 147, 251, 0.2);
  border-left-color: rgba(102, 126, 234, 0.2);
  animation: ringRotate 2.2s linear infinite !important;
}

/* Anneau central pulsant */
.preloader-ring::before {
  content: '';
  position: absolute;
  width: 40%;
  height: 40%;
  top: 30%;
  left: 30%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.4), transparent);
  border-radius: 50%;
  animation: centerPulse 2s ease-in-out infinite;
}

@keyframes ringRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes ringRotateReverse {
  0% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes centerPulse {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.6;
  }
}

/* Animation de sortie */
@keyframes slideUp {
  to {
    transform: translateY(-100%);
  }
}

.preloader.slide-out {
  animation: slideUp 0.8s ease-in-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
  .preloader-logo {
    font-size: clamp(2rem, 10vw, 4rem);
  }
  
  .preloader-progress {
    width: 250px;
  }
  
  .preloader-ring {
    width: 80px;
    height: 80px;
  }
}

/* Version alternative avec logo image */
.preloader-logo-img {
  width: 150px;
  height: auto;
  margin-bottom: 2rem;
  animation: logoFloat 2s ease-in-out infinite, logoPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
}

@keyframes logoPulse {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 40px rgba(102, 126, 234, 0.9));
  }
}

