/* Подключение современного шрифта */
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

:root {
    /* Стандартная тема: Cyber Dark */
    --accent: #1db954;
    --bg-sidebar: #0f0f0f;
    --bg-chat: #080808;
    --text: #e0e0e0;
    --text-dim: #666;
    --border: rgba(255, 255, 255, 0.05);
    --bubble-mine: #0d1a10;
    --bubble-other: #161616;
}

/* Тема Matrix */
body.theme-matrix {
    --accent: #00ff41;
    --bg-sidebar: #000;
    --bg-chat: #050505;
    --text: #00ff41;
    --text-dim: #003b00;
    --bubble-mine: #001a00;
    --bubble-other: #000;
}

/* Тема Deep Blue */
body.theme-blue {
    --accent: #00aaff;
    --bg-sidebar: #0a0e14;
    --bg-chat: #05070a;
    --text: #d0e0ff;
    --text-dim: #455a64;
    --bubble-mine: #0a1b2e;
    --bubble-other: #121820;
}

* {
    box-sizing: border-box;
    font-family: 'Ubuntu', sans-serif;
}

body {
    background: var(--bg-chat);
    color: var(--text);
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

/* Основная сетка приложения */
.app-wrapper {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
}

/* САЙДБАР */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.search-area {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.search-input, .msg-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: 0.3s;
}

.search-input:focus, .msg-input:focus {
    border-color: var(--accent);
}

.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.user-link {
    display: block;
    padding: 12px 15px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 5px;
    transition: 0.2s;
}

.user-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.user-link.active {
    background: rgba(29, 185, 84, 0.1);
    color: var(--accent);
    font-weight: 500;
    border: 1px solid rgba(29, 185, 84, 0.2);
}

/* ОБЛАСТЬ ЧАТА */
.chat-window {
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
}

.chat-header {
    padding: 15px 25px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msg-area {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Стилизация скроллбара */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* Пузыри сообщений */
.bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 15px;
    background: var(--bubble-other);
    align-self: flex-start;
    line-height: 1.5;
    position: relative;
    border: 1px solid rgba(255,255,255,0.03);
}

.bubble.mine {
    align-self: flex-end;
    background: var(--bubble-mine);
    border: 1px solid rgba(29, 185, 84, 0.1);
}

.chat-img {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 8px;
    cursor: zoom-in;
    display: block;
}

/* Панель ввода */
.input-area {
    padding: 20px 30px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
}

.input-form {
    display: flex;
    gap: 15px;
    align-items: center;
}

.file-label {
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    color: var(--accent);
    transition: 0.2s;
}

.file-label:hover { transform: scale(1.1); }

.send-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.send-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* МОДАЛЬНОЕ ОКНО */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #151515;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--accent);
    width: 380px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.setting-item { margin-bottom: 20px; }
.setting-item label { 
    display: block; 
    margin-bottom: 8px; 
    font-size: 0.85rem; 
    color: var(--text-dim); 
}

select.msg-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}