/* =========================================
   1. БАЗА, ОВЕРЛЕЙ И БЛОКИРОВКА СКОРОЛЛА
   ========================================= */
body.locked {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
body.openSidebar {
    overflow: hidden;
}

#sidebarOverlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    height: 120vh;
    z-index: 1234;
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s linear, visibility 0.25s linear;
}
body.openSidebar #sidebarOverlay {
    opacity: 1;
    visibility: visible;
    cursor: pointer;
}

/* =========================================
   2. ОСНОВНОЙ КАРКАС САЙДБАРА
   ========================================= */
#sidebar_wrap {
    width: 272px;
    height: 100%;
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}
body.openSidebar .sidebar-wrap { 
    transform: none; 
}
.sidebar-inner { 
    display: flex; 
    flex-direction: column; 
}
.sidebar-header { 
    display: flex; 
    align-items: center; 
    padding: 18px 18px 12px 18px; 
}
.sidebar-avatar { 
    width: 42px; height: 42px; 
    border-radius: 100%; 
    background: #f2f3f7; 
    margin-right: 12px; 
    overflow: hidden; 
}
.sidebar-avatar img { 
    width: 100%; height: 100%; object-fit: cover; 
}
.sidebar-username { font-weight: 600; font-size: 17px; }
.sidebar-userstatus { font-size: 14px; color: #878; }

/* Объединенная кнопка закрытия */
.sidebar-close {
    background: transparent;
    border: none;
    color: #bbb;
    font-size: 32px;
    margin-left: auto;
    cursor: pointer;
    padding: 0 6px;
    transition: background 0.14s, color 0.14s;
    width: 50px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.sidebar-close:hover, .sidebar-close:active {
    background: rgba(131,102,86,0.12);
    color: #000;
}
.sidebar-close:active {
    box-shadow: 0 4px 10px rgba(0,0,0,.08) inset;
}

/* =========================================
   3. ЛОГОТИП И АНИМАЦИИ
   ========================================= */
.sidebar-logo {
    position: relative;
    overflow: hidden;
    height: 46px;
    box-shadow: 2px 0 3px rgba(0,0,0,.1);
}
.sidebar-logo-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
    background: transparent;
}
.sidebar-logo a {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    width: 100%;
    padding: 0;
    transition: transform 0.3s ease;
    will-change: transform, box-shadow;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-logo a:hover { background: rgba(131,102,86,0.12); }
.sidebar-logo a:active { 
    background: rgba(131,102,86,0.12); 
    box-shadow: 0 4px 10px rgba(0,0,0,.08) inset; 
}
.sidebar-logo img {
    width: 32px; height: 32px;
    background: #435f8b;
    border-radius: 50%;
    border: 2px solid #fff;
}
.sidebar-logo span {
    margin-left: 8px;
    font-size: 20px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    color: #fff;
}
.sidebar-logo-link {
    position: relative; display: inline-flex;
    align-items: center; text-decoration: none;
}

/* Перелив логотипа */
.redesign_2o25 { 
    display: inline-flex; position: relative; 
    align-items: center; margin-left: 6px; z-index: 2; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 900; font-size: 20px;
    letter-spacing: -0.8px; text-transform: lowercase;
    background: linear-gradient(to right, #435f8b, #64b3c4, #435e8a);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    animation: flowShine 4s ease-in-out infinite;
}
@keyframes flowShine {
    0% { background-position: 0% center; }
    50% { background-position: 100% center; }
    100% { background-position: 0% center; }
}

/* Сердечки */
.logo-love-wrapper { position: relative; display: inline-flex; align-items: center; }
.valentine-float { animation: floatAnim 3s infinite ease-in-out; }
.mini-heart {
    position: absolute; color: #ff2d55;
    font-size: 8px; opacity: 0; z-index: 1;
    pointer-events: none; user-select: none;
    -webkit-text-fill-color: #ff2d55;
}
.p1 { left: -10px; top: 20%; animation: heartFadeUp 3.5s infinite 0.2s; --drift: -12px; }
.p2 { bottom: -5px; left: 10%; animation: heartFadeUp 3s infinite 1.2s; --drift: -5px; }
.p3 { top: -8px; left: 40%; animation: heartFadeUp 4s infinite 0.6s; --drift: 8px; }
.p4 { top: -10px; left: 40%; animation: heartFadeUp 3.2s infinite 1.9s; --drift: 3px; }
.p5 { right: -12px; top: 30%; animation: heartFadeUp 3.8s infinite 0.4s; --drift: 15px; }
.p6 { bottom: -8px; right: 10%; animation: heartFadeUp 3.4s infinite 2.1s; --drift: -5px; }

@keyframes floatAnim {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes heartFadeUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    30% { opacity: 0.25; }
    100% { transform: translateY(-28px) translateX(var(--drift)) scale(1.3) rotate(20deg); opacity: 0; }
}

/* =========================================
   4. МЕНЮ И ЭЛЕМЕНТЫ САЙДБАРА
   ========================================= */
.sidebar-menu { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; margin: 8px 0 0 0; }
.sidebar-menu a { display: flex; align-items: center; padding: 13px 22px; font-size: 16px; color: #273145; text-decoration: none; }
.sidebar-menu a:hover { background: #f2f3f5; }
.sidebar-guest { margin: 20px 0; text-align: center; }
.sidebar-btn { display: block; margin: 8px 0; padding: 10px; border-radius: 8px; background: #4680eb; color: #fff; text-decoration: none; }
.sidebar-bottom { padding: 13px 0 16px 0; border-top: 1px solid #f2f3f6; }
.sidebar-bottom a { display: block; padding: 12px 22px; color: #8a9ab7; text-decoration: none; font-size: 15px; }

/* Иконки в меню */
.fi_ic { display: inline-block; }
.l-sidebar_link.fi_ic, .l-sidebar_link > .fi_ic { width: 24px; height: 24px; font-size: 24px; line-height: 24px; flex: 0 0 24px; }
.l-sidebar .fi_ic { margin-right: 0; }
.l-sidebar_lst.__flat .fi_ic { margin-left: 12px; transition: transform .15s; }
.l-sidebar_link.fi svg { margin-left: 0; }
.l-sidebar_lst.__secondary::after {
    content: ''; display: block; height: 1px;
    background-color: rgba(131,102,86,0.12);
    margin: 0 16px; transform: translateY(4px);
}
.l-sidebar_lst.__main .gbbl, .l-sidebar_lst.__main .gbbl.__pointer {
    top: 4px; right: 4px; left: auto; margin: 0;
    transform: translate(30%,-30%); z-index: 1;
}
.l-sidebar_lst.__flat .l-sidebar_i:hover .fi_ic, .l-sidebar_lst.__flat .l-sidebar_i:active .fi_ice {
    transform: scale(1.1);
}

/* =========================================
   5. БЛОК ПРЕИМУЩЕСТВ (xDrug Design)
   ========================================= */
.sidebar-panel-benefits {
    background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(243,249,255,1) 100%);
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-align: center;
    border-top: 1px solid #eef0f4;
}
.benefits-header { font-size: 16px; font-weight: 700; color: #1a1e26; margin: 0 0 14px 0; }
.benefits-list {
    list-style: none; padding: 0; margin: 0 0 10px 0;
    text-align: left; display: inline-flex; flex-direction: column; gap: 8px;
}
.benefits-item, .benefits-item li {
    font-size: 14px; color: #818c99; margin-bottom: 8px;
    display: flex; align-items: center; gap: 10px; margin-left: -10px !important;
}
.benefits-item svg { color: #435f8b; width: 20px; height: 20px; flex-shrink: 0; }
.button-wrapper-reg { text-align: center; }
.btn-create-account {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background-color: #22c55e; color: #ffffff !important;
    font-size: 15px; font-weight: 700; padding: 12px 24px;
    border-radius: 30px; text-decoration: none !important;
    width: 100%; box-sizing: border-box; border: none; cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.25);
}
.btn-create-account:hover { background-color: #16a34a; box-shadow: 0 6px 14px rgba(34, 197, 94, 0.3); }
.btn-create-account:active { transform: scale(0.98); }

/* =========================================
   6. ПРОЧИЕ БЛОКИ (Баннеры)
   ========================================= */
.Banner__host {
    background-color: var(--vkui--color_background_secondary);
    border-radius: var(--vkui--size_border_radius--regular);
    color: var(--vkui--color_text_primary);
    isolation: isolate;
    padding: var(--vkui_internal--banner-padding);
    --vkui_internal--banner-padding: 12px;
    display: flex; flex-flow: row; align-items: stretch;
    position: relative; overflow: hidden;
}
.Banner__content {
    flex-direction: column; flex: 1; justify-content: center;
    min-width: 0; display: flex;
}

/* =========================================
   7. АДАПТИВНОСТЬ (МЕДИА-ЗАПРОСЫ)
   ========================================= */

/* --- ДЕКСТОП (>= 882px): Панель стоит статично --- */
@media (min-width: 882px) {
    #sidebar_wrap {
        position: relative; float: left; margin-right: 4px;
        transform: none !important; visibility: visible !important;
        clip: auto !important; overflow: visible; transition: none !important;
    }
    .sidebar-close { display: none !important; }
    body.tw1ngo_staraya, .tw1ngo_staraya { display: block !important; }
    #sidebarOverlay { display: none !important; }
}

/* --- ПЛАНШЕТ И МОБАЙЛ (<= 881px): Панель превращается в шторку --- */
@media (max-width: 881px) {
    .sidebar-logo-inner { background: #fff; }
    .sidebar-logo { height: 48px; border: 0; }
    .sidebar-logo span { color: #435f8b; }
    
    #sidebar_wrap {
        position: fixed; top: 0; left: 0;
        z-index: 1235;
        transform: translate3d(-100%, 0, 0);
        visibility: hidden;
        background: #fff;
        overflow: hidden;
    }
    body.openSidebar #sidebar_wrap {
        transform: translate3d(0, 0, 0);
        visibility: visible;
        box-shadow: 5px 0 25px rgba(0,0,0,0.15);
    }
    body.openSidebar #sidebar_wrap.tw1ngo_novaya {
        background: #fff;
        clip: inherit;
        contain: layout;
    }
    #sidebar_wrap.tw1ngo_novaya {
        width: 320px;
    }
    #left_nav1 {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: none;
        padding-left: env(safe-area-inset-left);
    }
}

/* --- МАЛЕНЬКИЙ МОБАЙЛ (<= 480px): Панель на 100% ширины экрана --- */
@media (max-width: 480px) {
  #sidebar_wrap.tw1ngo_novaya {
    width: 100% !important;
  }
}
.l-sidebar_cnt.__guest {
  display: flex;
  flex-direction: column;
}
.l-sidebar_lst.__bottom {
  display: flex;
  flex-direction: column;
  justify-content: end;
  height: 100%;
}
.xdrug_auth_widget {
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #f0f2f5;
    text-align: center;
}
.auth_users_row {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.auth_user_avatar_item {
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.auth_user_avatar_item img {
    width: 56px;
    height: 56px;
    border-radius: 20px;
    border: 2px solid #f0f2f5;
    padding: 2px;
    background: #fff;
    transition: all 0.3s;
}
.auth_user_avatar_item.active img {
    border-color: #2688eb;
    transform: scale(1.1);
}
.auth_user_avatar_item .auth_check_mark {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #2688eb;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    transform: scale(0);
    transition: 0.2s;
}
.auth_user_avatar_item.active .auth_check_mark {
    transform: scale(1);
}
#auth_action_text {
  font-size: 14px;
  color: #818c99;
  margin-bottom: 15px;
  font-weight: 500;
}
#quick_auth_form {
  display: flex;
  justify-content: center;
}
.auth_btn_xd_primary, a.auth_btn_xd_primary, .auth_btn_xd_primary a {
  width: 100%;
  height: 40px;
  background: #435f8b;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 144px;
}
.auth_btn_xd_primary:disabled {
    background: #e1e3e6;
    color: #99a2ad;
    cursor: not-allowed;
    transform: none !important;
}
.auth_btn_xd_primary:not(:disabled):hover {
    background: #435f8b;
    box-shadow: 0 4px 12px rgba(38, 136, 235, 0.3);
}