/* ============================================
   LOADER - Страница загрузки
   ============================================ */

/* Скрываем основной контент до загрузки */
body:not(.loaded) .header,
body:not(.loaded) .main,
body:not(.loaded) .admin-footer {
    opacity: 0;
    visibility: hidden;
}

body.loaded .header,
body.loaded .main,
body.loaded .admin-footer {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Логотип в шапке изначально скрыт, появится синхронно с завершением анимации */
body:not(.loaded) .header .logo {
    opacity: 0;
}

body.loaded .header .logo {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    visibility: visible;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Анимация перемещения логотипа к шапке */
.loader-logo-text.moving-to-header {
    animation: move-logo-to-header 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 10001;
    position: fixed;
}

@keyframes move-logo-to-header {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--logo-move-x), var(--logo-move-y)) scale(var(--logo-scale));
        opacity: 0;
    }
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

/* Логотип в лоадере */
.loader-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.loader-logo-text {
    font-family: "Cormorant Garamond", serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
    text-align: center;
    position: relative;
    overflow: visible;
    font-optical-sizing: auto;
    color: transparent;
    /* Убираем возможные тени и артефакты */
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Единый градиент через псевдоэлемент, покрывающий весь текст */
.loader-logo-text::before {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    /* Диагональный градиент с золотистыми оттенками */
    background: linear-gradient(
        120deg,
        var(--text-primary) 0%,
        var(--text-primary) 30%,
        rgba(230, 200, 140, 0.5) 40%,
        rgba(255, 217, 102, 0.8) 45%,
        rgba(255, 235, 180, 1) 48%,
        rgba(255, 235, 180, 1) 52%,
        rgba(255, 217, 102, 0.8) 55%,
        rgba(230, 200, 140, 0.5) 60%,
        var(--text-primary) 70%,
        var(--text-primary) 100%
    );
    background-size: 250% 250%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    /* Диагональная анимация */
    animation: loader-skeleton-shimmer-diagonal 2s linear infinite;
    
    pointer-events: none;
    z-index: 1;
    /* Дублируем текст через content */
    content: 'BEAUTYMAP';
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: inherit;
}

.loader-map-container {
    position: relative;
    display: inline-block;
}

.loader-a-with-icon {
    position: relative;
    display: inline-block;
    vertical-align: baseline;
}

/* Иконка логотипа над буквой A */
.loader-map-container .loader-a-with-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    background-image: url("/static/images/pre-logo.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    z-index: 1000;
    display: block;
    visibility: visible;
    opacity: 1;
    /* Иконка не должна наследовать прозрачность текста */
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: initial;
    filter: brightness(1);
}

@keyframes loader-skeleton-shimmer-diagonal {
    0% {
        background-position: -150% -150%;
    }
    100% {
        background-position: 150% 150%;
    }
}

/* ============================================
   SUBSCRIPTION CHECK IN LOADER
   ============================================ */

.loader-logo,
.loader-subscription {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.loader-logo.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.loader-subscription {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
    max-width: 320px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subscription-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 217, 102, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.subscription-icon .material-symbols-outlined {
    font-size: 32px;
    color: var(--accent);
}

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

.subscription-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.subscription-description {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.subscription-channel {
    margin-top: 8px;
    animation: fadeIn 0.3s ease 0.2s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.subscription-channel-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 16px;
    background: rgba(255, 217, 102, 0.1);
    border: 1px solid rgba(255, 217, 102, 0.2);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.subscription-channel-link:hover {
    background: rgba(255, 217, 102, 0.15);
    border-color: rgba(255, 217, 102, 0.3);
    transform: translateY(-2px);
}

.subscription-channel-link .material-symbols-outlined {
    font-size: 18px;
}

.subscription-check-btn {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    margin-top: 8px;
    animation: fadeIn 0.3s ease 0.3s both;
}

.subscription-check-btn:hover {
    background: #FFE699;
    transform: translateY(-2px);
}

.subscription-check-btn:active {
    transform: translateY(0);
}

.subscription-check-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.subscription-status {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    display: none;
    animation: fadeIn 0.3s ease;
}

.subscription-status.show {
    display: block;
}

.subscription-status.success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81C784;
}

.subscription-status.error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #EF5350;
}

.subscription-status.checking {
    background: rgba(255, 217, 102, 0.1);
    border: 1px solid rgba(255, 217, 102, 0.2);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.subscription-status .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 217, 102, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Адаптивность */
@media (max-width: 480px) {
    .loader-logo-text {
        font-size: 1.6rem;
    }
    
    .loader-logo-icon {
        width: 40px;
        height: 40px;
    }
    
    .subscription-icon {
        width: 56px;
        height: 56px;
    }
    
    .subscription-icon .material-symbols-outlined {
        font-size: 28px;
    }
    
    .subscription-title {
        font-size: 1.1rem;
    }
    
    .subscription-description {
        font-size: 0.85rem;
    }
}

