/* ─── iOS 26 Liquid Glass / iOS 15+ chrome color anchors ─── */
/* Safari сэмплирует фон этих элементов для окраски адресной строки (сверху)
   и панели вкладок / индикатора Home (снизу).
   Высота = 15px gap над/под нашими баром/меню + safe-area-inset. */
.ios-chrome-anchor {
    display: none; /* только для веб-браузера, не мини-апп */
    position: fixed;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 9999;
    transition: none;
}

body.has-web-top-bar .ios-chrome-anchor {
    display: block;
}

body.web-desktop .ios-chrome-anchor {
    display: none;
}

.ios-chrome-anchor--top {
    top: 0;
    height: 12px;
    z-index: 99999;
    background-color: #1f3153;
}

.main-container {
    padding: 0px 15px 0px 15px;
    /* height: calc(100vh - var(--tg-safe-area-inset-top) ); */
    height: 100%;
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
    padding-bottom: 15px;
    padding-top: 15px;
    /* position: absolute; */
    
    /* left: 0;
    right: 0; */
    /* bottom: 0px; */
    /* padding-top: calc(var(--tg-safe-area-inset-top) + var(--tg-content-safe-area-inset-top)); */
    /* padding-bottom: calc(var(--tg-safe-area-inset-bottom)); */
    /* padding-bottom: 15px; */
}

/* Прозрачный контейнер при градиентном фоне body */
.main-container.projects-transparent {
    background-color: #ffffff00;
}

/* Режим "Главная": нижняя компенсация под меню не нужна */
.main-container.projects-no-bottom-padding {
    padding-bottom: 0;
    padding-top: 0;
}

/* В режиме mainpage не используем platform-specific calc высоты */
.main-container.projects-transparent.projects-no-top-padding {
    height: 100% !important;
}

