.chat-sidebar-wrapper {
    background: #ffffff;
    border-right: 1px solid var(--tg-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    height: 100vh;
    overflow: hidden;
    position: relative;
    width: 370px; /* фиксированная ширина для десктопа */
}

/* На мобильных устройствах */
@media (max-width: 768px) {
  .chat-sidebar-wrapper {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: 100%;
      z-index: 1000;
      transform: translateX(0);
      transition: none;
  }

  /* Добавьте animatable класс для анимации */
  .chat-sidebar-wrapper.animatable {
      transition: transform 0.3s ease;
  }

  /* Скрываем сайдбар когда нет класса open */
  .chat-sidebar-wrapper:not(.open) {
      transform: translateX(-100%);
  }

    /* Когда сайдбар открыт */
    .chat-sidebar-wrapper.open {
        transform: translateX(0);
    }

    /* Слайды на мобильных тоже занимают всю ширину */
    .sidebar-slide {
        width: 100%;
        max-width: 100%;
    }
}

/* Десктоп - сайдбар всегда видим */
@media (min-width: 769px) {
    .chat-sidebar-wrapper {
        transform: translateX(0) !important;
    }
}

/* Контейнер для всех слайдов */
.sidebar-slides-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Базовые стили для всех слайдов */
.sidebar-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    z-index: 1;
}

/* Главный слайд всегда видим */
.sidebar-slide-main {
    /*transform: translateX(0);*/
    z-index: 1;
}

/* Новые слайды начинают справа */
.sidebar-slide:not(.sidebar-slide-main) {
    transform: translateX(100%);
    z-index: 2;
}

/* Шапка слайда */
.sidebar-slide-header {
    display: flex;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid var(--tg-border);
    flex-shrink: 0;
    background: #ffffff;
}

.sidebar-slide-back {
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #272727;
    transition: background 0.2s ease;
}

.sidebar-slide-back:hover {
    background: var(--tg-secondary);
}

.sidebar-slide-title {
    font-size: 20px;
    font-weight: bold;
    margin: 0;
    flex: 1;
    color: #272727;
}

.sidebar-slide-content {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    /*padding: 16px;*/
}

.sidebar-slide-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    color: #272727;
}

/* Стили для настроек */
.sidebar-settings {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top:5px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    padding: 5px;
    /*gap: 12px;*/
}

.settings-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px 0;
}

.settings-item {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-size: 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    color: #272727;
    cursor: pointer;
}

.settings-item:hover, .settings-link:hover {
    background: #ededed;
}

.settings-link {
    display: block;
    padding: 16px;
    font-size: 16px;
    color: #272727;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    border-radius: 8px;
}

.settings-link:last-child {
    border-bottom: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #000000;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Sidebar menu button */
.sidebar-menu-btn {
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #272727;
    transition: background 0.2s ease;
}

.sidebar-menu-btn:hover {
    background: var(--tg-secondary);
}
/* ========== ПРОФИЛЬ В НАСТРОЙКАХ ========== */
.settings-profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
    transition: padding 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Обертка для аватара */
.profile-avatar-wrapper {
    position: relative;
    width: 96px;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Контейнер аватара с кнопкой */
.profile-avatar-container {
    position: relative;
    display: inline-block;
}

/* Миниатюра аватара */
.profile-avatar-large {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 5px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
}

.profile-avatar-large:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #000000;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Кнопка редактирования */
.avatar-edit-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #000000;
    border: 2px solid #ffffff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 3;
}

.avatar-edit-btn:hover {
    background: var(--tg-primary-hover);
    transform: scale(1.1);
}

.avatar-edit-btn svg {
    width: 18px;
    height: 18px;
}

/* При раскрытии скрываем кнопку */
.settings-profile-header.expanded .avatar-edit-btn {
    display: none;
}

/* Раскрытое изображение */
.profile-avatar-expanded {
    width: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    border-radius: 0px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                max-height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s ease,
                margin 0.4s ease,
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(20px);
}

/* Состояние раскрытия */
.settings-profile-header.expanded .profile-avatar-wrapper {
    width: 100%;
}

/* Скрываем миниатюру при раскрытии */
.settings-profile-header.expanded .profile-avatar-large {
    display: none;
}

/* Показываем раскрытое изображение с анимацией снизу вверх */
.settings-profile-header.expanded .profile-avatar-expanded {
    width: 100%;
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 8px;
}

/* Галерея аватаров */
.avatar-gallery-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.avatar-gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0px;
    overflow: hidden;
    background: #f5f5f5;
}

