/* Animation Utilities */

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.loading-content {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-state h3 {
    color: #374151;
    margin-bottom: 0.5rem;
}

.error-state p {
    margin-bottom: 1.5rem;
}

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

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

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

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

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

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

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

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

@keyframes slideOutDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

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

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

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

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

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

/* Rotation Animations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes spinReverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

@keyframes rotateOut {
    from {
        opacity: 1;
        transform: rotate(0deg);
    }
    to {
        opacity: 0;
        transform: rotate(200deg);
    }
}

/* Bounce Animations */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceOut {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* Pulse Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

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

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

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

/* Wiggle Animation */
@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

/* Heartbeat Animation */
@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* Loading Animations */
@keyframes loadingDots {
    0%, 20% {
        color: rgba(0, 0, 0, 0);
        text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0), 0.5em 0 0 rgba(0, 0, 0, 0);
    }
    40% {
        color: black;
        text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0), 0.5em 0 0 rgba(0, 0, 0, 0);
    }
    60% {
        text-shadow: 0.25em 0 0 black, 0.5em 0 0 rgba(0, 0, 0, 0);
    }
    80%, 100% {
        text-shadow: 0.25em 0 0 black, 0.5em 0 0 black;
    }
}

@keyframes loadingBar {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }
    50% {
        transform: scaleX(1);
        transform-origin: left;
    }
    51% {
        transform-origin: right;
    }
    100% {
        transform: scaleX(0);
        transform-origin: right;
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease-out;
}

.animate-fade-out {
    animation: fadeOut var(--transition-normal) ease-in;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-normal) ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown var(--transition-normal) ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft var(--transition-normal) ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight var(--transition-normal) ease-out;
}

.animate-slide-in-up {
    animation: slideInUp var(--transition-normal) ease-out;
}

.animate-slide-in-down {
    animation: slideInDown var(--transition-normal) ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft var(--transition-normal) ease-out;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-normal) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--transition-normal) ease-out;
}

.animate-scale-out {
    animation: scaleOut var(--transition-normal) ease-in;
}

.animate-scale-in-up {
    animation: scaleInUp var(--transition-normal) ease-out;
}

.animate-scale-in-down {
    animation: scaleInDown var(--transition-normal) ease-out;
}

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

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

.animate-rotate-in {
    animation: rotateIn var(--transition-normal) ease-out;
}

.animate-rotate-out {
    animation: rotateOut var(--transition-normal) ease-in;
}

.animate-bounce {
    animation: bounce 1s ease-in-out;
}

.animate-bounce-in {
    animation: bounceIn var(--transition-normal) ease-out;
}

.animate-bounce-out {
    animation: bounceOut var(--transition-normal) ease-in;
}

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

.animate-pulse-in {
    animation: pulseIn var(--transition-normal) ease-out;
}

.animate-pulse-out {
    animation: pulseOut var(--transition-normal) ease-in;
}

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

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

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-loading-dots {
    animation: loadingDots 1.4s ease-in-out infinite;
}

.animate-loading-bar {
    animation: loadingBar 2s ease-in-out infinite;
}

/* Animation Delays */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

.animate-delay-700 {
    animation-delay: 0.7s;
}

.animate-delay-1000 {
    animation-delay: 1s;
}

/* Animation Durations */
.animate-duration-75 {
    animation-duration: 75ms;
}

.animate-duration-100 {
    animation-duration: 100ms;
}

.animate-duration-150 {
    animation-duration: 150ms;
}

.animate-duration-200 {
    animation-duration: 200ms;
}

.animate-duration-300 {
    animation-duration: 300ms;
}

.animate-duration-500 {
    animation-duration: 500ms;
}

.animate-duration-700 {
    animation-duration: 700ms;
}

.animate-duration-1000 {
    animation-duration: 1000ms;
}

/* Animation Fill Modes */
.animate-fill-none {
    animation-fill-mode: none;
}

.animate-fill-forwards {
    animation-fill-mode: forwards;
}

.animate-fill-backwards {
    animation-fill-mode: backwards;
}

.animate-fill-both {
    animation-fill-mode: both;
}

/* Animation Iteration Count */
.animate-once {
    animation-iteration-count: 1;
}

.animate-twice {
    animation-iteration-count: 2;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

/* Hover Animations */
.hover-animate-scale:hover {
    transform: scale(1.05);
    transition: transform var(--transition-fast);
}

.hover-animate-rotate:hover {
    transform: rotate(5deg);
    transition: transform var(--transition-fast);
}

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

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

.hover-animate-wiggle:hover {
    animation: wiggle 1s ease-in-out;
}

/* 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-spin,
    .animate-pulse,
    .animate-bounce,
    .animate-heartbeat,
    .animate-loading-dots,
    .animate-loading-bar {
        animation: none !important;
    }
}