.content-area {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    overflow-anchor: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    position: relative;
    border-radius: 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Скрываем скролл-бар для Chrome, Safari и Opera */
.content-area::-webkit-scrollbar {
    display: none;
}

.page {
    display: none !important;
    width: 100%;
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 20px 20px 25px 25px;
    padding-bottom: 0px;
    transition: opacity 0.15s ease-in-out;
    opacity: 1;
}

.page.active {
    display: block !important;
    opacity: 1;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: 20px 20px 25px 25px;
}

.page.active::-webkit-scrollbar {
    display: none;
}



/* .page-container.fade-out {
    opacity: 0;
}

.page-container.fade-in {
    opacity: 1;
} */

/* Плавные переходы между страницами (новая система) */
:root {
    --page-transition-duration: 0.2s;
    --page-transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

.content-area {
    transition: opacity var(--page-transition-duration) var(--page-transition-easing);
}

.content-area.page-transition-out {
    opacity: 0;
} 

.bottom-padding-container{
    padding-bottom: 75px;
}

.mainpage-profile-fab {
    position: fixed;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    width: auto;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity var(--page-transition-duration, 0.2s) var(--page-transition-easing, ease);
}

.mainpage-profile-fab.is-hidden {
    display: none;
}

.mainpage-profile-fab.is-fading {
    opacity: 0;
}

body.tg-mobile-platform .mainpage-profile-fab {
    position: fixed;
    margin-top: 6px;
    margin-bottom: 0px;
    height: var(--tg-content-safe-area-inset-top, 0px);
    top: var(--tg-safe-area-inset-top, 0px);
    left: calc(50% + var(--mainpage-profile-shift, 0px));
    transform: translateX(-50%);
    transition: left 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity var(--page-transition-duration, 0.2s) var(--page-transition-easing, ease);
    margin: 0;
    width: auto;
    will-change: left;
}

body.tg-mobile-platform .mainpage-profile-fab.is-offset-active {
    --mainpage-profile-shift: calc(0.387 * max(0px, 406px - 100vw));
}

.mainpage-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 4px;
    padding-right: 10px;
    border-radius: 999px;
    background-color: rgb(137 137 137 / 5%);
    /* border: 1px solid rgba(255, 255, 255, 0.12); */
    /* backdrop-filter: blur(6px); */
    /* -webkit-backdrop-filter: blur(6px); */
    backdrop-filter: brightness(1.5);
    transition: gap 0.22s ease, padding-right 0.22s ease, background-color 0.26s ease;
}
.mainpage-profile-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

body.tg-desktop-platform .mainpage-profile-fab.is-scrolled .mainpage-profile-btn {
    background: rgb(0 0 0 / 79%);
}

.mainpage-profile-avatar {
    width: 22px;
    height: 22px;
    border-radius: 100%;
    transition: width 0.25s ease, height 0.25s ease;
}

body.tg-mobile-platform .mainpage-profile-fab.is-label-hidden .mainpage-profile-avatar {
    width: 18px;
    height: 18px;
}

.mainpage-profile-letter {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.mainpage-profile-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    max-width: 60px;
    transform: translateX(0);
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.mainpage-profile-fab.is-label-hidden .mainpage-profile-btn {
    gap: 0;
    padding: 5.5px 6px;
    background-color: rgb(137 137 137 / 0%);
    transition: gap 0.3s cubic-bezier(0.32, 0.72, 0, 1), padding 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.mainpage-profile-fab.is-label-hidden .mainpage-profile-label {
    transform: none;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
}

/* ─── Account Switch Toggle (капелька) ─── */
.web-top-bar__center {
    position: relative;
}
.acc-switch-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 39px;
    height: 30px;
    padding: 0;
    margin-left: 5px;
    border: none;
    background-color: rgb(137 137 137 / 5%);
    backdrop-filter: brightness(1.5);
    color: rgba(255,255,255,0.6);
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s, color .2s;
    flex-shrink: 0;
    font-size: 12px;
}
body.has-web-top-bar .acc-switch-toggle { width:32px; }
.acc-switch-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.acc-switch-toggle svg {
    transform: rotate(90deg);
    transition: transform .25s ease;
}
.acc-switch-toggle.is-open svg {
    transform: rotate(-90deg);
}
.acc-switch-toggle--fab {
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: 4px;
    background-color: rgb(137 137 137 / 5%);
    backdrop-filter: brightness(1.5);
    overflow: hidden;
    transition: width .3s cubic-bezier(0.32, 0.72, 0, 1),
                height .3s cubic-bezier(0.32, 0.72, 0, 1),
                margin-left .3s cubic-bezier(0.32, 0.72, 0, 1),
                opacity .3s cubic-bezier(0.32, 0.72, 0, 1);
}
.mainpage-profile-fab.is-label-hidden .acc-switch-toggle--fab {
    width: 0;
    height: 0;
    margin-left: 0;
    opacity: 0;
    pointer-events: none;
}
.mainpage-profile-fab .acc-switch-dropdown {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
}
.acc-switch-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    min-width: 200px;
    max-width: 300px;
    background: #1e2130;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 6px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    -webkit-transition: opacity .2s cubic-bezier(0.25, 0.46, 0.45, 0.94), -webkit-transform .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition: opacity .2s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
    -webkit-backface-visibility: hidden;
}
.acc-switch-dropdown.is-open {
    opacity: 1;
    -webkit-transform: translateX(-50%) scale(1);
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}
.acc-switch-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    color: #e1e4ea;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.acc-switch-dropdown__item:hover {
    background: rgba(255,255,255,0.06);
}
.acc-switch-dropdown__item.is-current {
    color: #5ba3e6;
    cursor: default;
}
.acc-switch-dropdown__item.is-current::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5ba3e6;
    flex-shrink: 0;
    margin-left: auto;
}
.acc-switch-dropdown__add {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    color: #e1e4ea;
    font-size: 13px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 2px;
    border-radius: 0 0 10px 10px;
    transition: color .15s;
}
.acc-switch-dropdown__add:hover {
    color: #5ba3e6;
}
.acc-switch-dropdown__ava {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    object-fit: cover;
}
img.acc-switch-dropdown__ava {
    display: block;
}
span.acc-switch-dropdown__ava {
    display: flex;
}
.acc-switch-dropdown__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ─── Веб-топ-панель (браузер без Telegram) ─── */
.web-top-bar {
    position: fixed;
    top: 15px;
    left: 15px;
    right: 15px;
    height: 46px;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-bottom: none;
    visibility: hidden;
    pointer-events: none;
}

body.has-web-top-bar .web-top-bar {
    visibility: visible;
    pointer-events: auto;
}

/* Внутренний контейнер — ширина как у .page */
.web-top-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    padding: 0;
}

/* Плавное появление «Назад» → «Профиль» → «Выйти» */
.web-top-bar__inner > .web-top-bar__zone {
    opacity: 0;
    transform: translateY(-7px);
    transition:
        opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0s;
}

body.has-web-top-bar .web-top-bar__inner > .web-top-bar__zone {
    opacity: 1;
    transform: translateY(0);
}

body.has-web-top-bar .web-top-bar__inner > .web-top-bar__zone:nth-child(1) {
    transition-delay: 0.04s;
}

