/* ===== MICRO-INTERACTIONS & ANIMATIONS ===== */

/* Smooth transitions for all interactive elements */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, 
                box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

/* ===== BUTTON ANIMATIONS ===== */
.btn {
    position: relative;
    overflow: hidden;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::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 ease;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-500);
    color: var(--primary-500);
}

/* ===== CARD ANIMATIONS ===== */
.tool-card,
.category-card,
.use-case-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center bottom;
}

.tool-card:hover,
.category-card:hover,
.use-case-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.tool-card:hover .tool-logo img,
.category-card:hover .category-icon {
    transform: scale(1.1) rotate(5deg);
}

.tool-logo img,
.category-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LINK ANIMATIONS ===== */
.nav-link {
    position: relative;
    overflow: hidden;
}

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

.nav-link:hover::after,
.nav-link:focus::after {
    width: 100%;
}

/* Text links with underline animation */
a:not(.btn):not(.nav-link):not(.brand-link) {
    position: relative;
    text-decoration: none;
    background-image: linear-gradient(to right, var(--primary-500), var(--primary-500));
    background-size: 0% 2px;
    background-position: 0% 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}

a:not(.btn):not(.nav-link):not(.brand-link):hover {
    background-size: 100% 2px;
}

/* ===== FORM ANIMATIONS ===== */
.form-input {
    transition: all 0.3s ease;
}

.form-input:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.form-input:focus + .floating-label {
    color: var(--primary-500);
    transform: translateY(-1px);
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@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 slideInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translate3d(-30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== SCROLL ANIMATIONS ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.slide-left {
    transform: translateX(-30px);
}

.animate-on-scroll.slide-left.animate-in {
    transform: translateX(0);
}

.animate-on-scroll.slide-right {
    transform: translateX(30px);
}

.animate-on-scroll.slide-right.animate-in {
    transform: translateX(0);
}

.animate-on-scroll.fade-scale {
    transform: scale(0.9);
}

.animate-on-scroll.fade-scale.animate-in {
    transform: scale(1);
}

/* Staggered animations */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-animation.animate-in > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-animation.animate-in > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-animation.animate-in > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-animation.animate-in > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-animation.animate-in > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-animation.animate-in > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-animation.animate-in > * {
    opacity: 1;
    transform: translateY(0);
}

/* ===== HOVER EFFECTS ===== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

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

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

/* ===== FOCUS ANIMATIONS ===== */
.focus-ring {
    transition: box-shadow 0.2s ease;
}

.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* ===== NOTIFICATION ANIMATIONS ===== */
.toast {
    animation: slideInRight 0.3s ease;
}

.toast.removing {
    animation: slideOutRight 0.3s ease;
}

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

/* ===== MODAL ANIMATIONS ===== */
.modal {
    animation: fadeInScale 0.3s ease;
}

.modal.closing {
    animation: fadeOutScale 0.3s ease;
}

@keyframes fadeOutScale {
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* ===== PROGRESS ANIMATIONS ===== */
.progress-fill {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.animate {
    animation: progressFill 2s ease-in-out;
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: var(--target-width, 100%); }
}

/* ===== RESPONSIVE ANIMATIONS ===== */
@media (max-width: 768px) {
    .tool-card:hover,
    .category-card:hover,
    .use-case-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .btn:hover {
        transform: translateY(-1px);
    }
}

/* ===== 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;
        scroll-behavior: auto !important;
    }
    
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}
