/**
 * Eleganter Preloader für Ferienwohnung Stauffenberg
 * Kann in jede bestehende Seite integriert werden
 */

/* Preloader Container */
.stauffenberg-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.stauffenberg-preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.stauffenberg-preloader.hidden {
    display: none;
}

/* Preloader Content */
.preloader-container {
    text-align: center;
    position: relative;
}

.logo-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 30px;
    animation: logoFloat 3s ease-in-out infinite;
}

.preloader-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.logo-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 30%);
    border-radius: 30px;
    animation: glow 2s ease-in-out infinite alternate;
}

.loading-ring {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 350px;
    height: 350px;
    border: 3px solid transparent;
    border-top: 3px solid #ffffff;
    border-right: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.loading-ring::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 350px;
    height: 350px;
    border: 2px solid transparent;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: spin 3s linear infinite reverse;
}

.loading-text {
    color: #ffffff;
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-top: 20px;
    opacity: 0.9;
    animation: pulse 2s ease-in-out infinite;
}

.loading-dots {
    display: inline-block;
    margin-left: 5px;
}

.loading-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: #ffffff;
    border-radius: 50%;
    margin: 0 2px;
    animation: dotPulse 1.5s ease-in-out infinite;
}

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

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

.progress-bar {
    width: 200px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 25px auto 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 2px;
    animation: progress 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.floating-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

/* Text-Fallback Logo */
.text-logo-fallback {
    font-size: 48px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4a6741 0%, #6b8a5a 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    letter-spacing: 3px;
}

/* Animations */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes glow {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
}

@keyframes progress {
    0% {
        width: 0%;
        transform: translateX(-100%);
    }
    50% {
        width: 100%;
        transform: translateX(0%);
    }
    100% {
        width: 100%;
        transform: translateX(100%);
    }
}

@keyframes float {
    0% {
        opacity: 0;
        transform: translateY(100vh) translateX(-50px);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) translateX(50px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo-container {
        width: 300px;
        height: 300px;
    }

    .loading-ring {
        width: 330px;
        height: 330px;
        top: -15px;
        left: -15px;
    }

    .loading-ring::before {
        width: 330px;
        height: 330px;
    }

    .loading-text {
        font-size: 16px;
        letter-spacing: 1px;
    }

    .progress-bar {
        width: 160px;
    }

    .text-logo-fallback {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        width: 180px;
        height: 180px;
    }

    .loading-ring {
        width: 210px;
        height: 210px;
        top: -15px;
        left: -15px;
    }

    .loading-ring::before {
        width: 210px;
        height: 210px;
    }

    .loading-text {
        font-size: 14px;
    }

    .progress-bar {
        width: 140px;
    }

    .text-logo-fallback {
        font-size: 28px;
    }
}

/* Preloader für verschiedene Themes */
.stauffenberg-preloader.theme-dark {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.stauffenberg-preloader.theme-green {
    background: linear-gradient(135deg, #4a6741 0%, #6b8a5a 100%);
}

.stauffenberg-preloader.theme-sunset {
    background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
}