:root {
    --bg-darkest: #111214;
    --bg-darker: #1e1f22;
    --bg-dark: #2b2d31;
    --bg-light: #313338;
    --bg-card: #111214;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --green: #23a55a;
    --red: #f23f43;
    --text-primary: #f2f3f5;
    --text-muted: #949ba4;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-darkest);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* 1. ОКНО ВХОДА */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex; justify-content: center; align-items: center; z-index: 999;
}

.login-card {
    background-color: var(--bg-dark);
    padding: 36px; border-radius: 16px; width: 380px; text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.login-card .logo { font-size: 48px; color: var(--accent); margin-bottom: 12px; }
.login-card h2 { margin-bottom: 6px; font-size: 20px; }
.login-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

.input-group { display: flex; gap: 8px; }
.input-group input {
    flex: 1; padding: 12px; border-radius: 8px; border: none;
    background-color: var(--bg-darkest); color: #fff; outline: none;
}
.input-group button, .btn-primary {
    padding: 12px 18px; border-radius: 8px; border: none;
    background-color: var(--accent); color: #fff; font-weight: bold; cursor: pointer; transition: 0.2s;
}
.input-group button:hover, .btn-primary:hover { background-color: var(--accent-hover); }

/* 2. ГЛАВНЫЙ СЕТЧАТЫЙ ИНТЕРФЕЙС DISCORD */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ЛЕВАЯ ПАНЕЛЬ */
.sidebar {
    width: 240px;
    background-color: var(--bg-darker);
    display: flex;
    flex-direction: column;
}

.server-header {
    padding: 16px;
    border-bottom: 2px solid var(--bg-darkest);
    font-size: 15px;
    font-weight: bold;
}

.channels-container {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.channel-category {
    font-size: 11px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-left: 8px;
}

.channel {
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 2px;
    transition: 0.15s;
}

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

.channel.active {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
    font-weight: bold;
}

/* Список участников внутри категории голосового канала */
.voice-channel-users {
    padding-left: 32px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.voice-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.voice-user-item.speaking {
    color: var(--green);
    font-weight: bold;
}

/* ПАНЕЛЬ ПОДКЛЮЧЕННОГО ГОЛОСА (В ЛЕВОМ МЕНЮ) */
.voice-connected-bar {
    background-color: rgba(35, 165, 90, 0.1);
    border-top: 1px solid rgba(35, 165, 90, 0.2);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.voice-status-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-status-text {
    display: flex;
    flex-direction: column;
}

.voice-status-text .status-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--green);
}

.voice-status-text small {
    font-size: 10px;
    color: var(--text-muted);
}

/* НИЖНЯЯ ПАНЕЛЬ ПОЛЬЗОВАТЕЛЯ */
.user-footer {
    padding: 8px 12px;
    background-color: var(--bg-darkest);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background-color: var(--accent);
    display: flex; justify-content: center; align-items: center;
    font-weight: bold; color: #fff; font-size: 14px;
}

.user-info { flex: 1; display: flex; flex-direction: column; }
.user-info span { font-size: 13px; font-weight: bold; }
.user-info small { font-size: 10px; color: var(--green); }

.user-controls { display: flex; gap: 4px; }
.icon-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 16px; padding: 6px; border-radius: 4px; cursor: pointer; transition: 0.15s;
}
.icon-btn:hover { background-color: var(--bg-light); color: var(--text-primary); }
.icon-btn.danger-text { color: var(--red); }

/* ЦЕНТРАЛЬНАЯ ЗОНА */
.main-content {
    flex: 1;
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
}

.stage-header {
    padding: 12px 20px;
    background-color: var(--bg-light);
    border-bottom: 2px solid var(--bg-darker);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.stage-tabs { display: flex; gap: 8px; }
.stage-tab {
    background: none; border: none; color: var(--text-muted);
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold;
}
.stage-tab.active { background-color: var(--bg-dark); color: #fff; }

/* 1. ТЕКСТОВЫЙ ЧАТ (ПО ЦЕНТРУ КАК В DISCORD) */
.text-stage {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.messages-container {
    flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}

.system-message { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 10px; }

.message-item { font-size: 14px; line-height: 1.5; }
.message-item .sender { font-weight: bold; color: var(--accent); margin-right: 8px; }

.chat-input-area { padding: 16px 20px; background-color: var(--bg-light); }
.input-wrapper {
    display: flex; background-color: var(--bg-dark); border-radius: 8px; padding: 4px 8px; align-items: center;
}
.input-wrapper input {
    flex: 1; padding: 10px; border: none; background: none; color: #fff; outline: none; font-size: 14px;
}
.input-wrapper button {
    background: none; border: none; color: var(--accent); font-size: 18px; cursor: pointer; padding: 0 8px;
}

/* 2. ВИДЕО-СЕТКА С ПРОПОРЦИЯМИ 16:9 */
.video-stage {
    flex: 1; display: flex; flex-direction: column; position: relative; background-color: var(--bg-darkest);
}

.video-grid {
    flex: 1; padding: 20px;
    display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 16px;
    overflow-y: auto;
}

/* КАРТОЧКА УЧАСТНИКА С ЧЕТКИМИ ПРОПОРЦИЯМИ 16:9 */
.user-card {
    aspect-ratio: 16 / 9;
    width: 100%;
    max-width: 480px;
    border-radius: 12px;
    background-color: var(--bg-card);
    overflow: hidden;
    position: relative;
    display: flex; justify-content: center; align-items: center;
    border: 3px solid transparent;
    transition: 0.2s;
}

.user-card.speaking {
    border-color: var(--green);
    box-shadow: 0 0 15px rgba(35, 165, 90, 0.5);
}

.user-card video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Сохраняет пропорции видео 16:9 без искажений */
}

.user-card .avatar-placeholder {
    width: 80px; height: 80px; border-radius: 50%;
    background-color: var(--accent); font-size: 32px;
    display: flex; justify-content: center; align-items: center; color: #fff; font-weight: bold;
}

.user-card .card-name {
    position: absolute; bottom: 12px; left: 12px;
    background-color: rgba(0, 0, 0, 0.7); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: bold;
}

/* НИЖНЯЯ ПАНЕЛЬ ВИДЕОУПРАВЛЕНИЯ */
.video-controls-overlay {
    padding: 16px 24px; background-color: var(--bg-darker);
    display: flex; justify-content: space-between; align-items: center;
}

.mode-toggle { display: flex; align-items: center; gap: 10px; }
.mode-label { font-size: 12px; color: var(--text-primary); font-weight: bold; }

.switch { position: relative; display: inline-block; width: 38px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #72767d; transition: .3s; border-radius: 20px;
}
.slider:before {
    position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--green); }
input:checked + .slider:before { transform: translateX(18px); }

.video-actions { display: flex; gap: 12px; }

.control-btn {
    width: 42px; height: 44px; border-radius: 50%; border: none;
    background-color: var(--bg-dark); color: #fff; font-size: 18px; cursor: pointer;
    display: flex; justify-content: center; align-items: center; transition: 0.2s;
}
.control-btn:hover { background-color: var(--bg-light); }
.control-btn.active { background-color: var(--accent); }

.ptt-button {
    padding: 0 20px !important; border-radius: 22px !important;
    background-color: var(--accent) !important; color: #fff; border: none;
    font-size: 13px !important; font-weight: bold; cursor: pointer;
}
.ptt-button.talking {
    background-color: var(--green) !important;
    box-shadow: 0 0 15px rgba(35, 165, 90, 0.6);
}

/* ПРАВАЯ ПАНЕЛЬ СЛУШАТЕЛЕЙ */
.members-sidebar {
    width: 220px; background-color: var(--bg-darker);
    border-left: 2px solid var(--bg-darkest); padding: 16px 12px;
}
.members-category { font-size: 11px; font-weight: bold; color: var(--text-muted); margin-bottom: 12px; }
.members-list { display: flex; flex-direction: column; gap: 8px; }

/* 3. МОДАЛЬНОЕ ОКНО */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: var(--bg-dark); width: 420px; border-radius: 12px; overflow: hidden; }
.modal-header { padding: 16px 20px; background-color: var(--bg-darker); display: flex; justify-content: space-between; align-items: center; }
.modal-header .close-btn { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: bold; color: var(--text-muted); margin-bottom: 8px; }
.form-control { width: 100%; padding: 10px; border-radius: 6px; border: none; background-color: var(--bg-darkest); color: #fff; outline: none; }
.modal-footer { padding: 16px 20px; background-color: var(--bg-darker); display: flex; justify-content: flex-end; }
