/* INSANE ANIMATIONS CSS - MAXIMUM VISUAL CHAOS */

/* Animation Toggle Prompt */
#animation-prompt {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(26, 26, 46, 0.85);
    color: white;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 280px;
}

#animation-prompt.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

body.animations-active #animation-prompt {
    animation: floatAndRotate 4s ease-in-out infinite;
}

#animation-prompt p {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4A4A4A;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3282b8;
    animation: pulseGlow 1.5s ease-in-out infinite;
}

input:checked + .slider:before {
    transform: translateX(16px);
    animation: bounce 0.5s ease-in-out infinite alternate;
}

/* Animated Background */
#animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

/* KEYFRAME ANIMATIONS */

@keyframes jiggle {
    0%, 100% { transform: rotate(-1deg); }
    25% { transform: rotate(1deg); }
    50% { transform: rotate(-1.5deg); }
    75% { transform: rotate(1.5deg); }
}

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

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

@keyframes bounceRotate {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(5deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-8px) rotate(-5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@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 floatAndRotate {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(0px) rotate(-2deg);
    }
    75% {
        transform: translateY(-5px) rotate(1deg);
    }
}

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

@keyframes spinY {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes spinX {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(360deg); }
}

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(50, 130, 184, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(50, 130, 184, 1), 0 0 40px rgba(50, 130, 184, 0.5);
    }
}

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

@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes rgbShift {
    0%, 100% { text-shadow: 0 0 0 transparent; }
    25% { text-shadow: -2px 0 0 rgba(255,0,0,0.5); }
    50% { text-shadow: 2px 0 0 rgba(0,255,0,0.5); }
    75% { text-shadow: 0 2px 0 rgba(0,0,255,0.5); }
}

@keyframes glitch {
    0%, 100% {
        text-shadow: 0 0 0 transparent;
        transform: translate(0);
    }
    20% {
        text-shadow: -2px 0 0 #ff00de, 2px 0 0 #00ffff;
        transform: translate(2px, -2px);
    }
    40% {
        text-shadow: 2px 0 0 #ff00de, -2px 0 0 #00ffff;
        transform: translate(-2px, 2px);
    }
}

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

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

@keyframes cardDance {
    0%, 100% {
        transform: perspective(1000px) rotateY(0deg) rotateX(0deg) translateZ(0);
    }
    25% {
        transform: perspective(1000px) rotateY(20deg) rotateX(10deg) translateZ(50px);
    }
    50% {
        transform: perspective(1000px) rotateY(-20deg) rotateX(-10deg) translateZ(100px);
    }
    75% {
        transform: perspective(1000px) rotateY(10deg) rotateX(5deg) translateZ(50px);
    }
}

