/**
 * Animazioni CSS Avanzate - Sito Dott.ssa Anna Stellato
 * File: public/assets/css/animations.css
 * 
 * Tutte le animazioni e transizioni spettacolari
 */

/* =============================================================================
   KEYFRAMES PRINCIPALI
   ============================================================================= */

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

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

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

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

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

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

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

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

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(214, 158, 46, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(214, 158, 46, 0.8), 0 0 30px rgba(214, 158, 46, 0.6);
    }
}

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

@keyframes blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--secondary-color);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes morphing {
    0%, 100% {
        border-radius: 63% 37% 54% 46% / 55% 48% 52% 45%;
    }
    14% {
        border-radius: 40% 60% 54% 46% / 49% 60% 40% 51%;
    }
    28% {
        border-radius: 54% 46% 38% 62% / 49% 70% 30% 51%;
    }
    42% {
        border-radius: 61% 39% 55% 45% / 61% 38% 62% 39%;
    }
    56% {
        border-radius: 61% 39% 67% 33% / 70% 50% 50% 30%;
    }
    70% {
        border-radius: 50% 50% 34% 66% / 56% 68% 32% 44%;
    }
    84% {
        border-radius: 46% 54% 50% 50% / 35% 61% 39% 65%;
    }
}

/* =============================================================================
   CLASSI DI ANIMAZIONE
   ============================================================================= */

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

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

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

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

.animate-scale-in {
    animation: scaleIn 0.6s ease-out;
}

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

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

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

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

.animate-shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

.animate-morphing {
    animation: morphing 8s ease-in-out infinite;
}

/* =============================================================================
   ANIMAZIONI CON DELAY
   ============================================================================= */

.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-400 {
    animation-delay: 0.4s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

.animate-delay-600 {
    animation-delay: 0.6s;
}

.animate-delay-700 {
    animation-delay: 0.7s;
}

.animate-delay-800 {
    animation-delay: 0.8s;
}

.animate-delay-900 {
    animation-delay: 0.9s;
}

.animate-delay-1000 {
    animation-delay: 1s;
}

/* =============================================================================
   ANIMAZIONI HOVER
   ============================================================================= */

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

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

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

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

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(214, 158, 46, 0.6);
}

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

.hover-slide-right:hover {
    transform: translateX(10px);
}

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

.hover-slide-left:hover {
    transform: translateX(-10px);
}

/* =============================================================================
   ANIMAZIONI TESTO
   ============================================================================= */

.text-reveal {
    overflow: hidden;
    position: relative;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    animation: slideInLeft 1s ease-in-out forwards;
    animation-delay: 0.5s;
}

@keyframes slideInLeft {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

.typewriter-text {
    overflow: hidden;
    border-right: 3px solid var(--secondary-color);
    white-space: nowrap;
    margin: 0 auto;
    animation: typewriter 3s steps(40, end), blink 0.75s step-end infinite;
}

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

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* =============================================================================
   ANIMAZIONI BOTTONI
   ============================================================================= */

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

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

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

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

.btn-magnetic:hover {
    transform: translateY(-3px);
}

.btn-magnetic:active {
    transform: translateY(-1px);
}

/* =============================================================================
   ANIMAZIONI CARICAMENTO
   ============================================================================= */

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

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

.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(214, 158, 46, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    display: block;
    width: 30%;
    height: 100%;
    background: var(--secondary-color);
    border-radius: 2px;
    animation: loadingBar 2s ease-in-out infinite;
}

@keyframes loadingBar {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(400%);
    }
}

/* =============================================================================
   ANIMAZIONI PARTICELLE
   ============================================================================= */

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 6s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.5;
    }
}

/* =============================================================================
   ANIMAZIONI SCROLL
   ============================================================================= */

.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* =============================================================================
   ANIMAZIONI RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-fade-in-left,
    .animate-fade-in-right {
        animation-duration: 0.6s;
    }
    
    .hover-lift:hover {
        transform: translateY(-5px);
    }
    
    .hover-scale:hover {
        transform: scale(1.02);
    }
    
    .typewriter-text {
        animation-duration: 2s;
    }
}

@media (max-width: 480px) {
    .animate-bounce,
    .animate-float {
        animation-duration: 1.5s;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
}

/* =============================================================================
   ANIMAZIONI ACCESSIBILITÀ
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-bounce,
    .animate-pulse,
    .animate-float,
    .animate-morphing {
        animation: none;
    }
    
    .scroll-reveal,
    .scroll-reveal-left,
    .scroll-reveal-right,
    .scroll-reveal-scale {
        opacity: 1;
        transform: none;
    }
}

/* =============================================================================
   UTILITÀ ANIMAZIONI
   ============================================================================= */

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

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

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

.smooth-transition {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fast-transition {
    transition: all 0.15s ease;
}

.slow-transition {
    transition: all 0.6s ease;
}
