/* ============================================
   Утилиты и общие компоненты
   ============================================ */

/* Tooltip — всплывающая подсказка при наведении */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100;
    max-width: calc(100vw - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Не выходить за правый край */
.tooltip::after {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 480px) {
    .tooltip::after {
        /* На маленьких экранах показываем слева от элемента */
        left: auto;
        right: calc(100% + 8px);
        transform: none;
    }
}

.tooltip:hover::after {
    opacity: 1;
}

/* Экран загрузки */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    color: var(--text-secondary);
}

.app-loading__icon {
    font-size: 3rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.app-loading__text {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Blazor error UI */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: white;
    padding: 12px 20px;
    font-size: 0.875rem;
    z-index: 9999;
    text-align: center;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 12px;
}

/* ============================================
   Layout приложения
   ============================================ */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-shell__nav {
    width: var(--nav-width);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.app-shell__sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-shell__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

.app-shell__content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Плеер: всегда в потоке (display:flex), скрыт через max-height + opacity.
   Transition работает потому что display НЕ меняется. */
    .app-shell__player {
        display: flex;
        align-items: center;
        width: 100%;
        max-height: 0;
        opacity: 0;
        flex-shrink: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        transition: max-height 0.3s ease, opacity 0.25s ease;
    }

/* Десктоп: плеер в нормальном потоке flex-column — контент сжимается автоматически */
@media (min-width: 641px) {
    .app-shell__player--playing {
        max-height: 80px;
        opacity: 1;
        transform: translateY(0);
        height: var(--player-height);
        width: 100%;
    }
}

/* Мобильная адаптация */
@media (max-width: 640px) {
    /* Используем dvh/svh — корректный скролл на мобильных */
    html, body {
        height: 100dvh;
        height: 100svh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    /* Основной контейнер - flex column */
    .app-shell {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        height: 100svh;
        height: calc(100dvh - env(safe-area-inset-bottom, 0px));
        height: calc(100svh - env(safe-area-inset-bottom, 0px));
        overflow: hidden;
    }

    /* Скрываем десктопную навигацию */
    .app-shell__nav {
        display: none;
    }

    /* Основная область */
    .app-shell__main {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    /* Контент страницы - занимает все место */
    .app-shell__content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    /* Плеер — фиксирован вверху на мобильных */
.app-shell__player {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    width: 100%;
    max-height: 0;
    opacity: 0;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    z-index: 90;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

    .app-shell__player--playing {
        max-height: var(--mobile-player-height);
        opacity: 1;
        height: var(--mobile-player-height);
    }

    /* Смещаем контент вниз когда плеер играет */
    .app-shell--radio-playing .app-shell__content {
        padding-top: calc(env(safe-area-inset-top, 0px) + var(--mobile-player-height));
    }

    /* Без плеера — только safe area для чёлки */
    .app-shell__content {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .app-shell__player--playing .radio-player {
        height: 56px;
        min-height: 56px;
        max-height: 56px;
        padding: 0;
    }

    /* Сайдбар (список чатов) */
    .app-shell__sidebar {
        width: 100%;
        border-right: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .app-shell__sidebar--hidden-mobile {
        display: none;
    }

    .app-shell__main--hidden-mobile {
        display: none;
    }

    /* Нижняя навигация - фиксирована */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--mobile-nav-height);
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* ============================================
   Кнопки
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition-fast), opacity var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-full {
    width: 100%;
}

/* ============================================
   Поля ввода
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color var(--transition-fast);
    outline: none;
    width: 100%;
}

.form-input:focus {
    border-color: var(--border-focus);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input--error {
    border-color: var(--danger);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================
   Карточки
   ============================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* ============================================
   Аватар
   ============================================ */
.avatar {
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
    overflow: hidden;
}

/* Фиксированные размеры + min-width/min-height гарантируют
   что плейсхолдер с инициалами не схлопывается в flex-контейнерах */
.avatar--xs  { width: 24px;  height: 24px;  min-width: 24px;  min-height: 24px;  font-size: 0.625rem; }
.avatar--sm  { width: 32px;  height: 32px;  min-width: 32px;  min-height: 32px;  font-size: 0.75rem;  }
.avatar--md  { width: 40px;  height: 40px;  min-width: 40px;  min-height: 40px;  font-size: 0.875rem; }
.avatar--lg  { width: 56px;  height: 56px;  min-width: 56px;  min-height: 56px;  font-size: 1.125rem; }
.avatar--xl  { width: 80px;  height: 80px;  min-width: 80px;  min-height: 80px;  font-size: 1.5rem;   }
/* Исправлено: было .avatar--2xl, но AvatarSize.Xxl.ToString().ToLower() = "xxl" */
.avatar--xxl { width: 112px; height: 112px; min-width: 112px; min-height: 112px; font-size: 2rem;     }

.avatar-wrapper {
    position: relative;
    display: inline-flex;
    flex-shrink: 0; /* не сжимается в flex-контейнерах */
}

.avatar-wrapper .online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: var(--online);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-surface);
}

/* ============================================
   Бейдж
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1;
}

/* ============================================
   Toast уведомления
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}

.toast {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.25) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-left: 3px solid;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    animation: slideInRight var(--transition-base) ease;
    position: relative;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast--clickable {
    cursor: pointer;
}

.toast--clickable:hover {
    background: rgba(30, 30, 46, 0.95);
}

.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast--info    { border-left-color: var(--accent); }
.toast--friendrequest { border-left-color: var(--warning); }

.toast__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.toast__header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.toast__title {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast__subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toast__tail {
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.toast__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.toast__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        max-width: none;
        padding: 10px 14px;
    }
    
    .toast__title {
        font-size: 0.8125rem;
    }
    
    .toast__subtitle,
    .toast__tail {
        font-size: 0.75rem;
    }
}

/* ============================================
   Разделитель
   ============================================ */
.divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* ============================================
   Индикатор печати
   ============================================ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    animation: typingDot 1.2s ease infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================
   Утилиты
   ============================================ */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-accent    { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-danger    { color: var(--danger); }
.text-success   { color: var(--success); }

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full          { width: 100%; }
.h-full          { height: 100%; }
.flex-1          { flex: 1; }
.min-w-0         { min-width: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* ============================================
   Анимации
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(0.95); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* ============================================
   Мобильная адаптация (только для very small экранов)
   ============================================ */
@media (max-width: 640px) {
    .app-shell {
        /* Фиксируем height, чтобы не менялся при клавиатуре */
        height: 100dvh;
        height: 100svh;
        overflow: hidden;
    }

    .app-shell__nav {
        display: none;
    }

    .app-shell__sidebar {
        width: 100%;
        border-right: none;
    }

    .app-shell__sidebar--hidden-mobile {
        display: none;
    }

    .app-shell__main--hidden-mobile {
        display: none;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--mobile-nav-height);
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        z-index: 100;
        /* Поддержка safe-area на iPhone с notch/home indicator */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    }
}

@media (min-width: 641px) {
    .mobile-nav {
        display: none;
    }
}

/* ============================================
   Лоадер инициализации приложения
   Показывается при F5 пока восстанавливается сессия
   ============================================ */
.app-init-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    z-index: 9999;
}

/* ============================================
   Auth страницы
   ============================================ */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: var(--shadow-lg);
}

.auth-card__header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.auth-card__logo {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 4px;
}

.auth-card__title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-card__subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-card__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.875rem;
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 0.875rem;
}

/* Поле с кнопкой внутри (показать/скрыть пароль) */
.input-with-action {
    position: relative;
}

.input-with-action .form-input {
    padding-right: 44px;
}

.input-action-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.input-action-btn:hover {
    color: var(--text-secondary);
}

/* Спиннер в кнопке */
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: var(--radius-lg);
    }
}

