/*
 * Tech QA Global - CSS Animations
 * Pure CSS animations - No JavaScript
 */

/* ================================
   KEYFRAME ANIMATIONS
   ================================ */

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Blob Float Animation */
@keyframes blob-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.05);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(-30px, -20px) scale(1.02);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(37, 99, 235, 0);
    }
}

/* Pulse Ring Animation */
@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Sparkle Animation */
@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Chart Grow Animation */
@keyframes chart-grow {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

/* Gradient Shift Animation */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Slide In From Bottom */
@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Counter Animation - CSS Only Illusion */
@keyframes counter {
    0% { content: '0'; }
    10% { content: '10'; }
    20% { content: '20'; }
    30% { content: '30'; }
    40% { content: '40'; }
    50% { content: '50'; }
    60% { content: '60'; }
    70% { content: '70'; }
    80% { content: '80'; }
    90% { content: '90'; }
    100% { content: '100'; }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

.animate {
    animation-duration: 0.8s;
    animation-fill-mode: both;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }
.animate-delay-7 { animation-delay: 0.7s; }
.animate-delay-8 { animation-delay: 0.8s; }

.animate-fadeInUp { animation-name: fadeInUp; }
.animate-fadeInDown { animation-name: fadeInDown; }
.animate-fadeInLeft { animation-name: fadeInLeft; }
.animate-fadeInRight { animation-name: fadeInRight; }
.animate-fadeIn { animation-name: fadeIn; }
.animate-scaleIn { animation-name: scaleIn; }
.animate-float { animation-name: float; animation-duration: 6s; animation-iteration-count: infinite; }
.animate-pulse { animation-name: pulse; animation-duration: 2s; animation-iteration-count: infinite; }
.animate-bounce { animation-name: bounce; animation-duration: 2s; animation-iteration-count: infinite; }
.animate-rotate { animation-name: rotate; animation-duration: 20s; animation-iteration-count: infinite; animation-timing-function: linear; }

/* ================================
   SCROLL REVEAL ANIMATIONS
   Using CSS :target and Intersection Observer alternative
   ================================ */

/* Stagger children animations */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }

/* ================================
   HOVER ANIMATIONS
   ================================ */

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

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

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.4);
}

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

.card-entrance {
    opacity: 0;
    transform: translateY(30px);
    animation: cardEntrance 0.6s ease forwards;
}

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   GRADIENT ANIMATIONS
   ================================ */

.animated-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

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

.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--light-200) 25%,
        var(--light-100) 50%,
        var(--light-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ================================
   BUTTON ANIMATIONS
   ================================ */

.btn-animated {
    position: relative;
    overflow: hidden;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-animated:hover::before {
    width: 300px;
    height: 300px;
}

/* ================================
   ICON ANIMATIONS
   ================================ */

.icon-spin:hover svg {
    animation: rotate 0.5s ease;
}

.icon-bounce:hover svg {
    animation: bounce 0.5s ease;
}

.icon-pulse:hover svg {
    animation: pulse 1s ease infinite;
}

/* ================================
   UNDERLINE ANIMATIONS
   ================================ */

.animated-underline {
    position: relative;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.animated-underline:hover::after {
    width: 100%;
}

/* ================================
   BORDER ANIMATIONS
   ================================ */

.animated-border {
    position: relative;
}

.animated-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;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.animated-border:hover::before {
    opacity: 1;
}

/* ================================
   NOTIFICATION BADGE PULSE
   ================================ */

.badge-pulse {
    position: relative;
}

.badge-pulse::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: #EF4444;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* ================================
   TYPING EFFECT (CSS Only)
   ================================ */

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--secondary);
    animation: 
        typing 3s steps(40, 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(--secondary); }
}

/* ================================
   PARALLAX EFFECT (CSS Only)
   ================================ */

.parallax-container {
    perspective: 1px;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.parallax-layer-back {
    transform: translateZ(-1px) scale(2);
}

.parallax-layer-base {
    transform: translateZ(0);
}

/* ================================
   MORPHING SHAPES
   ================================ */

.morph-shape {
    animation: morph 8s ease-in-out infinite;
}

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

/* ================================
   WAVE ANIMATION
   ================================ */

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

@keyframes wave {
    0%, 100% {
        d: path("M0,50 Q25,30 50,50 T100,50");
    }
    50% {
        d: path("M0,50 Q25,70 50,50 T100,50");
    }
}

/* ================================
   SCROLL INDICATOR
   ================================ */

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.scroll-indicator-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scroll-indicator-mouse {
    width: 24px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    position: relative;
}

.scroll-indicator-wheel {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    animation: scroll-wheel 1.5s ease-in-out infinite;
}

@keyframes scroll-wheel {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
