/* Animations CSS */

/* Animation de flottement pour l'arrière-plan */
@keyframes float {
    0% {
        transform: translateY(0px) translateX(0px);
    }
    25% {
        transform: translateY(-10px) translateX(5px);
    }
    50% {
        transform: translateY(-5px) translateX(-5px);
    }
    75% {
        transform: translateY(-15px) translateX(3px);
    }
    100% {
        transform: translateY(0px) translateX(0px);
    }
}

/* Animation de pulsation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Animation de rebond */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

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

/* Animation de scintillement */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation de balancement */
@keyframes sway {
    0%, 100% {
        transform: rotate(-3deg);
    }
    50% {
        transform: rotate(3deg);
    }
}

/* Animation de zoom */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    50% {
        opacity: 1;
    }
}

/* Animation de glissement depuis la gauche */
@keyframes slideInLeft {
    from {
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

/* Animation de glissement depuis la droite */
@keyframes slideInRight {
    from {
        transform: translate3d(100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

/* Animation de fondu */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animation de confettis */
@keyframes confetti {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Classes d'animation */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

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

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

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-sparkle {
    animation: sparkle 1.5s ease-in-out infinite;
}

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

.animate-zoom-in {
    animation: zoomIn 0.6s;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s;
}

.animate-fade-in {
    animation: fadeIn 0.6s;
}

/* Animations spécifiques aux sections */

/* Nature - Feuillage mouvant */
.nature-leaves {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border-radius: 0 100% 0 100%;
    animation: float 4s ease-in-out infinite;
}

.nature-leaves:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.nature-leaves:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.nature-leaves:nth-child(3) {
    bottom: 30%;
    left: 20%;
    animation-delay: 2s;
}

/* Histoire - Parchemin ondulant */
.histoire-scroll {
    background: linear-gradient(45deg, #D7CCC8, #BCAAA4);
    border-radius: 10px;
    animation: sway 4s ease-in-out infinite;
}

/* Science - Étoiles scintillantes */
.science-star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.science-star:nth-child(1) {
    top: 15%;
    left: 20%;
    animation-delay: 0s;
}

.science-star:nth-child(2) {
    top: 25%;
    right: 30%;
    animation-delay: 0.5s;
}

.science-star:nth-child(3) {
    bottom: 40%;
    left: 40%;
    animation-delay: 1s;
}

.science-star:nth-child(4) {
    top: 60%;
    right: 20%;
    animation-delay: 1.5s;
}

/* Créativité - Étoiles colorées */
.creativite-star {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #E91E63;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: sparkle 1.5s ease-in-out infinite;
}

.creativite-star:nth-child(1) {
    top: 10%;
    left: 15%;
    background: #E91E63;
    animation-delay: 0s;
}

.creativite-star:nth-child(2) {
    top: 30%;
    right: 25%;
    background: #2196F3;
    animation-delay: 0.3s;
}

.creativite-star:nth-child(3) {
    bottom: 20%;
    left: 30%;
    background: #FF9800;
    animation-delay: 0.6s;
}

.creativite-star:nth-child(4) {
    top: 50%;
    right: 15%;
    background: #9C27B0;
    animation-delay: 0.9s;
}

/* Animations de feedback pour les quiz */
.correct-answer {
    animation: bounce 0.6s, pulse 0.6s 0.6s;
    background: linear-gradient(45deg, #4CAF50, #81C784) !important;
    color: white !important;
}

.wrong-answer {
    animation: sway 0.6s;
    background: linear-gradient(45deg, #F44336, #EF5350) !important;
    color: white !important;
}

/* Animation de confettis pour les bonnes réponses */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4CAF50;
    animation: confetti 3s linear;
}

.confetti-piece:nth-child(1) { background: #4CAF50; left: 10%; animation-delay: 0s; }
.confetti-piece:nth-child(2) { background: #2196F3; left: 20%; animation-delay: 0.1s; }
.confetti-piece:nth-child(3) { background: #FF9800; left: 30%; animation-delay: 0.2s; }
.confetti-piece:nth-child(4) { background: #E91E63; left: 40%; animation-delay: 0.3s; }
.confetti-piece:nth-child(5) { background: #9C27B0; left: 50%; animation-delay: 0.4s; }
.confetti-piece:nth-child(6) { background: #4CAF50; left: 60%; animation-delay: 0.5s; }
.confetti-piece:nth-child(7) { background: #2196F3; left: 70%; animation-delay: 0.6s; }
.confetti-piece:nth-child(8) { background: #FF9800; left: 80%; animation-delay: 0.7s; }
.confetti-piece:nth-child(9) { background: #E91E63; left: 90%; animation-delay: 0.8s; }

/* Animations d'entrée pour les éléments */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Animation de chargement */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Hover effects améliorés */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Animation de typing pour les textes */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid #4CAF50;
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #4CAF50; }
}

/* Responsive animations */
@media (max-width: 768px) {
    .animate-float,
    .animate-sway {
        animation-duration: 4s;
    }
    
    .nature-leaves,
    .science-star,
    .creativite-star {
        display: none; /* Masquer sur mobile pour les performances */
    }
}

/* Préférences d'accessibilité */
@media (prefers-reduced-motion: reduce) {
    .animate-float,
    .animate-pulse,
    .animate-bounce,
    .animate-rotate,
    .animate-sparkle,
    .animate-sway,
    .nature-leaves,
    .science-star,
    .creativite-star {
        animation: none;
    }
}

