/**
 * Animations & Effects CSS
 * Animazioni, effetti e icone animate per rendere l'interfaccia più allegra e vivace
 */

/* ========== ANIMAZIONI BASE ========== */

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

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

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

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(102, 126, 234, 0.6);
    }
}

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

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* ========== EFFETTI HOVER VIVACI ========== */

.animated-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.animated-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.animated-card:hover::before {
    left: 100%;
}

.animated-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.animated-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.animated-button::after {
    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;
}

.animated-button:hover::after {
    width: 300px;
    height: 300px;
}

.animated-button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.animated-button:active {
    transform: scale(0.98);
}

/* ========== ICONE ANIMATE ========== */

.icon-bounce {
    display: inline-block;
    animation: bounce 2s infinite;
}

.icon-pulse {
    display: inline-block;
    animation: pulse 2s infinite;
}

.icon-spin {
    display: inline-block;
    animation: spin 2s linear infinite;
}

.icon-float {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.icon-glow {
    display: inline-block;
    animation: glow 2s ease-in-out infinite;
    padding: 5px;
    border-radius: 50%;
}

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

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

/* ========== EMOJI ANIMATE ========== */

.emoji-bounce {
    display: inline-block;
    animation: bounce 1.5s infinite;
    font-size: 1.2em;
}

.emoji-pulse {
    display: inline-block;
    animation: pulse 2s infinite;
    font-size: 1.2em;
}

.emoji-float {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
    font-size: 1.2em;
}

.emoji-spin {
    display: inline-block;
    animation: spin 3s linear infinite;
    font-size: 1.2em;
}

.emoji-wiggle {
    display: inline-block;
    animation: shake 0.5s ease-in-out;
    font-size: 1.2em;
}

.emoji-wiggle:hover {
    animation: shake 0.5s ease-in-out infinite;
}

/* ========== CARDS CON EFFETTI ========== */

.card-shimmer {
    position: relative;
    overflow: hidden;
}

.card-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.card-gradient-border {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 2px;
    background-clip: padding-box;
}

.card-gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    border-radius: 12px;
    z-index: -1;
    animation: rainbow 3s ease infinite;
}

/* ========== BOTTONI SPECIALI ========== */

.btn-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    animation: rainbow 3s ease infinite;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s;
}

.btn-gradient:hover::before {
    left: 100%;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

.btn-3d {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #4a5568, 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.1s ease;
    position: relative;
}

.btn-3d:hover {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #4a5568, 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-3d:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #4a5568, 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========== LOADING ANIMATIONS ========== */

.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%, 100% {
        content: '...';
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.loading-bounce {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.loading-bounce div {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-bounce div:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-bounce div:nth-child(2) {
    animation-delay: -0.16s;
}

/* ========== ENTRANCE ANIMATIONS ========== */

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

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

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

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

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

.slide-in-up {
    animation: slideInUp 0.6s ease-out;
}

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

/* ========== PARTICLES & EFFECTS ========== */

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

.particles::before,
.particles::after {
    content: '✨';
    position: absolute;
    font-size: 20px;
    opacity: 0;
    animation: float 3s ease-in-out infinite;
}

.particles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.particles::after {
    top: 60%;
    right: 10%;
    animation-delay: 1.5s;
}

/* ========== SUCCESS/ERROR ANIMATIONS ========== */

.success-checkmark {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #4caf50;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #4caf50;
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
    margin: 0 auto;
}

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 30px #4caf50;
    }
}

@keyframes scale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ========== HOVER EFFECTS ========== */

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

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

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

/* ========== GRADIENT TEXT ========== */

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.gradient-text-animated {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%, #f093fb 0%, #4facfe 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow 3s ease infinite;
    font-weight: bold;
}

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

@media (max-width: 768px) {
    .animated-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .btn-gradient:hover {
        transform: translateY(-1px);
    }
}

/* ========== UTILITY CLASSES ========== */

.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; }

.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }

/* ========== SCROLL ANIMATIONS ========== */

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

.parallax-slow {
    animation: parallax 20s ease-in-out infinite alternate;
}

.parallax-medium {
    animation: parallax 15s ease-in-out infinite alternate;
}

.parallax-fast {
    animation: parallax 10s ease-in-out infinite alternate;
}

/* ========== CONFETTI EFFECT ========== */

@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #667eea;
    animation: confetti 3s linear forwards;
    pointer-events: none;
    z-index: 9999;
}

/* ========== SPARKLE EFFECT ========== */

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.sparkle {
    display: inline-block;
    position: relative;
}

.sparkle::before,
.sparkle::after {
    content: '✨';
    position: absolute;
    font-size: 0.8em;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkle::before {
    top: -5px;
    left: -5px;
    animation-delay: 0s;
}

.sparkle::after {
    bottom: -5px;
    right: -5px;
    animation-delay: 1s;
}

