/* Animation Styles - Subtle and Smooth */

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* Slide In From Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Shimmer Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

/* Staggered Animation Delays for Stat Cards */
.stat-card {
    animation: fadeInUp 0.5s ease backwards;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

/* Staggered Animation for Channel Cards */
.channel-card {
    animation: fadeInUp 0.4s ease backwards;
}
.channel-card:nth-child(1) { animation-delay: 0.05s; }
.channel-card:nth-child(2) { animation-delay: 0.08s; }
.channel-card:nth-child(3) { animation-delay: 0.11s; }
.channel-card:nth-child(4) { animation-delay: 0.14s; }
.channel-card:nth-child(5) { animation-delay: 0.17s; }
.channel-card:nth-child(n+6) { animation-delay: 0.2s; }

/* Skeleton Loader */
.skeleton-loader {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 20%,
        var(--bg-secondary) 40%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

[data-theme="dark"] .skeleton-loader {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-secondary) 20%,
        var(--bg-tertiary) 40%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
}

/* Skeleton Text */
.skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: var(--spacing-sm);
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.long {
    width: 90%;
}

/* Skeleton Row for Tables */
.skeleton-row td {
    padding: var(--spacing-md) var(--spacing-lg);
}

.skeleton-row td div {
    height: 16px;
    border-radius: var(--radius-sm);
}

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.page-loader p {
    color: var(--text-secondary);
    font-size: var(--font-size-md);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Content Fade In on Page Load */
.page-content {
    animation: fadeIn 0.3s ease;
}

/* Card Hover Animation */
.card {
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal);
}

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

/* Button Press Animation */
.btn:active {
    transform: scale(0.97);
}

/* Modal Animation */
.modal-overlay {
    transition: opacity var(--transition-normal),
                visibility var(--transition-normal);
}

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

/* Toast Animation */
.toast {
    animation: slideInRight 0.3s ease, fadeIn 0.3s ease;
}

/* Message Preview Hover */
.message-preview {
    transition: background-color var(--transition-fast);
}

/* Link Card Animation */
.card-link {
    cursor: pointer;
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal);
}

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

/* Process Step Animation */
.process-step {
    animation: fadeInUp 0.5s ease backwards;
}

.process-step:nth-child(1) { animation-delay: 0.05s; }
.process-step:nth-child(2) { animation-delay: 0.1s; }
.process-step:nth-child(3) { animation-delay: 0.15s; }
.process-step:nth-child(4) { animation-delay: 0.2s; }

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