/* ============================================
   Модалы и оверлеи
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn var(--transition-base);
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideInUp var(--transition-base);
    box-shadow: var(--shadow-lg);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal__footer {
    padding: 12px 20px 20px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Модал создания группы */
.create-group-modal {
    max-width: 420px;
}

.create-group-modal__friends {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.create-group-modal__loading {
    display: flex;
    justify-content: center;
    padding: 24px;
}

.create-group-modal__friend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

.create-group-modal__friend:last-child {
    border-bottom: none;
}

.create-group-modal__friend:hover {
    background: var(--bg-elevated);
}

.create-group-modal__friend--selected {
    background: var(--accent-muted);
}

.create-group-modal__friend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.create-group-modal__friend-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.create-group-modal__friend-check {
    flex-shrink: 0;
}

/* Панель участников группы */
.group-members-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 380px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideInUp var(--transition-base);
    overflow: hidden;
}

.group-members-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.group-members-panel__header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-members-panel__header-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.group-members-panel__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.group-members-panel__count {
    font-size: 0.75rem;
    display: block;
    margin-top: 2px;
}

.btn-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.group-members-panel__loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.group-members-panel__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.group-members-panel__member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background var(--transition-fast);
}

.group-members-panel__member:hover {
    background: var(--bg-elevated);
}

