/**
 * Animations CSS - Prêt Denis
 */

/* ========================================
   ANIMATIONS DE BASE
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
    }
    to {
        box-shadow: 0 0 20px rgba(74, 144, 226, 0.6);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes slideRight {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideLeft {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ========================================
   CLASSES D'ANIMATION
   ======================================== */

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-down {
    animation: fadeInDown 0.8s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.slide-in-up {
    animation: slideInUp 0.6s ease-out forwards;
}

.slide-in-down {
    animation: slideInDown 0.6s ease-out forwards;
}

.zoom-in {
    animation: zoomIn 0.5s ease-out forwards;
}

.bounce {
    animation: bounce 1s ease infinite;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.spin {
    animation: spin 1s linear infinite;
}

/* ========================================
   DELAYS (pour animation en cascade)
   ======================================== */

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* ========================================
   ANIMATIONS HOVER
   ======================================== */

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hover-glow:hover {
    animation: glow 1.5s ease-in-out infinite alternate;
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* ========================================
   ANIMATION BOUTON DEMANDE CRÉDIT
   ======================================== */

@keyframes btnShine {
    0% {
        left: -100%;
    }
    20%, 100% {
        left: 100%;
    }
}

.btn-demande {
    position: relative;
    overflow: hidden;
}

.btn-demande::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: btnShine 3s infinite;
}

/* ========================================
   ANIMATION CARTE CRÉDIT
   ======================================== */

.card-credit {
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.card-credit:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

/* ========================================
   ANIMATION ÉTOILES
   ======================================== */

@keyframes starPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.star-animate {
    display: inline-block;
    animation: starPulse 1.5s ease-in-out infinite;
}

.star-animate:nth-child(2) { animation-delay: 0.1s; }
.star-animate:nth-child(3) { animation-delay: 0.2s; }
.star-animate:nth-child(4) { animation-delay: 0.3s; }
.star-animate:nth-child(5) { animation-delay: 0.4s; }

/* ========================================
   ANIMATION COMPTEUR
   ======================================== */

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter-animate {
    animation: countUp 1s ease-out forwards;
}

/* ========================================
   ANIMATION FORMULAIRE
   ======================================== */

.form-group {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.15s; }
.form-group:nth-child(3) { animation-delay: 0.2s; }
.form-group:nth-child(4) { animation-delay: 0.25s; }
.form-group:nth-child(5) { animation-delay: 0.3s; }
.form-group:nth-child(6) { animation-delay: 0.35s; }
.form-group:nth-child(7) { animation-delay: 0.4s; }
.form-group:nth-child(8) { animation-delay: 0.45s; }

/* ========================================
   ANIMATION INPUT FOCUS
   ======================================== */

.form-control {
    transition: all 0.3s ease;
}

.form-control:focus {
    animation: inputFocus 0.3s ease-out;
}

@keyframes inputFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* ========================================
   ANIMATION CHARGEMENT
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 54, 93, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(212, 165, 116, 0.3);
    border-top: 5px solid #d4a574;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========================================
   ANIMATION PROGRESS BAR
   ======================================== */

@keyframes progressBar {
    from {
        width: 0%;
    }
}

.progress-bar {
    animation: progressBar 2s ease-out forwards;
}

/* ========================================
   ANIMATION NOTIFICATION
   ======================================== */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-enter {
    animation: slideInRight 0.5s ease-out forwards;
}

.notification-exit {
    animation: slideOutRight 0.5s ease-out forwards;
}

/* ========================================
   ANIMATION TOOLTIP
   ======================================== */

@keyframes tooltipFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip {
    animation: tooltipFade 0.3s ease-out;
}

/* ========================================
   ANIMATION MODAL
   ======================================== */

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-overlay {
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content {
    animation: modalSlideIn 0.4s ease-out;
}

/* ========================================
   ANIMATION GRADIENT
   ======================================== */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* ========================================
   ANIMATION TEXTE TYPING
   ======================================== */

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--secondary-color);
    white-space: nowrap;
    animation: typing 3.5s steps(40) 1s 1 normal both,
               blink 0.75s step-end infinite;
}

/* ========================================
   DÉSACTIVATION ANIMATIONS (Accessibilité)
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}