/* ============================================
   ПРЕЛОАДЕР - СОВРЕМЕННЫЙ ДИЗАЙН 2025
   ============================================ */

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Шапка должна быть видна поверх прелоадера */
.main-header {
    position: relative;
    z-index: 10000 !important;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    color: white;
}

.preloader-logo {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 30px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 2px;
    animation: preloaderFadeIn 0.8s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.logo-letter {
    display: inline-block;
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 1) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoGradientShift 3s ease infinite, letterGlow 2s ease-in-out infinite;
    position: relative;
    color: white;
}

.logo-letter-large {
    font-size: 1.3em;
    vertical-align: baseline;
}

.logo-letter:nth-child(1) { animation-delay: 0s; }
.logo-letter:nth-child(2) { animation-delay: 0.1s; }
.logo-letter:nth-child(3) { animation-delay: 0.2s; }
.logo-letter:nth-child(4) { animation-delay: 0.3s; }
.logo-letter:nth-child(5) { animation-delay: 0.4s; }
.logo-letter:nth-child(6) { animation-delay: 0.5s; }
.logo-letter:nth-child(7) { animation-delay: 0.6s; }
.logo-letter:nth-child(8) { animation-delay: 0.7s; }
.logo-letter:nth-child(9) { animation-delay: 0.8s; }
.logo-letter:nth-child(10) { animation-delay: 0.9s; }
.logo-letter:nth-child(11) { animation-delay: 1s; }
.logo-letter:nth-child(13) { animation-delay: 1.1s; }
.logo-letter:nth-child(14) { animation-delay: 1.2s; }
.logo-letter:nth-child(15) { animation-delay: 1.3s; }

.logo-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    margin: 0 4px;
    animation: dotPulse 2s ease-in-out infinite, dotGlow 3s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.5);
    position: relative;
    vertical-align: middle;
    text-indent: -9999px;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
}

.logo-pro {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    margin-left: 4px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    animation: proBadgeGlow 3s ease-in-out infinite;
}

.logo-pro::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: proShine 3s ease-in-out infinite;
}

.logo-pro .logo-letter {
    position: relative;
    z-index: 1;
    -webkit-text-fill-color: white;
    color: white;
}

@keyframes logoGradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes letterGlow {
    0%, 100% {
        transform: translateY(0);
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    }
    50% {
        transform: translateY(-3px);
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
    }
}

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

@keyframes dotGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 255, 255, 1), 0 0 40px rgba(255, 255, 255, 0.7), 0 0 50px rgba(255, 255, 255, 0.4);
    }
}

@keyframes proBadgeGlow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(255, 255, 255, 0);
        border-color: rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.4), 0 0 30px rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.8);
    }
}

@keyframes proShine {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}

.preloader-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.preloader-spinner::before,
.preloader-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: preloaderSpin 1s linear infinite;
}

.preloader-spinner::before {
    width: 80px;
    height: 80px;
    border-width: 4px;
    animation-duration: 1s;
}

.preloader-spinner::after {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-width: 3px;
    border-top-color: rgba(255, 255, 255, 0.6);
    animation-duration: 0.8s;
    animation-direction: reverse;
}

.preloader-text {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.9;
    letter-spacing: 1px;
    color: white;
    animation: preloaderPulse 2s ease-in-out infinite;
}

.preloader-dots {
    display: inline-flex;
    gap: 8px;
    margin-top: 15px;
}

.preloader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    animation: preloaderDotBounce 1.4s ease-in-out infinite;
}

.preloader-dot:nth-child(1) {
    animation-delay: 0s;
}

.preloader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.preloader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Альтернативный стиль - круги */
.preloader-circles {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.preloader-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    animation: preloaderCircleScale 1.4s ease-in-out infinite;
}

.preloader-circle:nth-child(1) {
    animation-delay: 0s;
}

.preloader-circle:nth-child(2) {
    animation-delay: 0.2s;
}

.preloader-circle:nth-child(3) {
    animation-delay: 0.4s;
}

/* Анимации */
@keyframes preloaderSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes preloaderFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes preloaderPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

@keyframes preloaderDotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes preloaderCircleScale {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Темная тема для прелоадера */
[data-theme="dark"] .preloader {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
}

/* Адаптивность */
@media (max-width: 768px) {
    .preloader-logo {
        font-size: 3rem;
        gap: 2px;
        letter-spacing: 1px;
    }
    
    .logo-dot {
        width: 8px;
        height: 8px;
    }
    
    .preloader-spinner {
        width: 60px;
        height: 60px;
    }
    
    .preloader-spinner::before {
        width: 60px;
        height: 60px;
    }
    
    .preloader-spinner::after {
        width: 45px;
        height: 45px;
        top: 7.5px;
        left: 7.5px;
    }
    
    .preloader-text {
        font-size: 0.875rem;
    }
}
