/* --- ПЕРЕМЕННЫЕ И ЦВЕТА --- */
:root {
    --bg-servers: #11111b;    /* Почти черный */
    --bg-sidebar: #2d1b4d;    /* Глубокий фиолетовый */
    --bg-main: #1e1e2e;       /* Темно-черничный */
    --bg-input: #383a40;      /* Серый как в Discord */
    
    --brand: #7c5cff;         /* Основной фиолетовый */
    --brand-hover: #967dff;
    --brand-glow: rgba(124, 92, 255, 0.4);
    
    --text: #cdd6f4;          /* Светлый текст */
    --text-muted: #6c7086;    /* Тусклый текст */
    
    --success: #a6e3a1;       /* Мятный (онлайн/голос) */
    --danger: #f38ba8;        /* Розово-красный (мут/выход) */
    --border: 1px solid rgba(0, 0, 0, 0.2);
}

/* --- ОБЩИЙ СБРОС --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- ГЛАВНЫЙ КОНТЕЙНЕР (4 ПАНЕЛИ) --- */
#app-container {
    display: grid;
    grid-template-columns: 72px 240px 1fr 240px;
    height: 100vh;
    width: 100vw;
}

/* 1. ПАНЕЛЬ СЕРВЕРОВ (Крайняя левая) */
.panel-servers {
    background: var(--bg-servers);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 10px;
    border-right: var(--border);
}

.srv-btn {
    width: 48px;
    height: 48px;
    background: var(--bg-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: bold;
    font-size: 20px;
    color: var(--brand);
}

.srv-btn:hover, .srv-btn.active {
    border-radius: 15px;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 15px var(--brand-glow);
}

.server-separator {
    width: 32px;
    height: 2px;
    background: #333;
    border-radius: 1px;
}

/* 2. САЙДБАР (КАНАЛЫ) */
.panel-sidebar {
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: var(--border);
}

.sb-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-weight: bold;
    border-bottom: var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 14px;
    letter-spacing: 0.5px;
}

.nav-list {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}

.channel-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.1s;
}

.channel-item:hover, .channel-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.channel-item.active {
    color: #fff;
    background: rgba(124, 92, 255, 0.1);
}

/* Юзер-панель внизу сайдбара */
.user-panel-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: var(--border);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

#my-name {
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.status-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* 3. ЦЕНТРАЛЬНАЯ ПАНЕЛЬ (ЧАТ) */
.panel-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    min-width: 0;
}

.chat-header {
    height: 48px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    font-weight: bold;
    border-bottom: var(--border);
    font-size: 16px;
}

.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Скроллбары под фиолетовый */
.messages::-webkit-scrollbar, .nav-list::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb, .nav-list::-webkit-scrollbar-thumb { background: #111; border-radius: 10px; }
.messages::-webkit-scrollbar-track, .nav-list::-webkit-scrollbar-track { background: transparent; }

/* Поле ввода */
.input-area {
    padding: 0 20px 24px 20px;
}

.input-wrapper {
    background: var(--bg-input);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 2px 15px;
}

.add-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding-right: 12px;
}

.add-btn:hover { color: #fff; }

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    padding: 12px 0;
    outline: none;
    font-size: 15px;
}

/* 4. ПРАВАЯ ПАНЕЛЬ (ЮЗЕРЫ) */
.panel-users {
    background: var(--bg-sidebar);
    padding: 20px 10px;
    border-left: var(--border);
    overflow-y: auto;
}

.u-group-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.u-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.1s;
}

.u-card:hover { background: rgba(255,255,255,0.05); }

/* --- АВАТАРКИ И ГОЛОС --- */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    position: relative;
}

/* Зеленый кружок вокруг говорящего */
.avatar.speaking {
    box-shadow: 0 0 0 2px var(--success), 0 0 10px var(--success);
}

.u-status {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
    position: absolute;
    bottom: 0;
    right: 0;
}

/* --- КНОПКИ ДЕЙСТВИЙ --- */
.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    transition: 0.2s;
}

.action-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.action-btn.active { color: var(--danger); }

/* --- МОДАЛЬНОЕ ОКНО (НАСТРОЙКИ) --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--bg-main);
    padding: 40px;
    border-radius: 12px;
    width: 440px;
    border: 1px solid var(--brand);
    box-shadow: 0 0 30px var(--brand-glow);
}

.modal-card h2 {
    margin-bottom: 24px;
    color: var(--brand);
    letter-spacing: 1px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.primary-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: 0.2s;
}

.primary-btn:hover { background: var(--brand-hover); }

.danger-btn {
    background: none;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 10px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
}

.danger-btn:hover { background: var(--danger); color: #fff; }

/* --- СООБЩЕНИЯ --- */
.msg-row {
    display: flex;
    gap: 16px;
}

.msg-content b {
    color: var(--brand);
    font-size: 15px;
    margin-right: 8px;
}

.msg-content small {
    color: var(--text-muted);
    font-size: 12px;
}

.msg-text {
    margin-top: 4px;
    line-height: 1.4;
    color: #dbdee1;
}

.msg-file-link {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 12px;
    background: #000;
    border: 1px dashed var(--brand);
    border-radius: 6px;
    color: var(--brand);
    text-decoration: none;
    font-size: 12px;
}
/* --- НОВЫЙ СТИЛЬ АВТОРИЗАЦИИ --- */
#auth-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #2d1b4d 0%, #0d0d0f 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
}

/* Эффект матового стекла для карточки */
.auth-card {
    background: rgba(30, 30, 46, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 60px 40px;
    border-radius: 24px;
    width: 420px;
    border: 1px solid rgba(124, 92, 255, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 
                0 0 20px rgba(124, 92, 255, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.auth-card:hover {
    border-color: rgba(124, 92, 255, 0.6);
}

.auth-card h1 {
    font-size: 42px;
    color: var(--brand);
    letter-spacing: 8px;
    margin-bottom: 40px;
    text-shadow: 0 0 15px var(--brand-glow);
    font-weight: 900;
}

/* Поля ввода */
.auth-input-group {
    position: relative;
    margin-bottom: 20px;
}

.auth-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px;
    color: #fff;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

.auth-input:focus {
    border-color: var(--brand);
    background: rgba(124, 92, 255, 0.05);
    box-shadow: 0 0 15px rgba(124, 92, 255, 0.2);
}

/* Кнопка */
.primary-btn {
    width: 100%;
    padding: 18px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(124, 92, 255, 0.3);
    margin-top: 10px;
}

.primary-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(124, 92, 255, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Переключатель режима */
.auth-switch {
    margin-top: 25px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    display: inline-block;
}

.auth-switch:hover {
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

#auth-error {
    min-height: 20px;
    margin-top: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 11px;
}