.avatar-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Стрелки навигации */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

/* Бейдж главного фото */
.gallery-main-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 215, 0, 0.95);
    backdrop-filter: blur(4px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-main-badge svg {
    width: 14px;
    height: 14px;
    color: #f5a623;
}

/* Кнопка удаления - слева */
.gallery-delete-btn {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.95);
    backdrop-filter: blur(4px);
    border: 2px solid white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-delete-btn:hover {
    background: rgb(220, 53, 69);
    transform: scale(1.1);
}

.gallery-delete-btn svg {
    width: 20px;
    height: 20px;
}

/* Кнопка "Сделать главным" - по центру */
.gallery-set-main-btn {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 44px;
    height: 44px;
    padding: 0 18px;
    border-radius: 22px;
    background: #000000;
    backdrop-filter: blur(4px);
    border: 2px solid white;
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.gallery-set-main-btn:hover {
    background: var(--tg-primary-hover);
    transform: translateX(-50%) scale(1.05);
}

.gallery-set-main-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Кнопка добавления - справа */
.gallery-add-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #000000;
    border: 2px solid white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-add-btn:hover {
    background: var(--tg-primary-hover);
    transform: scale(1.1);
}

.gallery-add-btn svg {
    width: 20px;
    height: 20px;
}

/* Скрываем имя и статус при раскрытии */
.settings-profile-header.expanded .profile-name,
.settings-profile-header.expanded .profile-status {
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    margin: 0;
    padding: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

/* Имя и статус по умолчанию */
.profile-name {
    font-size: 18px;
    font-weight: bold;
    color: #272727;
    margin-top: 8px;
    margin-bottom: 4px;
    text-align: center;
    word-break: break-word;
    opacity: 1;
    visibility: visible;
    max-height: 60px;
    transition: opacity 0.3s ease, visibility 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.profile-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--tg-text-secondary);
    opacity: 1;
    visibility: visible;
    max-height: 30px;
    transition: opacity 0.3s ease, visibility 0.3s ease, max-height 0.3s ease;
    margin-bottom: 4px;
}

.profile-status.online-profile {
    color: var(--tg-success);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--tg-success);
    display: inline-block;
    animation: pulse 2s infinite;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .settings-profile-header {
        padding: 20px 16px 12px;
    }

    .profile-avatar-wrapper {
        width: 80px;
    }

    .profile-avatar-large {
        width: 80px;
        height: 80px;
    }

    .profile-name {
        font-size: 18px;
    }

    .gallery-nav {
        display: none !important;
    }

    .gallery-delete-btn,
    .gallery-add-btn {
        width: 40px;
        height: 40px;
    }

    .gallery-set-main-btn {
        height: 40px;
        padding: 0 14px;
        font-size: 12px;
    }

    .gallery-set-main-btn svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .gallery-set-main-btn {
        padding: 0 10px;
        min-width: 40px;
    }

    .gallery-set-main-btn span {
        display: none;
    }

    .gallery-set-main-btn svg {
        margin: 0;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

.profile-content {
    padding: 8px 0;
}

/* Аватар в профиле */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 24px;
}

.profile-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    cursor: pointer;
    margin-bottom: 12px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #000000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-avatar:hover img {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.avatar-edit-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: #000000;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 3px solid white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.profile-avatar-text {
    font-size: 14px;
    color: var(--tg-text-secondary);
}

/* Обертка для полей ввода */
.input-wrapper {
    display: grid;
    gap: 20px;
    grid-template-columns: 100%;
    padding: 0 4px;
}

/* Поле ввода */
.input-field {
    --height: 56px;
    --border-radius: 12px;
    --padding: 1rem;
    --padding-horizontal: 1rem;
    --border-width: 1px;
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Само поле */
.input-field-input {
    border: var(--border-width) solid #e0e0e0;
    border-radius: var(--border-radius);
    background-color: #ffffff;
    padding: calc(var(--padding) - var(--border-width)) calc(var(--padding-horizontal) - var(--border-width));
    box-sizing: border-box;
    width: 100%;
    min-height: var(--height);
    transition: border-color 0.2s ease;
    position: relative;
    z-index: 1;
    line-height: 1.5;
    font-size: 16px;
    color: #272727;
    outline: none;
}

.input-field-input:focus {
    border-color: #000000;
}

.input-field-input[contenteditable="true"] {
    cursor: text;
}

.input-field-input.is-empty {
    color: #9e9e9e;
}

.input-field-input[data-placeholder]:empty:before {
    content: attr(data-placeholder);
    color: #9e9e9e;
}

/* Лейбл */
.input-field label {
    position: absolute;
    color: #9e9e9e;
    top: 0;
    left: var(--padding-horizontal);
    right: auto;
    z-index: 2;
    height: 1.5rem;
    transform: translateY(-50%);
    background-color: #ffffff;
    transform-origin: left center;
    pointer-events: none;
    padding: 0 6px;
    user-select: none;
    white-space: nowrap;
    font-size: 14px;
    transition: color 0.2s ease;
}

.input-field-input:focus + .input-field-border + label,
.input-field-input:not(.is-empty) + .input-field-border + label {
    color: #000000;
}

/* Рамка при фокусе */
.input-field-border {
    position: absolute;
    inset: 0;
    border: 2px solid #000000;
    opacity: 0;
    border-radius: var(--border-radius);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s ease;
}

.input-field-input:focus ~ .input-field-border {
    opacity: 1;
}

/* ========== ОШИБКИ ВАЛИДАЦИИ ========== */
.input-field.has-error .input-field-input {
    border-color: #dc3545 !important;
}

.input-field.has-error .input-field-border {
    border-color: #dc3545 !important;
    opacity: 1;
}

.input-field.has-error label {
    color: #dc3545 !important;
}

.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    padding-left: 4px;
    display: none;
}

.input-field.has-error + .field-error {
    display: block;
}

/* Для обертки с ошибкой */
.input-field-wrapper {
    width: 100%;
}

.input-field-wrapper .field-error {
    margin-top: 2px;
    margin-bottom: 8px;
}

/* Кнопка сохранить */
.save-profile-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.save-profile-btn:hover {
    background: rgba(51, 144, 236, 0.1);
}

.save-profile-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .input-field {
        --height: 52px;
    }
}