@keyframes elastic {
    0% { transform: scale(1); }
    30% { transform: scale(1.25); }
    40% { transform: scale(0.75); }
    50% { transform: scale(1.15); }
    65% { transform: scale(0.95); }
    75% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes morphing {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}

@keyframes slideAndFade {
    0%, 100% {
        opacity: 1;
        transform: translateX(0);
    }
    50% {
        opacity: 0.3;
        transform: translateX(100px);
    }
}

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

@keyframes neonGlow {
    0%, 100% {
        text-shadow:
            0 0 10px #fff,
            0 0 20px #fff,
            0 0 30px #3282b8,
            0 0 40px #3282b8,
            0 0 50px #3282b8,
            0 0 60px #3282b8,
            0 0 70px #3282b8;
    }
    50% {
        text-shadow:
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 15px #3282b8,
            0 0 20px #3282b8,
            0 0 25px #3282b8,
            0 0 30px #3282b8,
            0 0 35px #3282b8;
    }
}

@keyframes electricBorder {
    0%, 100% {
        box-shadow:
            0 0 5px #00ffff,
            inset 0 0 5px #00ffff,
            0 0 10px #00ffff,
            inset 0 0 10px #00ffff;
    }
    50% {
        box-shadow:
            0 0 10px #ff00de,
            inset 0 0 10px #ff00de,
            0 0 20px #ff00de,
            inset 0 0 20px #ff00de;
    }
}

/* APPLIED ANIMATIONS WHEN ACTIVE */

body.animations-active {
    animation: rainbow 10s linear infinite;
    perspective: 1000px;
}

body.animations-active .hero-section {
    animation: float 6s ease-in-out infinite;
}

body.animations-active .hero-title {
    background: linear-gradient(90deg, #ff00de, #00ffff, #ffff00, #ff00de);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShine 3s linear infinite, glitch 5s infinite;
}

body.animations-active .hero-subtitle {
    animation: rgbShift 2s infinite, wiggle 3s ease-in-out infinite;
}

body.animations-active .bio-image img {
    animation: morphing 8s ease-in-out infinite, spinY 10s linear infinite;
    border-radius: 50%;
}

body.animations-active .skill-badge {
    animation: bounce 2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
}

body.animations-active .skill-badge:nth-child(1) { --i: 0; }
body.animations-active .skill-badge:nth-child(2) { --i: 1; }
body.animations-active .skill-badge:nth-child(3) { --i: 2; }
body.animations-active .skill-badge:nth-child(4) { --i: 3; }

body.animations-active .skill-badge:hover {
    animation: elastic 1s ease-in-out, rainbow 2s linear infinite;
    transform: scale(1.2) rotate(360deg);
}

body.animations-active .download-cv-btn {
    animation: pulseGlow 2s ease-in-out infinite, jiggle 4s ease-in-out infinite;
}

body.animations-active .download-cv-btn:hover {
    animation: shake 0.5s, neonGlow 1s ease-in-out infinite;
}

body.animations-active .tab-button {
    position: relative;
    animation: float 4s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.2s);
}

body.animations-active .tab-button:nth-child(1) { --i: 0; }
body.animations-active .tab-button:nth-child(2) { --i: 1; }
body.animations-active .tab-button:nth-child(3) { --i: 2; }
body.animations-active .tab-button:nth-child(4) { --i: 3; }
body.animations-active .tab-button:nth-child(5) { --i: 4; }
body.animations-active .tab-button:nth-child(6) { --i: 5; }
body.animations-active .tab-button:nth-child(7) { --i: 6; }
body.animations-active .tab-button:nth-child(8) { --i: 7; }

body.animations-active .tab-button:hover {
    animation: spin 0.5s ease-in-out, electricBorder 1s infinite;
    z-index: 10;
}

body.animations-active .tab-button.active {
    animation: bounceRotate 3s ease-in-out infinite, neonGlow 2s ease-in-out infinite;
}

body.animations-active .overview-card {
    animation: cardDance 6s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.3s);
}

body.animations-active .overview-card:nth-child(1) { --i: 0; }
body.animations-active .overview-card:nth-child(2) { --i: 1; }
body.animations-active .overview-card:nth-child(3) { --i: 2; }
body.animations-active .overview-card:nth-child(4) { --i: 3; }

body.animations-active .overview-card:hover {
    animation: flip3D 1s ease-in-out, electricBorder 0.5s infinite;
    transform: scale(1.1) translateZ(100px);
}

body.animations-active .resume-card {
    animation: breathe 4s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.2s);
    transition: all 0.3s ease;
}

body.animations-active .resume-card:hover {
    animation: elastic 1s, rainbow 2s linear infinite;
    transform: scale(1.05) rotateY(10deg) rotateX(-5deg);
    box-shadow: 0 20px 40px rgba(255, 0, 222, 0.4), 0 0 60px rgba(0, 255, 255, 0.3);
}

body.animations-active .timeline-item {
    animation: slideAndFade 5s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.5s);
}

body.animations-active .timeline-item:nth-child(odd) {
    animation-direction: reverse;
}

body.animations-active .project-card {
    animation: floatAndRotate 5s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.25s);
}

body.animations-active .project-card:hover {
    animation: cardDance 2s ease-in-out, electricBorder 1s infinite;
    transform: perspective(1000px) rotateY(180deg);
    transition: transform 0.6s;
}

body.animations-active .project-card:hover .project-content {
    transform: rotateY(180deg);
}

body.animations-active .achievement-item,
body.animations-active .accolade-item-v2 {
    animation: wiggle 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.15s);
}

body.animations-active .achievement-item:hover,
body.animations-active .accolade-item-v2:hover {
    animation: bounceRotate 1s ease-in-out, rainbow 3s linear infinite;
    transform: scale(1.1);
}

body.animations-active .section-title {
    animation: neonGlow 3s ease-in-out infinite, float 4s ease-in-out infinite;
    text-transform: uppercase;
}

body.animations-active .navbar {
    animation: pulse 4s ease-in-out infinite;
}

