/**
 * NEXUS CMS - Advanced Futuristic Animations
 * Animazioni avanzate per un'esperienza immersiva
 */

/* ===== NEON GLOW EFFECTS ===== */
.neon-glow {
    animation: neonGlow 2s ease-in-out infinite;
}

@keyframes neonGlow {
    0%, 100% {
        box-shadow: 0 0 5px var(--neon-cyan), 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
    }
    50% {
        box-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan), 0 0 60px var(--neon-cyan);
    }
}

.neon-glow-magenta {
    animation: neonGlowMagenta 2s ease-in-out infinite;
}

@keyframes neonGlowMagenta {
    0%, 100% {
        box-shadow: 0 0 5px var(--neon-magenta), 0 0 10px var(--neon-magenta), 0 0 20px var(--neon-magenta);
    }
    50% {
        box-shadow: 0 0 10px var(--neon-magenta), 0 0 20px var(--neon-magenta), 0 0 40px var(--neon-magenta), 0 0 60px var(--neon-magenta);
    }
}

.neon-glow-green {
    animation: neonGlowGreen 2s ease-in-out infinite;
}

@keyframes neonGlowGreen {
    0%, 100% {
        box-shadow: 0 0 5px var(--neon-green), 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
    }
    50% {
        box-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green), 0 0 40px var(--neon-green), 0 0 60px var(--neon-green);
    }
}

/* ===== PULSE EFFECTS ===== */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.pulse-ring {
    animation: pulseRing 1.5s ease-out infinite;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* ===== FLOAT EFFECTS ===== */
.float {
    animation: float 3s ease-in-out infinite;
}

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

.float-delayed {
    animation: float 4s ease-in-out infinite;
    animation-delay: 1s;
}

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

@keyframes floatReverse {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(15px) rotate(5deg);
    }
}

/* ===== SPIN & ROTATE ===== */
.spin {
    animation: spin 1s linear infinite;
}

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

.spin-slow {
    animation: spin 3s linear infinite;
}

.spin-reverse {
    animation: spinReverse 2s linear infinite;
}

@keyframes spinReverse {
    to {
        transform: rotate(-360deg);
    }
}

.rotate {
    animation: rotate 10s linear infinite;
}

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

/* ===== SLIDE ANIMATIONS ===== */
.slide-in-left {
    animation: slideInLeft 0.5s ease forwards;
}

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

.slide-in-right {
    animation: slideInRight 0.5s ease forwards;
}

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

.slide-in-up {
    animation: slideInUp 0.5s ease forwards;
}

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

.slide-in-down {
    animation: slideInDown 0.5s ease forwards;
}

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

/* ===== FADE ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

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

.fade-in-scale {
    animation: fadeInScale 0.5s ease forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* ===== ZOOM EFFECTS ===== */
.zoom-in {
    animation: zoomIn 0.5s ease forwards;
}

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

.zoom-out {
    animation: zoomOut 0.5s ease forwards;
}

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

.zoom-hover:hover {
    transform: scale(1.1);
}

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

.zoom-hover-scale:hover {
    transform: scale(1.1);
}

/* ===== SHAKE & WOBBLE ===== */
.shake {
    animation: shake 0.5s ease-in-out;
}

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

.shake-horizontal {
    animation: shakeHorizontal 0.5s ease-in-out;
}

@keyframes shakeHorizontal {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.shake-vertical {
    animation: shakeVertical 0.5s ease-in-out;
}

@keyframes shakeVertical {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    75% {
        transform: translateY(10px);
    }
}

.wobble {
    animation: wobble 1s ease-in-out infinite;
}

@keyframes wobble {
    0%, 100% {
        transform: rotate(0deg);
    }
    15% {
        transform: rotate(-5deg);
    }
    30% {
        transform: rotate(3deg);
    }
    45% {
        transform: rotate(-3deg);
    }
    60% {
        transform: rotate(2deg);
    }
    75% {
        transform: rotate(-1deg);
    }
}

/* ===== BOUNCE EFFECTS ===== */
.bounce {
    animation: bounce 1s ease infinite;
}

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

.bounce-in {
    animation: bounceIn 0.6s ease forwards;
}

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

.bounce-out {
    animation: bounceOut 0.5s ease forwards;
}

@keyframes bounceOut {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ===== GLITCH EFFECTS ===== */
.glitch {
    position: relative;
    animation: glitch 0.3s ease-in-out;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--neon-red);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--neon-blue);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(30px, 9999px, 10px, 0); }
    20% { clip: rect(80px, 9999px, 90px, 0); }
    40% { clip: rect(10px, 9999px, 50px, 0); }
    60% { clip: rect(60px, 9999px, 20px, 0); }
    80% { clip: rect(40px, 9999px, 80px, 0); }
    100% { clip: rect(90px, 9999px, 30px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(60px, 9999px, 80px, 0); }
    20% { clip: rect(10px, 9999px, 30px, 0); }
    40% { clip: rect(90px, 9999px, 10px, 0); }
    60% { clip: rect(20px, 9999px, 60px, 0); }
    80% { clip: rect(70px, 9999px, 40px, 0); }
    100% { clip: rect(30px, 9999px, 90px, 0); }
}

