/* =========================================================
   ANIMATIONS & TRANSITIONS — SMOOTH MODERN
   ========================================================= */

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

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

/* Fade out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Slide up animation */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide down animation */
@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide left animation */
@keyframes slideLeft {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide right animation */
@keyframes slideRight {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

/* Scale in animation */
@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scale out animation */
@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.95);
        opacity: 0;
    }
}

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

/* Spin animation (slower) */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Shimmer animation for loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

/* Wiggle animation */
@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-1deg);
    }
    75% {
        transform: rotate(1deg);
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s var(--ease) forwards;
}

.animate-fade-out {
    animation: fadeOut 0.3s var(--ease) forwards;
}

.animate-slide-up {
    animation: slideUp 0.4s var(--ease) forwards;
}

.animate-slide-down {
    animation: slideDown 0.4s var(--ease) forwards;
}

.animate-slide-left {
    animation: slideLeft 0.4s var(--ease) forwards;
}

.animate-slide-right {
    animation: slideRight 0.4s var(--ease) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.3s var(--ease) forwards;
}

.animate-scale-out {
    animation: scaleOut 0.3s var(--ease) forwards;
}

.animate-bounce {
    animation: bounce 0.6s var(--ease) infinite;
}

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

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

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

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

/* =========================================================
   TRANSITION UTILITIES
   ========================================================= */

.transition-all {
    transition: all 0.2s var(--ease);
}

.transition-color {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.transition-transform {
    transition: transform 0.2s var(--ease);
}

.transition-opacity {
    transition: opacity 0.2s ease;
}

/* =========================================================
   COMPONENT ANIMATIONS
   ========================================================= */

/* Button press animation */
.btn {
    transition: all 0.2s var(--ease);
}

.btn:active {
    transform: scale(0.98);
}

/* Panel entry animation */
.panel-section {
    animation: slideUp 0.3s var(--ease) backwards;
}

/* Staggered animations */
.animate-stagger-1 {
    animation-delay: 0ms;
}

.animate-stagger-2 {
    animation-delay: 100ms;
}

.animate-stagger-3 {
    animation-delay: 200ms;
}

.animate-stagger-4 {
    animation-delay: 300ms;
}

.animate-stagger-5 {
    animation-delay: 400ms;
}

/* =========================================================
   LOADING SPINNER
   ========================================================= */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--primary-soft);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 4px;
}

.spinner-dark {
    border-color: rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
}

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

.modal {
    animation: scaleIn 0.3s var(--ease);
}

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

.modal.exit {
    animation: scaleOut 0.3s var(--ease);
}

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

.toast-enter {
    animation: slideUp 0.3s var(--ease) forwards;
}

.toast-exit {
    animation: slideDown 0.3s var(--ease) forwards;
}

/* =========================================================
   PAGE TRANSITIONS
   ========================================================= */

.page-enter {
    animation: fadeIn 0.3s var(--ease);
}

.page-exit {
    animation: fadeOut 0.3s var(--ease);
}

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

@media (hover: hover) and (pointer: fine) {
    a {
        transition: all 0.2s ease;
    }
    
    a:hover {
        transform: translateY(-2px);
    }
    
    .interactive {
        transition: all 0.2s var(--ease);
    }
    
    .interactive:hover {
        transform: translateY(-2px);
    }
}

/* =========================================================
   SKELETON LOADING ANIMATION
   ========================================================= */

.skeleton {
    background: linear-gradient(90deg, 
        var(--panel) 0%, 
        rgba(255, 255, 255, 0.2) 20%, 
        var(--panel) 40%,
        var(--panel) 100%);
    background-size: 1000px 100%;
    animation: shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, 
        rgba(20, 25, 40, 0.6) 0%, 
        rgba(100, 150, 255, 0.1) 20%, 
        rgba(20, 25, 40, 0.6) 40%,
        rgba(20, 25, 40, 0.6) 100%);
    animation: shimmer 1.5s infinite;
}

/* =========================================================
   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;
    }
}

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

/* Use will-change for animations */
.animate-performance {
    will-change: transform, opacity;
}

/* Remove will-change after animation */
.animate-performance.done {
    will-change: auto;
}

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

/* Ensure animations respect prefers-motion */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in,
    .animate-slide-up,
    .animate-scale-in,
    .animate-bounce,
    .animate-spin {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