body.has-web-top-bar .web-top-bar__inner > .web-top-bar__zone:nth-child(2) {
    transition-delay: 0.11s;
}

body.has-web-top-bar .web-top-bar__inner > .web-top-bar__zone:nth-child(3) {
    transition-delay: 0.18s;
}

@media (prefers-reduced-motion: reduce) {
    .web-top-bar__inner > .web-top-bar__zone {
        transition-duration: 0.01ms;
        transition-delay: 0s !important;
    }
}

/* Основной контент опускается ниже топ-панели (15px top + 46px height + 8px gap) */
body.has-web-top-bar .main-container {
    padding-top: calc(15px + 46px + 8px);
    padding-bottom: 10px;
}

/* Отступ снизу для контента на мобильном вебе */
body.has-web-top-bar:not(.web-desktop) .content-area {
    padding-bottom: 15px;
}

/* На iOS mobile web нижний отступ не нужен */
body.has-web-top-bar.ios-mobile-web:not(.web-desktop) .content-area {
    padding-bottom: 0;
}

/* Убираем базовый нижний 15px у контейнера на iOS mobile web */
body.has-web-top-bar.ios-mobile-web:not(.web-desktop) .main-container {
    padding-bottom: 0;
}

.web-top-bar__zone {
    display: flex;
    align-items: center;
}

.web-top-bar__left   { flex: 1; justify-content: flex-start; }
.web-top-bar__center { flex: 0 0 auto; }
.web-top-bar__right  { flex: 1; justify-content: flex-end; }

/* Кнопки в топ-панели */
.web-top-bar__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: auto;
    padding: 4px 10px;
    border-radius: 999px;
    background-color: rgb(137 137 137 / 5%);
    border: none;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: brightness(1.5);
    -webkit-backdrop-filter: brightness(1.5);
    transition:
        background-color 0.22s ease,
        opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        color 0.22s ease,
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        padding 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    white-space: nowrap;
}
.web-top-bar__btn i {
    font-size: 14px;
}
.web-top-bar__btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.web-top-bar__btn.is-inactive {
    opacity: 0;
    pointer-events: none;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0 !important;
    margin: 0;
    overflow: hidden;
    flex: 0 0 0px;
    gap: 0;
    border: 0;
}

.web-top-bar__btn--back {
    opacity: 0.88;
    padding-right: 12px;
}

.web-top-bar__btn--logout {
    padding-left: 12px;
}

/* Сайдбар начинается ниже топ-панели (top задан в bottom-menu.css) */

/* Скрываем Telegram FAB профиля в веб-режиме */
/* Скрываем Telegram FAB только в веб-режиме (не в мини-апе) */
body.has-web-top-bar #mainpage-profile-fab {
    display: none !important;
}

/* ─── TG Mini App bind-email bubble ─── */
.tg-bind-email-bubble {
    position: fixed;
    top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    background: #1e2130;
    border: 1px solid rgba(50,130,215,0.25);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease, transform .3s ease;
    pointer-events: none;
}
.tg-bind-email-bubble.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
.tg-bind-email-bubble svg {
    flex-shrink: 0;
    color: #5ba3e6;
}
.tg-bind-email-bubble span {
    font-size: 13px;
    color: #a8c4e0;
}
.tg-bind-email-bubble__close {
    border: none;
    background: none;
    color: rgba(255,255,255,0.25);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 2px;
}
.tg-bind-email-bubble__close:active {
    color: rgba(255,255,255,0.6);
}

/* ─── Web bind-email bubble (облачко под профилем) ─── */
.web-bind-email-bubble {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    background: #1e2130;
    border: 1px solid rgba(50,130,215,0.25);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    cursor: pointer;
    white-space: nowrap;
    z-index: 100;
    animation: bubblePop .3s ease-out;
}
.web-bind-email-bubble__arrow {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #1e2130;
    border-left: 1px solid rgba(50,130,215,0.25);
    border-top: 1px solid rgba(50,130,215,0.25);
}
.web-bind-email-bubble svg {
    flex-shrink: 0;
    color: #5ba3e6;
}
.web-bind-email-bubble span {
    font-size: 13px;
    color: #a8c4e0;
}
.web-bind-email-bubble:hover {
    background: #232740;
    border-color: rgba(50,130,215,0.4);
}
.web-bind-email-bubble__close {
    border: none;
    background: none;
    color: rgba(255,255,255,0.25);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 2px;
}
.web-bind-email-bubble__close:hover {
    color: rgba(255,255,255,0.6);
}
@keyframes bubblePop {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

