/* ================================
   ADVERSITY MEDIA - ANIMATIONS & EFFECTS
   Modern CSS Animations and Interactions
   Mobile-Optimized Version
   ================================ */

/* Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px var(--accent-orange);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-orange), 0 0 30px var(--accent-orange);
    }
    100% {
        box-shadow: 0 0 5px var(--accent-orange);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--accent-orange);
    }
}

/* Mobile-Optimized Keyframes */
@media (max-width: 768px) {
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(50px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes shake {
        0%, 100% {
            transform: translateX(0);
        }
        10%, 30%, 50%, 70%, 90% {
            transform: translateX(-5px);
        }
        20%, 40%, 60%, 80% {
            transform: translateX(5px);
        }
    }
}

/* Scroll Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
    will-change: transform, opacity;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Using consistent scroll animations for all devices */

/* Counter Animation */
.counter {
    font-weight: 800;
    color: var(--accent-orange);
    will-change: contents;
}

.counter.counting {
    animation: pulse 0.5s ease-in-out;
}

/* Button Animations */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    will-change: transform;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-animated:hover::before {
    left: 100%;
}

.btn-bounce:hover {
    animation: bounceIn 0.6s ease;
}

.btn-glow:hover {
    animation: glow 1.5s ease-in-out infinite alternate;
}

/* Using consistent button animations for all devices */

/* Card Animations */
.card-hover {
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
}

.card-hover:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: var(--shadow-xl);
}

.card-3d {
    perspective: 1000px;
}

.card-3d-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
    will-change: transform;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(5deg) rotateX(5deg);
}

/* Using consistent card animations for all devices */

/* Image Animations */
.image-zoom {
    overflow: hidden;
    border-radius: var(--border-radius);
}

.image-zoom img {
    transition: transform 0.5s ease;
    will-change: transform;
}

.image-zoom:hover img {
    transform: scale(1.1);
}

.image-float {
    animation: float 6s ease-in-out infinite;
    will-change: transform;
}

.image-tilt:hover {
    transform: rotate(2deg) scale(1.02);
    transition: all 0.3s ease;
}

/* Mobile Image Optimizations */
@media (max-width: 768px) {
    .image-float {
        animation-duration: 8s;
    }
    
    .image-zoom:hover img {
        transform: scale(1.05);
    }
    
    .image-tilt:hover {
        transform: rotate(1deg) scale(1.01);
    }
    
    @media (hover: none) {
        .image-tilt:hover {
            transform: none;
        }
    }
}

/* Text Animations */
.text-gradient-animate {
    background: linear-gradient(-45deg, var(--primary-blue), var(--accent-orange), var(--secondary-purple), var(--accent-teal));
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
    will-change: background-position;
}

.text-typewriter {
    overflow: hidden;
    border-right: 3px solid var(--accent-orange);
    white-space: nowrap;
    margin: 0 auto;
    animation: typewriter 3s steps(40, end), blinkCursor 0.75s step-end infinite;
}

.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--accent-orange);
    animation: reveal 1.5s ease-in-out;
}

@keyframes reveal {
    0% {
        width: 0;
    }
    50% {
        width: 100%;
    }
    100% {
        width: 0;
        left: 100%;
    }
}

/* Using consistent text animations for all devices */

/* Icon Animations */
.icon-spin:hover {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.icon-bounce:hover {
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    80% {
        transform: translateY(-10px);
    }
}

.icon-pulse:hover {
    animation: iconPulse 1s ease-in-out infinite;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Using consistent icon animations for all devices */

/* Loading Animations */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--accent-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    will-change: transform;
}

.loading-dots-bounce {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.loading-dots-bounce div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent-orange);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
    will-change: transform;
}

.loading-dots-bounce div:nth-child(1) {
    left: 8px;
    animation: dots1 0.6s infinite;
}

.loading-dots-bounce div:nth-child(2) {
    left: 8px;
    animation: dots2 0.6s infinite;
}

.loading-dots-bounce div:nth-child(3) {
    left: 32px;
    animation: dots2 0.6s infinite;
}

.loading-dots-bounce div:nth-child(4) {
    left: 56px;
    animation: dots3 0.6s infinite;
}

@keyframes dots1 {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes dots3 {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(0);
    }
}

@keyframes dots2 {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(24px, 0);
    }
}

/* Using consistent loading animations for all devices */

