/* ==========================================================================
   app-loader — единый анимированный loader для miniapp (find.daddy.by)
   Подключается на всех страницах, где раньше использовался простой текст
   "Loading..." внутри #loading-screen. Скрывается тем же скриптом:
       document.getElementById('loading-screen').style.display = 'none';
   ========================================================================== */

#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #1f2937);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: opacity 240ms ease;
    pointer-events: auto;
    touch-action: none;
}

#loading-screen.is-hiding {
    opacity: 0;
    pointer-events: none;
}

/* Тёмная тема Telegram WebApp + локальный класс .dark-theme */
@media (prefers-color-scheme: dark) {
    #loading-screen:not([data-theme="light"]) {
        background: #1a1a1a;
        color: #f0f0f0;
    }
}
.dark-theme #loading-screen,
[data-theme="dark"] #loading-screen {
    background: #1a1a1a;
    color: #f0f0f0;
}

/* ---------- Внутренний блок спиннера ---------- */
.app-loader {
    position: relative;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Вращающееся кольцо вокруг иконки */
.app-loader__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #2481cc;
    border-right-color: rgba(36, 129, 204, 0.55);
    animation: app-loader-spin 1s linear infinite;
    box-sizing: border-box;
}

/* Второе кольцо — для эффекта «спутника» */
.app-loader__ring--orbit {
    inset: 10px;
    border-width: 3px;
    border-top-color: #6c8cff;
    border-right-color: transparent;
    border-bottom-color: rgba(108, 140, 255, 0.5);
    border-left-color: transparent;
    animation: app-loader-spin 1.6s linear infinite reverse;
    opacity: 0.85;
}

/* Пульсирующий круг-подложка под иконку */
.app-loader__pulse {
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 50% 45%,
        rgba(36, 129, 204, 0.28) 0%,
        rgba(36, 129, 204, 0.08) 55%,
        rgba(36, 129, 204, 0) 100%
    );
    animation: app-loader-pulse 1.8s ease-in-out infinite;
}

/* Иконка Daddy (location pin) — стоит по центру, мягко покачивается */
.app-loader__pin {
    position: relative;
    z-index: 2;
    width: 36px;
    height: 36px;
    color: #2481cc;
    animation: app-loader-bob 1.8s ease-in-out infinite;
    filter: drop-shadow(0 2px 6px rgba(36, 129, 204, 0.35));
}
.dark-theme .app-loader__pin,
[data-theme="dark"] .app-loader__pin {
    color: #6cb6ff;
    filter: drop-shadow(0 2px 6px rgba(108, 182, 255, 0.45));
}

/* Текстовая подпись под спиннером */
.app-loader__label {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: inherit;
    opacity: 0.75;
    animation: app-loader-fade 1.6s ease-in-out infinite;
}

/* ---------- Анимации ---------- */
@keyframes app-loader-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes app-loader-pulse {
    0%, 100% { transform: scale(0.85); opacity: 0.55; }
    50%      { transform: scale(1.05); opacity: 1; }
}

@keyframes app-loader-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

@keyframes app-loader-fade {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.9; }
}

/* Уважаем prefers-reduced-motion: оставляем лёгкий спин, убираем пульсации */
@media (prefers-reduced-motion: reduce) {
    .app-loader__ring,
    .app-loader__ring--orbit { animation-duration: 2.4s; }
    .app-loader__pulse,
    .app-loader__pin,
    .app-loader__label { animation: none; }
    .app-loader__label  { opacity: 0.7; }
}
