/* ================================================================
   WEBAPPTOWN ANIMATIONS & TRANSITIONS
   Subtle, smooth, Apple-inspired animations
   ================================================================ */

/* ============================================================
   SCROLL ANIMATIONS (AOS Alternative - Custom)
   ============================================================ */

/* Fade animations */
[data-animate="fade-up"] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

[data-animate="fade-up"].animate-in {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-down"] {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

[data-animate="fade-down"].animate-in {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-left"] {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

[data-animate="fade-left"].animate-in {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="fade-right"] {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

[data-animate="fade-right"].animate-in {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="fade-in"] {
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

[data-animate="fade-in"].animate-in {
    opacity: 1;
}

/* Scale animations */
[data-animate="scale-up"] {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate="scale-up"].animate-in {
    opacity: 1;
    transform: scale(1);
}

/* Stagger delays for sequential animations */
[data-delay="50"] { transition-delay: 50ms; }
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="150"] { transition-delay: 150ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="250"] { transition-delay: 250ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }

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

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

.hover-lift:hover {
    transform: translateY(-8px);
}

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

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

/* Glow effect */
.hover-glow {
    position: relative;
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(46, 125, 255, 0.4);
}

/* Underline animation */
.hover-underline {
    position: relative;
    display: inline-block;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

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

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

/* Pulse animation for CTAs */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.btn-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.btn-pulse:hover {
    animation: none;
}

/* Shine effect on hover */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-shine:hover::before {
    left: 100%;
}

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

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

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Skeleton loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 0px, #f8f8f8 40px, #f0f0f0 80px);
    background-size: 200px 100%;
    animation: skeleton-loading 1.2s ease-in-out infinite;
}

/* Dots loading */
@keyframes dots-loading {
    0%, 20% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.3;
    }
}

.dots-loading span {
    display: inline-block;
    animation: dots-loading 1.4s infinite;
}

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

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

/* ============================================================
   NAVIGATION ANIMATIONS
   ============================================================ */

/* Sticky navbar transition */
.navbar {
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Mobile menu slide-in */
@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

.mobile-menu-enter {
    animation: slideInFromRight 0.3s ease-out forwards;
}

.mobile-menu-exit {
    animation: slideOutToRight 0.3s ease-in forwards;
}

/* Dropdown fade */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ============================================================
   MODAL ANIMATIONS
   ============================================================ */

/* Backdrop fade */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.modal-backdrop-enter {
    animation: fadeIn 0.3s ease-out;
}

.modal-backdrop-exit {
    animation: fadeOut 0.3s ease-in;
}

/* Modal slide up */
@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-enter {
    animation: modalSlideUp 0.3s ease-out;
}

.modal-exit {
    animation: modalSlideDown 0.3s ease-in;
}

/* ============================================================
   HERO BACKGROUND ANIMATIONS
   ============================================================ */

/* Gradient animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

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

.float-animation {
    animation: float 6s ease-in-out infinite;
}

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

/* ============================================================
   STAT COUNTER ANIMATIONS
   ============================================================ */

/* Number count-up (handled by JS, but CSS for smooth rendering) */
.stat-number {
    transition: all 0.5s ease;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   FORM ANIMATIONS
   ============================================================ */

/* Input focus */
.form-input,
.form-textarea,
.form-select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(46, 125, 255, 0.1);
}

/* Label float animation */
.form-group {
    position: relative;
}

.form-label-float {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    transition: all 0.2s ease;
    color: var(--text-tertiary);
}

.form-input:focus + .form-label-float,
.form-input:not(:placeholder-shown) + .form-label-float {
    top: -8px;
    font-size: 0.75rem;
    background: white;
    padding: 0 4px;
    color: var(--primary-blue);
}

/* Checkbox/radio animation */
.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
    transition: all 0.2s ease;
}

.form-checkbox input[type="checkbox"]:checked,
.form-radio input[type="radio"]:checked {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

/* Progress bar */
@keyframes progressFill {
    from {
        width: 0;
    }
}

.progress-bar {
    transition: width 0.5s ease;
}

/* Success checkmark */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.checkmark-icon {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

.checkmark-icon.animate {
    animation: checkmark 0.5s ease-out forwards;
}

/* ============================================================
   IMAGE ANIMATIONS
   ============================================================ */

/* Lazy load fade-in */
.lazy-image {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Image zoom on hover */
.image-zoom-container {
    overflow: hidden;
}

.image-zoom {
    transition: transform 0.5s ease;
}

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

/* Parallax effect (subtle) */
.parallax {
    transition: transform 0.1s ease-out;
}

/* ============================================================
   TEXT ANIMATIONS
   ============================================================ */

/* Typing effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 2px solid;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Gradient text animation */
@keyframes gradientText {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.text-gradient-animated {
    background: linear-gradient(90deg, var(--primary-blue), var(--electric-cyan), var(--primary-blue));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientText 3s ease infinite;
}

/* ============================================================
   TOOLTIP ANIMATIONS
   ============================================================ */

.tooltip {
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ============================================================
   NOTIFICATION ANIMATIONS
   ============================================================ */

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

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

.notification-enter {
    animation: slideInFromTop 0.3s ease-out;
}

.notification-exit {
    animation: slideOutToTop 0.3s ease-in;
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* ============================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================ */

/* Use hardware acceleration for transforms */
.hw-accelerate {
    transform: translateZ(0);
    will-change: transform;
}

/* Optimize animations for performance */
@media (prefers-reduced-motion: no-preference) {
    .smooth-scroll {
        scroll-behavior: smooth;
    }
}

/* ============================================================
   ACCESSIBILITY - 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;
    }
    
    .animated-gradient,
    .float-animation,
    .typing-effect,
    .text-gradient-animated {
        animation: none !important;
    }
}
