/**
 * Lazy Loader Styles for QLVT Pro V8
 * Loading and error states for lazy-loaded components
 */

/* Loading State */
.lazy-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    min-height: 400px;
}

.loading-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.loading-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text, #1f2937);
    margin-bottom: 24px;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border, #e5e7eb);
    border-top-color: var(--primary, #0f766e);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading Progress Bar */
.loading-progress {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: var(--surface-secondary, #f3f4f6);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg,
        var(--primary, #0f766e),
        var(--success, #10b981)
    );
    border-radius: 2px;
    width: 0%;
    transition: width 2s ease-out;
}

/* Error State */
.lazy-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    min-height: 400px;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.error-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--danger, #ef4444);
    margin-bottom: 12px;
}

.error-message {
    font-size: 0.95rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 24px;
    max-width: 500px;
}

/* Skeleton Loading (Alternative) */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-secondary, #f3f4f6) 25%,
        var(--surface-hover, #e5e7eb) 50%,
        var(--surface-secondary, #f3f4f6) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.large {
    height: 24px;
}

.skeleton-text.small {
    height: 12px;
}

.skeleton-card {
    height: 200px;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

/* Fade In Animation for Loaded Content */
.lazy-loaded {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shimmer Effect (Premium Loading) */
.shimmer {
    position: relative;
    overflow: hidden;
    background: var(--surface-secondary, #f3f4f6);
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .lazy-loading-state,
    .lazy-error-state {
        padding: 60px 16px;
        min-height: 300px;
    }

    .loading-icon,
    .error-icon {
        font-size: 3rem;
    }

    .loading-title,
    .error-title {
        font-size: 1.1rem;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }

    .loading-progress {
        max-width: 200px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .lazy-loading-state,
    .lazy-error-state {
        color: #f3f4f6;
    }

    .loading-title {
        color: #f9fafb;
    }

    .loading-spinner {
        border-color: #374151;
        border-top-color: #14b8a6;
    }

    .loading-progress {
        background: #374151;
    }

    .skeleton {
        background: linear-gradient(
            90deg,
            #1f2937 25%,
            #374151 50%,
            #1f2937 75%
        );
    }

    .shimmer {
        background: #1f2937;
    }
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary, #0f766e);
    animation: dotPulse 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse Animation (Alternative Loading) */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
