/* ========================================
   ANIMATIONS.CSS - Animations et effets
   Portfolio TI EPHEC - Mohamed El Mazani
   ======================================== */

/* ========================================
   1. KEYFRAME ANIMATIONS
   ======================================== */

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

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* Slide animations */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    to {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
}

@keyframes swing {
    0% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Float animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
    }
    33% {
        transform: translateY(-30px) translateX(20px) scale(1.05);
    }
    66% {
        transform: translateY(20px) translateX(-20px) scale(0.95);
    }
}

@keyframes floatBubble {
    0% {
        transform: translateY(100vh) scale(0);
    }
    10% {
        transform: translateY(90vh) scale(1);
    }
    100% {
        transform: translateY(-10vh) scale(0.5);
    }
}

/* Shake animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Glow animation */
@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(92, 92, 153, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(92, 92, 153, 0.8), 
                    0 0 40px rgba(92, 92, 153, 0.6);
    }
    100% {
        box-shadow: 0 0 5px rgba(92, 92, 153, 0.5);
    }
}

@keyframes textGlow {
    0% {
        text-shadow: 0 0 5px rgba(163, 163, 204, 0.5);
    }
    50% {
        text-shadow: 0 0 10px rgba(163, 163, 204, 0.8),
                     0 0 20px rgba(163, 163, 204, 0.6);
    }
    100% {
        text-shadow: 0 0 5px rgba(163, 163, 204, 0.5);
    }
}

/* Typing animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    0%, 49% {
        border-right-color: var(--accent);
    }
    50%, 100% {
        border-right-color: transparent;
    }
}

/* Loading animations */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes loadingDots {
    0%, 80%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes progressBar {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Wave animation */
@keyframes wave {
    0% {
        transform: rotate(0deg);
    }
    10% {
        transform: rotate(-10deg);
    }
    20% {
        transform: rotate(12deg);
    }
    30% {
        transform: rotate(-10deg);
    }
    40% {
        transform: rotate(9deg);
    }
    50% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

/* Background animations */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   2. ANIMATION CLASSES
   ======================================== */

/* Fade classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out;
}

/* Scale classes */
.animate-scale-in {
    animation: scaleIn 0.5s ease-out;
}

.animate-scale-up {
    animation: scaleUp 0.5s ease-out;
}

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

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

/* Slide classes */
.animate-slide-top {
    animation: slideInFromTop 0.5s ease-out;
}

.animate-slide-bottom {
    animation: slideInFromBottom 0.5s ease-out;
}

.animate-slide-left {
    animation: slideInFromLeft 0.5s ease-out;
}

.animate-slide-right {
    animation: slideInFromRight 0.5s ease-out;
}

/* Rotate classes */
.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-rotate-in {
    animation: rotateIn 0.6s ease-out;
}

.animate-swing {
    animation: swing 1s ease-in-out;
}

/* Bounce classes */
.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-bounce-in {
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Float classes */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-bubble {
    animation: floatBubble 10s infinite;
}

/* Other animation classes */
.animate-shake {
    animation: shake 0.5s;
}

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

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

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-wave {
    animation: wave 2s linear infinite;
    transform-origin: 70% 70%;
    display: inline-block;
}

/* ========================================
   3. ANIMATION DELAYS
   ======================================== */

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ========================================
   4. ANIMATION DURATIONS
   ======================================== */

.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }
.duration-slowest { animation-duration: 2s; }

/* ========================================
   5. HOVER EFFECTS
   ======================================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(41, 41, 102, 0.2);
}

.hover-grow {
    transition: transform 0.3s ease;
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shrink {
    transition: transform 0.3s ease;
}

.hover-shrink:hover {
    transform: scale(0.95);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-shadow {
    transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 15px 35px rgba(92, 92, 153, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(163, 163, 204, 0.6);
}

.hover-underline {
    position: relative;
    transition: color 0.3s ease;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: width 0.3s ease;
}

.hover-underline:hover::after {
    width: 100%;
}

/* ========================================
   6. LOADING STATES
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--light) 25%,
        rgba(163, 163, 204, 0.2) 50%,
        var(--light) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--secondary);
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out both;
}

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

/* ========================================
   7. SCROLL ANIMATIONS (with JS)
   ======================================== */

.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate-left.in-view {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate-right.in-view {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate-scale.in-view {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   8. TEXT EFFECTS
   ======================================== */

.text-gradient {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-animate {
    background: linear-gradient(270deg, var(--primary), var(--secondary), var(--accent));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

.typing-effect {
    display: inline-block;
    overflow: hidden;
    border-right: 3px solid;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end),
               blinkCursor 0.75s step-end infinite;
}

/* ========================================
   9. SPECIAL EFFECTS
   ======================================== */

.parallax {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    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;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.neon-glow {
    color: var(--primary);
    text-shadow: 
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 30px currentColor,
        0 0 40px var(--secondary);
}

/* ========================================
   10. TRANSITIONS
   ======================================== */

.transition-all {
    transition: all 0.3s ease;
}

.transition-colors {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.transition-transform {
    transition: transform 0.3s ease;
}

.transition-opacity {
    transition: opacity 0.3s ease;
}

.transition-slow {
    transition-duration: 0.5s;
}

.transition-slower {
    transition-duration: 0.8s;
}

.transition-fast {
    transition-duration: 0.15s;
}

/* ========================================
   11. ANIMATION STATE CLASSES
   ======================================== */

.animation-paused {
    animation-play-state: paused !important;
}

.animation-running {
    animation-play-state: running !important;
}

.no-animation {
    animation: none !important;
    transition: none !important;
}