/* ===== ANIMATIONS - CSS SEPARATION ===== */
/* Animations previously injected by JavaScript now properly in CSS */
/* Follows CSS Guidelines for separation of concerns */

/* ===== KEYFRAME ANIMATIONS ===== */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { 
        transform: translate3d(0,0,0); 
    }
    40%, 43% { 
        transform: translate3d(0, -8px, 0); 
    }
    70% { 
        transform: translate3d(0, -4px, 0); 
    }
    90% { 
        transform: translate3d(0, -2px, 0); 
    }
}

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

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

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

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

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

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

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

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

@keyframes paginationSpin {
    to { 
        transform: translate(-50%, -50%) rotate(360deg); 
    }
}

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

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

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

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

@keyframes dnaGlow {
    0% { 
        opacity: 0.3; 
    }
    100% { 
        opacity: 0.8; 
    }
}

/* ===== 3D MATHEMATICAL ANIMATIONS ===== */
@keyframes rotate3D {
    0% { 
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
    25% { 
        transform: rotateX(90deg) rotateY(0deg) rotateZ(0deg); 
    }
    50% { 
        transform: rotateX(90deg) rotateY(90deg) rotateZ(0deg); 
    }
    75% { 
        transform: rotateX(0deg) rotateY(90deg) rotateZ(90deg); 
    }
    100% { 
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
}

@keyframes lissajous3D {
    0% { 
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); 
    }
    33% { 
        transform: rotateX(120deg) rotateY(0deg) rotateZ(0deg) scale(1.1); 
    }
    66% { 
        transform: rotateX(120deg) rotateY(120deg) rotateZ(0deg) scale(0.9); 
    }
    100% { 
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); 
    }
}

@keyframes mathGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 2px var(--color-yellow-light));
        opacity: 0.6;
    }
    25% { 
        filter: drop-shadow(0 0 3px var(--color-red-light));
        opacity: 0.7;
    }
    50% { 
        filter: drop-shadow(0 0 4px var(--color-blue-light));
        opacity: 0.8;
    }
    75% { 
        filter: drop-shadow(0 0 3px var(--color-green-light));
        opacity: 0.7;
    }
}

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

@keyframes containerGlow {
    0%, 100% { 
        box-shadow: 0 8px 25px rgba(6, 41, 67, 0.15), 0 0 10px rgba(255, 217, 167, 0.05);
    }
    50% { 
        box-shadow: 0 12px 40px rgba(6, 41, 67, 0.2), 0 0 15px rgba(255, 192, 167, 0.08);
    }
}

@keyframes pathRotation {
    0% { 
        transform: translate(-50%, -50%) rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
    25% { 
        transform: translate(-50%, -50%) rotateX(90deg) rotateY(0deg) rotateZ(0deg); 
    }
    50% { 
        transform: translate(-50%, -50%) rotateX(90deg) rotateY(90deg) rotateZ(0deg); 
    }
    75% { 
        transform: translate(-50%, -50%) rotateX(0deg) rotateY(90deg) rotateZ(90deg); 
    }
    100% { 
        transform: translate(-50%, -50%) rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
}

/* ===== ANIMATION CLASSES ===== */
.fade-in {
    animation: fadeInUp 0.8s ease-out;
}

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

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

.slide-out-right {
    animation: slideOutRight 0.3s ease-in;
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

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

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

.pulse-animation {
    animation: pulse 0.6s ease-in-out;
}

/* ===== 3D MATHEMATICAL ANIMATION CLASSES ===== */
.rotate-3d {
    animation: rotate3D 8s ease-in-out infinite;
}

.lissajous-3d {
    animation: lissajous3D 12s ease-in-out infinite;
}

.lissajous-3d-figure {
    animation: lissajous3D 12s ease-in-out infinite;
}

.math-glow {
    animation: mathGlow 4s ease-in-out infinite;
}

.math-pulse {
    animation: mathPulse 3s ease-in-out infinite;
}

/* ===== 3D PATH ANIMATIONS ===== */
.lissajous-3d-path {
    transition: transform 0.3s ease;
}

.lissajous-3d-path.math-glow {
    animation: mathGlow 4s ease-in-out infinite;
}

.lissajous-3d-path:nth-child(1) {
    animation: mathGlow 4s ease-in-out infinite;
    animation-delay: 0s;
}

.lissajous-3d-path:nth-child(2) {
    animation: mathGlow 4s ease-in-out infinite;
    animation-delay: 0.5s;
}

.lissajous-3d-path:nth-child(3) {
    animation: mathGlow 4s ease-in-out infinite;
    animation-delay: 1s;
}

.lissajous-3d-path:nth-child(4) {
    animation: mathGlow 4s ease-in-out infinite;
    animation-delay: 1.5s;
}

.lissajous-3d-path:nth-child(5) {
    animation: mathGlow 4s ease-in-out infinite;
    animation-delay: 2s;
}

.lissajous-3d-path:nth-child(6) {
    animation: mathGlow 4s ease-in-out infinite;
    animation-delay: 2.5s;
}

/* ===== NEW ANIMATION CLASSES ===== */
.container-glow {
    animation: containerGlow 6s ease-in-out infinite;
}

.path-rotation {
    animation: pathRotation 8s ease-in-out infinite;
}

/* ===== COMPONENT-SPECIFIC ANIMATIONS ===== */
/* Footer animations */
footer.fade-in {
    animation: fadeInUp 0.8s ease-out;
}

/* Navbar animations */
.navbar.fade-in {
    animation: fadeInDown 0.6s ease-out;
}

/* Pagination animations */
.pagination.fade-in {
    animation: paginationFadeIn 0.6s ease-out;
}

.pagination.slide-in {
    animation: paginationSlideIn 0.5s ease-out;
}

/* Modal animations */
.search-modal-enter {
    animation: modalSlideIn 0.4s ease-out;
}

/* ===== INTERACTIVE ANIMATIONS ===== */
/* Footer link hover effects */
footer a {
    transition: transform var(--transition-normal);
}

/* Navbar toggler icon rotation */
.navbar-toggler-icon {
    transition: transform var(--transition-normal);
}

.navbar-toggler:hover .navbar-toggler-icon {
    transform: rotate(90deg);
}

/* Social link loading animation */
.social-link-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 5px;
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .breathe-animation {
        animation: none;
    }
    
    .lissajous-3d-figure {
        animation: none !important;
    }
    
    .lissajous-3d-path {
        animation: none !important;
    }
    
    .math-3d-container {
        animation: none !important;
    }
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    .lissajous-3d-path {
        animation-duration: 8s !important; /* Slower animations on mobile */
    }
    
    .math-3d-container {
        animation-duration: 10s !important; /* Slower container glow */
    }
    
    .lissajous-3d-figure {
        animation-duration: 16s !important; /* Slower 3D rotation */
    }
}

/* ===== LOW-END DEVICE OPTIMIZATIONS ===== */
@media (max-width: 480px) {
    .lissajous-3d-path {
        animation: none !important; /* Disable complex animations on very small screens */
    }
    
    .math-3d-container {
        animation: none !important;
    }
    
    .lissajous-3d-figure {
        animation: none !important;
    }
}
