/* Skeleton Loading Animations */

/* Base skeleton styles */
.skeleton {
    animation: skeleton-loading 1.5s linear infinite alternate;
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    border-radius: 0.5rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Skeleton variants */
.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.skeleton-text-lg {
    height: 1.5rem;
    margin-bottom: 0.75rem;
}

.skeleton-title {
    height: 2rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-button {
    height: 3rem;
    width: 10rem;
    border-radius: 0.75rem;
}

.skeleton-card {
    height: 12rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.skeleton-circle {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.skeleton-image {
    width: 100%;
    height: 12rem;
    border-radius: 0.5rem;
}

/* Loading states for components */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Pulse animation for loading cards */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Shimmer effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.loading-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background-color: #3b82f6;
    border-radius: 50%;
    animation: dot-pulse 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dot-pulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Quiz loading state */
.quiz-loading {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.quiz-loading .skeleton-question {
    height: 2rem;
    width: 70%;
    margin-bottom: 1rem;
}

.quiz-loading .skeleton-options {
    display: grid;
    gap: 0.75rem;
}

.quiz-loading .skeleton-option {
    height: 4rem;
    border-radius: 0.5rem;
}

/* Content placeholder */
.content-placeholder {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 0.75rem;
}

.content-placeholder .line {
    height: 1rem;
    background: #f3f4f6;
    border-radius: 0.25rem;
    animation: skeleton-loading 1.5s linear infinite alternate;
}

.content-placeholder .line:nth-child(1) {
    width: 90%;
}

.content-placeholder .line:nth-child(2) {
    width: 75%;
}

.content-placeholder .line:nth-child(3) {
    width: 80%;
}

/* Smooth transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.fade-out {
    animation: fadeOut 0.3s ease-out;
}

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

/* Progress bar loading */
.progress-loading {
    position: relative;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background-color: #3b82f6;
    border-radius: 9999px;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        left: -40%;
    }
    100% {
        left: 100%;
    }
}

/* Results loading animation */
.results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 2rem;
}

.results-loading .analyzing {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.results-loading .progress-circle {
    width: 5rem;
    height: 5rem;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spinner 1s linear infinite;
}

/* Staggered animation for list items */
.stagger-animation > * {
    opacity: 0;
    animation: staggerFadeIn 0.5s ease-out forwards;
}

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

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