/* Scroll Indicators */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--gradient-accent);
    z-index: 9999;
    transition: width 0.2s ease;
    will-change: width;
}

/* Using consistent scroll indicators for all devices */

/* Parallax Effects */
.parallax {
    transform: translateZ(0);
    transition: transform 0.2s ease-out;
    will-change: transform;
}

.parallax-slow {
    transform: translate3d(0, 0, 0);
}

/* Disable parallax on mobile for better performance */
@media (max-width: 768px) {
    .parallax,
    .parallax-slow {
        transform: none !important;
    }
}

/* Hover Effects */
.hover-lift {
    transition: all 0.3s ease;
    will-change: transform, box-shadow;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 140, 66, 0.5);
    transition: box-shadow 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
    transition: transform 0.3s ease;
}

/* Mobile Hover Adjustments */
@media (max-width: 768px) {
    .hover-lift:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow);
    }
    
    .hover-scale:hover {
        transform: scale(1.02);
    }
    
    .hover-rotate:hover {
        transform: rotate(2deg);
    }
    
    @media (hover: none) {
        .hover-lift:hover,
        .hover-glow:hover,
        .hover-scale:hover,
        .hover-rotate:hover {
            transform: none;
            box-shadow: initial;
        }
    }
}

/* Page Transitions */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    will-change: transform, opacity;
}

.page-transition.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Using consistent page transitions for all devices */

/* Form Animations */
.form-group {
    position: relative;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.form-floating {
    position: relative;
}

.form-floating label {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--gray-500);
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-floating input:focus + label,
.form-floating input:not(:placeholder-shown) + label {
    top: 8px;
    font-size: 12px;
    color: var(--primary-blue);
    transform: translateY(0);
}

/* Using consistent form animations for all devices */

/* Navigation Animations */
.navbar-slide-down {
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    will-change: transform;
}

.navbar-slide-down.show {
    transform: translateY(0);
}

.nav-link-underline {
    position: relative;
}

.nav-link-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-orange);
    transition: width 0.3s ease;
}

.nav-link-underline:hover::after,
.nav-link-underline.active::after {
    width: 100%;
}

/* Modal Animations */
.modal-fade-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.modal-fade-in.show {
    opacity: 1;
    transform: scale(1);
}

/* Using consistent modal animations for all devices */

/* Tooltip Animations */
.tooltip {
    position: relative;
    cursor: pointer;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-800);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Using consistent tooltip animations for all devices */

/* Stagger Animations */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Mobile Stagger Adjustments */
@media (max-width: 768px) {
    .stagger-animation > * {
        transform: translateY(15px);
        animation-duration: 0.4s;
    }
}

/* Progress Bar Animations */
.progress-bar {
    position: relative;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
    transition: width 2s ease;
    will-change: width;
}

.progress-bar::before {
    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 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Using consistent progress bar animations for all devices */

/* Entrance Animations */
.entrance-fade {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.entrance-slide {
    transform: translateX(-100%);
    animation: slideInRight 0.8s ease forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.entrance-bounce {
    animation: bounceIn 1s ease forwards;
}

.entrance-rotate {
    animation: rotateIn 0.8s ease forwards;
}

/* Using consistent entrance animations for all devices */

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Using consistent ripple effects for all devices */

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Enhanced Mobile Performance */
@media (max-width: 768px) {
    /* Force hardware acceleration on key animated elements */
    .animate-on-scroll,
    .card-hover,
    .btn-animated,
    .image-zoom img,
    .loading-spinner {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* Reduce animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .parallax,
    .text-gradient-animate,
    .image-float {
        transform: none !important;
        animation: none !important;
    }
    
    .stagger-animation > * {
        opacity: 1;
        transform: none !important;
        animation: none !important;
    }
}

/* Using consistent animations for all devices regardless of battery status */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gradient-animate {
        background: none;
        color: var(--gray-800);
        -webkit-text-fill-color: unset;
    }
    
    .glow,
    .hover-glow:hover {
        box-shadow: none;
        border: 2px solid var(--accent-orange);
    }
}

/* Dark mode animation adjustments */
@media (prefers-color-scheme: dark) {
    .tooltip::before {
        background: var(--gray-200);
        color: var(--gray-800);
    }
    
    .tooltip::after {
        border-top-color: var(--gray-200);
    }
    
    .progress-bar {
        background: var(--gray-700);
    }
}