.group-members-panel__member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-members-panel__member-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-members-panel__member-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.group-members-panel__member:hover .group-members-panel__member-actions {
    opacity: 1;
}

.group-members-panel__footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.group-members-panel__add-list {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 6px;
}

.group-members-panel__add-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

.group-members-panel__add-item:last-child {
    border-bottom: none;
}

.group-members-panel__add-item:hover {
    background: var(--bg-elevated);
}

/* Бейджи ролей */
.badge--owner,
.badge--admin,
.badge--member {
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge--owner {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);
    color: #dc2626;
    border: none;
}

.badge--admin {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.2) 100%);
    color: #f59e0b;
    border: none;
}

.badge--member {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: none;
}

/* Маленькие кнопки */
.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
    height: auto;
    min-height: 26px;
    border-radius: var(--radius-sm);
}

/* Страница восстановления пароля */
.forgot-password__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px 0 16px;
}

.forgot-password__icon {
    width: 80px;
    height: 80px;
    background: var(--accent-muted);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.forgot-password__message {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}

/* Страница сброса пароля */
.reset-password__error-block,
.reset-password__success-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px 0 24px;
}

.reset-password__icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-password__icon--error {
    background: rgba(248, 113, 113, 0.15);
}

.reset-password__icon--success {
    background: rgba(74, 222, 128, 0.15);
}

.reset-password__message {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Chat Input */
.chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.chat-input--dragging {
    background: var(--bg-hover);
    border-color: var(--color-primary);
    border: 2px dashed var(--color-primary);
    padding: 6px 10px;
}

.chat-input__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.chat-input__actions .btn-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chat-input__actions_end {
    position: relative;
}

.chat-input__field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.chat-input__textarea {
    width: 100%;
    resize: none;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--text-primary);
    outline: none;
    max-height: 120px;
    overflow-y: auto;
    min-height: 40px;
    box-sizing: border-box;
}

.chat-input__textarea::placeholder {
    color: var(--text-muted);
}

.chat-input__preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
}

.chat-input__preview-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.chat-input__preview-file {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.chat-input__preview-name {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
}

.chat-input__preview-remove {
    flex-shrink: 0;
}

.chat-input__action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease, background 0.2s ease;
}

.chat-input__action-btn:active {
    transform: scale(0.92);
    background: var(--accent-hover);
}

/* Активное состояние записи */
.audio-recorder-wrapper .chat-input__action-btn.recording {
    background: var(--danger);
    animation: pulse-recording 1s ease-in-out infinite;
}

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

/* Убираем highlight при касании на мобильных */
.chat-input__action-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.chat-input__action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Audio Recorder */
.audio-recorder-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.audio-recorder__popup {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    animation: fadeIn 0.15s ease;
}

.audio-recorder__dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Редактирование аватара группы */
.group-avatar-edit {
    position: relative;
    cursor: pointer;
    display: inline-block;
}

.group-avatar-edit__overlay {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 3px solid var(--bg-elevated);
    box-shadow: var(--shadow-md);
    transition: transform 0.15s ease;
}

.group-avatar-edit:hover .group-avatar-edit__overlay {
    transform: scale(1.1);
}

/* Секция информации о группе */
.group-info-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.group-info-section__avatar {
    margin-bottom: 4px;
}

.group-info-section__name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
}

.group-info-section__desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
    max-width: 280px;
}

/* Форма редактирования группы */
.group-settings-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.group-settings-form__avatar {
    margin-bottom: 4px;
}

.group-settings-form .form-group {
    width: 100%;
    max-width: 280px;
}