/* ========== СМЕНА EMAIL ========== */
.email-change-container {
    padding: 16px;
}

.current-email-info {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.current-email-label {
    color: var(--tg-text-secondary);
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.current-email-value {
    font-size: 18px;
    font-weight: 600;
    color: #272727;
    word-break: break-all;
}

.email-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.code-info {
    text-align: center;
    color: var(--tg-text-secondary);
    font-size: 14px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 8px;
    margin-bottom: 8px;
}

.email-error {
    color: #dc3545;
    font-size: 13px;
    padding: 0 4px;
}

/*
.button:hover {
    background: var(--tg-primary-hover);
}
*/

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fs_15 {
    font-size: 15px;
}

.color_fff {
    color: #ffffff;
}

.button-link {
    background: none;
    border: none;
    color: #000000;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 8px;
}

.button-link:hover {
    color: var(--tg-primary-hover);
}
.glass-placeholder {
  background: linear-gradient(135deg, #d1d1d1 0%, #f0f0f0 20%, #ffffff 40%, #ffffff 60%, #e8e8e8 80%, #f0f0f0 100%);
    background-size: 300% 300%;
    animation: glassShimmer 2s infinite linear;
    transition: background 0.3s ease;
}

.glass-placeholder.loaded {
    background: transparent;
    animation: none;
}

@keyframes glassShimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}
