/* Claude AI Animations CSS - Smooth Micro-interactions */

/* === KEYFRAME DEFINITIONS === */

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

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

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

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

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

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

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

@keyframes expandDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: var(--space-6);
        padding-bottom: var(--space-6);
    }
}

@keyframes contractUp {
    from {
        opacity: 1;
        max-height: 1000px;
        padding-top: var(--space-6);
        padding-bottom: var(--space-6);
    }
    to {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

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

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

@keyframes bounce {
    0%, 100% { 
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% { 
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(238, 119, 35, 0.2);
    }
    50% { 
        box-shadow: 0 0 20px rgba(238, 119, 35, 0.4);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

@keyframes shimmer {
    0% { 
        background-position: -200% center; 
    }
    100% { 
        background-position: 200% center; 
    }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

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

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-fadeInUp {
    animation: fadeInUp 0.4s ease-out;
}

.animate-slideUp {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.animate-slideLeft {
    animation: slideLeft 0.3s ease-out;
}

.animate-slideRight {
    animation: slideRight 0.3s ease-out;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

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

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

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

.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

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

.hover-rotate {
    transition: transform var(--transition-normal);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(238, 119, 35, 0.3);
}

.hover-bounce {
    transition: transform var(--transition-fast);
}

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

/* === FOCUS ANIMATIONS === */

.focus-ring {
    transition: box-shadow var(--transition-fast);
}

.focus-ring:focus-visible {
    box-shadow: 0 0 0 3px rgba(238, 119, 35, 0.3);
    animation: glow 0.3s ease-out;
}

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

.loading-dots::after {
    content: '';
    display: inline-block;
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--orange-500);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    display: inline-block;
}

.loading-pulse {
    background: linear-gradient(90deg, var(--gray-100), var(--gray-200), var(--gray-100));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

.entrance-delay-1 { animation-delay: 0.1s; }
.entrance-delay-2 { animation-delay: 0.2s; }
.entrance-delay-3 { animation-delay: 0.3s; }
.entrance-delay-4 { animation-delay: 0.4s; }
.entrance-delay-5 { animation-delay: 0.5s; }

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }

/* === CUSTOM EASING CURVES === */

.ease-in-out-back {
    transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ease-in-out-quart {
    transition-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
}

.ease-out-expo {
    transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
}

.ease-spring {
    transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* === MICRO-INTERACTIONS === */

.button-press {
    transition: transform var(--transition-fast);
}

.button-press:active {
    transform: scale(0.98);
}

.card-float {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card-float:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.icon-wiggle {
    transition: transform var(--transition-normal);
}

.icon-wiggle:hover {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

/* === PROGRESS ANIMATIONS === */

.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* === ACCESSIBILITY CONSIDERATIONS === */

@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-fadeIn,
    .animate-fadeInUp,
    .animate-slideUp,
    .animate-slideDown,
    .animate-slideLeft,
    .animate-slideRight {
        animation: none;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }
}

/* === PRINT STYLES === */

@media print {
    .animate-spin,
    .animate-pulse,
    .animate-bounce,
    .animate-float,
    .animate-shimmer,
    .loading-spinner,
    .loading-pulse {
        animation: none !important;
    }
    
    .hover-lift,
    .hover-scale,
    .hover-rotate,
    .hover-glow {
        transition: none !important;
    }
}

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

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.will-change-contents {
    will-change: contents;
}

.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Remove will-change after animation completes */
.animation-complete {
    will-change: auto;
}

/* === CUSTOM ANIMATIONS FOR SPECIFIC COMPONENTS === */

/* Modal entrance */
.modal.entering {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toast notifications */
.toast.entering {
    animation: slideLeft 0.3s ease-out;
}

.toast.exiting {
    animation: slideRight 0.3s ease-in;
}

/* Form field focus */
.dynamic-input-group.focusing {
    animation: glow 0.3s ease-out;
}

/* Button click feedback */
.btn.clicking {
    animation: button-click 0.2s ease-out;
}

@keyframes button-click {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

/* Card selection */
.template-card.selecting,
.model-card.selecting {
    animation: card-select 0.3s ease-out;
}

@keyframes card-select {
    0% { 
        transform: scale(1);
        border-color: var(--gray-200);
    }
    50% { 
        transform: scale(1.02);
        border-color: var(--orange-300);
    }
    100% { 
        transform: scale(1);
        border-color: var(--orange-500);
    }
}

/* Success feedback */
.success-feedback {
    animation: success-pulse 0.6s ease-out;
}

@keyframes success-pulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Error feedback */
.error-feedback {
    animation: shake 0.5s ease-in-out;
}

/* Loading state for generate button */
.generate-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.generate-btn.loading .generate-text,
.generate-btn.loading .generate-icon {
    opacity: 0.3;
}

/* Skeleton loading for cards */
.card-skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-100) 25%,
        var(--gray-200) 50%,
        var(--gray-100) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xl);
    height: 140px;
}

/* Progressive reveal for content */
.progressive-reveal {
    overflow: hidden;
}

.progressive-reveal > * {
    animation: slideUp 0.4s ease-out;
    animation-fill-mode: both;
}

.progressive-reveal > *:nth-child(1) { animation-delay: 0ms; }
.progressive-reveal > *:nth-child(2) { animation-delay: 100ms; }
.progressive-reveal > *:nth-child(3) { animation-delay: 200ms; }
.progressive-reveal > *:nth-child(4) { animation-delay: 300ms; }
.progressive-reveal > *:nth-child(5) { animation-delay: 400ms; }