/* Стили для улучшенного лоадера */
.aa-loader {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
            135deg,
            rgba(248, 249, 250, 0.85) 0%,
            rgba(233, 236, 239, 0.85) 100%
    );
    backdrop-filter: blur(3px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.65, 0, 0.35, 1);
    contain: layout paint; /* изоляция перерисовок */
}

.aa-loader.show {
    opacity: 1;
    pointer-events: auto;
}

.aa-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Основной спиннер */
.aa-spinner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #6c5ce7;
    border-bottom-color: #00cec9;
    animation: aa-rot 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.2);
    backface-visibility: hidden;
    will-change: transform;
}

/* Внешнее кольцо */
.spinner-outer {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-left-color: #fd79a8;
    border-right-color: #fdcb6e;
    animation: aa-rot-reverse 2s linear infinite;
    backface-visibility: hidden;
    will-change: transform;
}

/* Внутреннее кольцо */
.spinner-inner {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-left-color: #00b894;
    border-right-color: #0984e3;
    animation: aa-rot 1.2s linear infinite;
    backface-visibility: hidden;
    will-change: transform;
}

/* Центральная точка */
.spinner-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(45deg, #6c5ce7, #00cec9);
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
}

/* Текст загрузки */
.loader-text {
    margin-top: 30px;
    font-weight: 500;
    color: #2d3436;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.loader-text::after {
    content: "";
    display: inline-block;
    width: 0;
    animation: dots 1.5s steps(4, end) infinite;
}

/* Прогресс бар */
.progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(45, 52, 54, 0.2);
    border-radius: 4px;
    margin-top: 20px;
    overflow: hidden;
}

.progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #6c5ce7, #00cec9);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Эффект частиц */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    will-change: transform, opacity;
}

/* Блокировка прокрутки */
html.aa-noscroll, body.aa-noscroll {
    overflow: hidden;
    height: 100%;
}

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

@keyframes aa-rot-reverse {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

@keyframes dots {
    0% {
        content: "";
    }
    25% {
        content: ".";
    }
    50% {
        content: "..";
    }
    75% {
        content: "...";
    }
    100% {
        content: "";
    }
}

/* Accessibility: убираем анимации если стоит reduce motion */
@media (prefers-reduced-motion: reduce) {
    .aa-spinner, .spinner-outer, .spinner-inner {
        animation: none !important;
    }

    .particles {
        display: none !important;
    }

    .loader-text::after {
        animation: none !important;
    }
}