/* ============================================
   LOADING STATES
   ============================================ */

/* Spinner */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(37, 99, 235, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner--small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner--large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200) 0%,
        var(--color-gray-100) 50%,
        var(--color-gray-200) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
}

.skeleton-text--title {
    height: 1.5em;
    width: 60%;
}

.skeleton-text--paragraph {
    height: 1em;
    width: 100%;
}

.skeleton-text--paragraph:last-child {
    width: 80%;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
}

.skeleton-card {
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    background: var(--color-white);
    box-shadow: var(--shadow-soft);
}

.skeleton-button {
    height: 44px;
    width: 150px;
    border-radius: var(--radius-md);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay__content {
    text-align: center;
}

.loading-overlay__spinner {
    margin-bottom: var(--spacing-md);
}

.loading-overlay__text {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

/* Button Loading State */
.cta-button.is-loading,
button.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.cta-button.is-loading::after,
button.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.cta-button.cta-outline.is-loading::after {
    border-color: rgba(37, 99, 235, 0.3);
    border-top-color: var(--color-primary);
}

/* Image Loading State */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

img[loading="lazy"]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-gray-200);
    border-radius: inherit;
}

/* Content Loading State */
.content-loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-loading__spinner {
    margin: 0 auto;
}