body.animations-active .navbar-nav li {
    animation: bounce 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.3s);
}

body.animations-active .navbar-nav li:nth-child(1) { --i: 0; }
body.animations-active .navbar-nav li:nth-child(2) { --i: 1; }

body.animations-active .navbar-nav li:hover {
    animation: spinX 0.6s ease-in-out, electricBorder 1s infinite;
}

body.animations-active .logo-animation {
    animation: spin 4s linear infinite, morphing 6s ease-in-out infinite;
}

body.animations-active .contact-method {
    animation: jiggle 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.4s);
}

body.animations-active .contact-method:nth-child(1) { --i: 0; }
body.animations-active .contact-method:nth-child(2) { --i: 1; }

body.animations-active .contact-method:hover {
    animation: elastic 1s ease-in-out, neonGlow 2s infinite;
    transform: scale(1.15) rotate(5deg);
}

body.animations-active .cta-button {
    animation: pulseGlow 2s ease-in-out infinite, float 3s ease-in-out infinite;
}

body.animations-active .cta-button:hover {
    animation: shake 0.5s, rainbow 1s linear infinite;
    box-shadow: 0 0 30px rgba(255, 0, 222, 0.8), 0 0 60px rgba(0, 255, 255, 0.6);
}

body.animations-active .language-card {
    animation: flip3D 8s linear infinite;
    animation-delay: calc(var(--i) * 2s);
}

body.animations-active .language-card:nth-child(1) { --i: 0; }
body.animations-active .language-card:nth-child(2) { --i: 1; }
body.animations-active .language-card:nth-child(3) { --i: 2; }

body.animations-active .instrument-card {
    animation: bounceRotate 4s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.5s);
}

body.animations-active .instrument-card:hover {
    animation: spinY 1s ease-in-out, electricBorder 0.5s infinite;
    transform: scale(1.2);
}

body.animations-active .accordion-header {
    animation: wiggle 4s ease-in-out infinite;
}

body.animations-active .accordion-header:hover {
    animation: shake 0.5s, rainbow 2s linear infinite;
}

body.animations-active .accordion-arrow {
    animation: spin 4s linear infinite;
}

body.animations-active i.fa {
    animation: bounce 2s ease-in-out infinite;
}

body.animations-active a {
    position: relative;
    transition: all 0.3s ease;
}

body.animations-active a:hover {
    animation: jiggle 0.5s ease-in-out;
    color: #00ffff;
    text-shadow: 0 0 10px currentColor;
}

/* Special character animations for text */
body.animations-active h1,
body.animations-active h2,
body.animations-active h3 {
    position: relative;
}

body.animations-active h1:hover,
body.animations-active h2:hover,
body.animations-active h3:hover {
    animation: glitch 0.3s infinite, rgbShift 0.5s infinite;
}

/* Staggered wave animation for list items */
body.animations-active ul li {
    animation: waveText 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
}

body.animations-active ul li:nth-child(1) { --i: 0; }
body.animations-active ul li:nth-child(2) { --i: 1; }
body.animations-active ul li:nth-child(3) { --i: 2; }
body.animations-active ul li:nth-child(4) { --i: 3; }
body.animations-active ul li:nth-child(5) { --i: 4; }
body.animations-active ul li:nth-child(6) { --i: 5; }
body.animations-active ul li:nth-child(7) { --i: 6; }
body.animations-active ul li:nth-child(8) { --i: 7; }

/* Mobile responsiveness */
@media (max-width: 768px) {
    body.animations-active * {
        animation-duration: calc(var(--duration, 3s) * 1.5);
    }
}

@media (max-width: 480px) {
    #animation-prompt {
        bottom: 0.75rem;
        right: 0.75rem;
        padding: 0.4rem 0.75rem;
        max-width: 240px;
    }

    #animation-prompt p {
        font-size: 0.7rem;
    }

    .switch {
        width: 32px;
        height: 18px;
    }

    .slider:before {
        height: 12px;
        width: 12px;
        left: 3px;
        bottom: 3px;
    }

    input:checked + .slider:before {
        transform: translateX(14px);
    }
}

/* Cursor effects */
body.animations-active {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="10" fill="%2300ffff" opacity="0.5"/></svg>') 16 16, auto;
}

body.animations-active a,
body.animations-active button {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="10" fill="%23ff00de" opacity="0.5"/></svg>') 16 16, pointer;
}