/* ===== HOLOGRAPHIC CARD ===== */
.holographic-card {
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.holographic-card:hover {
    transform: rotateX(5deg) rotateY(5deg);
}

.holographic-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.5;
    filter: blur(10px);
    transition: opacity 0.3s ease;
}

.holographic-card:hover::before {
    opacity: 1;
}

/* ===== NEON BORDER ANIMATION ===== */
.neon-border {
    position: relative;
    border-radius: var(--border-radius-lg);
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: var(--gradient-primary);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderRotate 4s linear infinite;
}

@keyframes borderRotate {
    0% {
        --angle: 0deg;
    }
    100% {
        --angle: 360deg;
    }
}

/* ===== SCAN LINE EFFECT ===== */
.scan-line {
    position: relative;
    overflow: hidden;
}

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

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

/* ===== TYPOING EFFECT ===== */
.typing {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 2s steps(20, 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: var(--neon-cyan);
    }
}

/* ===== RAINBOW GRADIENT ===== */
.rainbow {
    background: linear-gradient(
        to right,
        var(--neon-red),
        var(--neon-orange),
        var(--neon-yellow),
        var(--neon-green),
        var(--neon-cyan),
        var(--neon-blue),
        var(--neon-magenta),
        var(--neon-pink)
    );
    background-size: 400% 400%;
    animation: rainbow 8s ease infinite;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* ===== STRETCH EFFECTS ===== */
.stretch {
    animation: stretch 1s ease-in-out infinite;
}

@keyframes stretch {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(1.2);
    }
}

.stretch-vertical {
    animation: stretchVertical 1s ease-in-out infinite;
}

@keyframes stretchVertical {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.2);
    }
}

/* ===== SWING EFFECTS ===== */
.swing {
    transform-origin: top center;
    animation: swing 2s ease-in-out infinite;
}

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

/* ===== RING EFFECT ===== */
.ring {
    position: relative;
}

.ring::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    animation: ringPulse 2s ease-out infinite;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ===== FLIP EFFECTS ===== */
.flip {
    animation: flip 1s ease infinite;
}

@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    50% {
        transform: perspective(400px) rotateY(180deg);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

.flip-horizontal {
    animation: flipHorizontal 1s ease infinite;
}

@keyframes flipHorizontal {
    0% {
        transform: perspective(400px) rotateX(0);
    }
    50% {
        transform: perspective(400px) rotateX(180deg);
    }
    100% {
        transform: perspective(400px) rotateX(360deg);
    }
}

/* ===== MATRIX RAIN EFFECT ===== */
.matrix-rain {
    font-family: monospace;
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
    animation: matrix 0.5s linear infinite;
}

@keyframes matrix {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* ===== LOADING BAR ANIMATION ===== */
.loading-bar {
    height: 4px;
    background: var(--bg-glass-strong);
    border-radius: var(--border-radius-full);
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 50%;
    background: var(--gradient-primary);
    animation: loadingBar 1s ease-in-out infinite;
    border-radius: var(--border-radius-full);
}

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

/* ===== DOTS LOADING ===== */
.dots-loading {
    display: flex;
    gap: 8px;
}

.dots-loading span {
    width: 12px;
    height: 12px;
    background: var(--neon-cyan);
    border-radius: 50%;
    animation: dotsLoading 1.4s infinite ease-in-out;
}

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

.dots-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.dots-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ===== SPINNER LOADING ===== */
.spinner-loading {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== PROGRESS CIRCLE ===== */
.progress-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle circle {
    fill: none;
    stroke-width: 8;
}

.progress-circle .bg {
    stroke: var(--bg-glass-strong);
}

.progress-circle .progress {
    stroke: var(--neon-cyan);
    stroke-linecap: round;
    stroke-dasharray: 251;
    stroke-dashoffset: 251;
    animation: progressFill 2s ease forwards;
}

@keyframes progressFill {
    to {
        stroke-dashoffset: var(--progress);
    }
}

/* ===== UTILITY ANIMATION CLASSES ===== */
.animate-once {
    animation-iteration-count: 1;
}

.animate-twice {
    animation-iteration-count: 2;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

.animate-fast {
    animation-duration: 0.2s;
}

.animate-normal {
    animation-duration: 0.5s;
}

.animate-slow {
    animation-duration: 1s;
}

.delay-100ms { animation-delay: 0.1s; }
.delay-200ms { animation-delay: 0.2s; }
.delay-300ms { animation-delay: 0.3s; }
.delay-400ms { animation-delay: 0.4s; }
.delay-500ms { animation-delay: 0.5s; }
.delay-1s { animation-delay: 1s; }
.delay-2s { animation-delay: 2s; }
