/* Boltx — минимальный интерфейс (ТЗ §10.1, desktop-first) */
:root {
  --bg: #1e2126;
  --bg-panel: #262a31;
  --bg-hover: #2f343d;
  --text: #e6e8eb;
  --text-dim: #9aa2ad;
  --accent: #4a9eda;
  --border: #3a4049;
  --danger: #d05a5a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

#app { display: flex; height: 100vh; }

/* левая панель */
#sidebar {
  width: 340px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
#me-name { font-weight: 600; }
#logout-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; }
#logout-btn:hover { color: var(--danger); }

.search-box { position: relative; padding: 10px; border-bottom: 1px solid var(--border); }
#search-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.search-results {
  position: absolute;
  left: 10px; right: 10px; top: 44px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
}
.search-item { padding: 8px 10px; cursor: pointer; }
.search-item:hover { background: var(--bg-hover); }

#chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-hover); }
.chat-item .chat-title { font-weight: 600; }
.chat-item .chat-preview { color: var(--text-dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .chat-main { min-width: 0; }
.unread-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 12px;
  align-self: center;
}

/* правая панель */
#chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#chat-empty { margin: auto; color: var(--text-dim); }
#chat-window { display: flex; flex-direction: column; height: 100vh; }
#chat-window.hidden, #chat-empty.hidden, .hidden { display: none; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}
#chat-peer-name { font-weight: 600; }
.chat-actions button, #send-form button, #call-banner button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  margin-left: 6px;
}
.chat-actions button:hover, #send-form button:hover { border-color: var(--accent); }

#call-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #3d3420;
  border-bottom: 1px solid var(--border);
}

#messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 60%; padding: 8px 12px; border-radius: 10px; background: var(--bg-panel); word-wrap: break-word; }
.msg.own { align-self: flex-end; background: #2d4a63; }
.msg .msg-sender { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.msg .msg-time { font-size: 10px; color: var(--text-dim); text-align: right; }

#send-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-panel); }
#send-input { flex: 1; padding: 10px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }

/* тост */
#toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 100;
}
