/* ================================================
   LOADING STATES
   Spinner und Loader für verschiedene Komponenten
   ================================================ */

/* Language Loader */
.lang-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.lang-loader.active {
    opacity: 1;
    visibility: visible;
}

.lang-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Generic Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 54, 93, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

.page-loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.page-loader-text {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Spin Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Inline Spinner (für Buttons etc.) */
.spinner-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Button mit Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(
            90deg,
            #2a2a2a 0%,
            #3a3a3a 50%,
            #2a2a2a 100%
        );
        background-size: 200% 100%;
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .lang-loader-spinner,
    .page-loader-spinner,
    .spinner-inline,
    .btn-loading::after {
        animation: none;
    }

    .skeleton {
        animation: none;
        background: #f0f0f0;
    }
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #f97316;
    z-index: 10001;
    transition: width 0.3s ease;
}

.progress-bar.indeterminate {
    animation: progress-indeterminate 1.5s ease-in-out infinite;
    width: 30% !important;
}

@keyframes progress-indeterminate {
    0% {
        left: 0;
        width: 0;
    }
    50% {
        left: 25%;
        width: 50%;
    }
    100% {
        left: 100%;
        width: 0;
    }
}
