/**
 * Single Page Application Styles
 * Loading States, Transitions und Overlays
 */

/* SPA Loading Overlay */
#spa-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

[data-bs-theme="dark"] #spa-loading {
    background: rgba(0, 0, 0, 0.9);
}

#spa-loading.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.spa-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spa-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Content Fade Transitions */
.content {
    transition: opacity 0.2s ease;
}

.content.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Navigation Progress Bar (optional) */
.spa-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #3874ff, #00d4ff);
    z-index: 10000;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(56, 116, 255, 0.5);
}

.spa-progress.active {
    animation: progressGrow 1.5s ease-in-out;
}

@keyframes progressGrow {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Link Active State während Navigation */
a.spa-navigating {
    opacity: 0.6;
    pointer-events: none;
}

/* Smooth Page Transitions */
.page-enter {
    animation: pageEnter 0.3s ease;
}

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

/* Mobile Optimierungen */
@media (max-width: 768px) {
    .spa-spinner .spinner-border {
        width: 2rem;
        height: 2rem;
    }
}

/* Skeleton Loading für sofortiges Feedback */
.spa-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: skeletonWave 1.5s ease-in-out infinite;
}

[data-bs-theme="dark"] .spa-skeleton {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    background-size: 200% 100%;
}

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

/* Link Hover Feedback - schnellere Response */
a:not(.btn) {
    transition: opacity 0.1s ease;
}

a:not(.btn):active {
    transform: scale(0.98);
    transition: transform 0.05s ease;
}

/* Navigation Bar während SPA Navigation */
.navbar.spa-loading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3874ff, transparent);
    animation: navbarLoading 1.5s ease-in-out infinite;
}

@keyframes navbarLoading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Toast Notifications für SPA Events */
.spa-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: toastSlideIn 0.3s ease;
}

[data-bs-theme="dark"] .spa-toast {
    background: #2a2a2a;
    color: #fff;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Cache Indicator (Debug Mode) */
.spa-cache-indicator {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(56, 116, 255, 0.9);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spa-cache-indicator.show {
    opacity: 1;
}

/* Prefetch Hint Indicator */
a[data-prefetch="true"]::before {
    content: '⚡';
    font-size: 0.7rem;
    margin-right: 0.25rem;
    opacity: 0.5;
}
