* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0f1621;
    color: #fff;
    height: 100vh;
    overflow: hidden;
}

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

/* ==================== Сайдбар ==================== */
.sidebar {
    width: 340px;
    background: #17212b;
    border-right: 1px solid #2b3a4a;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 16px;
    background: #0f1621;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2b3a4a;
}

.header h2 {
    font-size: 1.3em;
}

.header button {
    padding: 6px 12px;
    background: #2b5278;
    border: none;
    color: white;
    border-radius: 6px;
    cursor: pointer;
}

/* Поиск */
.search {
    padding: 12px;
}

.search input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 20px;
    background: #2b3a4a;
    color: white;
    font-size: 15px;
}

/* Список чатов */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid #243447;
    transition: background 0.2s;
}

.chat-item:hover {
    background: #2b3a4a;
}

.chat-item.active {
    background: #2b5278;
}

.chat-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-item div {
    flex: 1;
    overflow: hidden;
}

.chat-item strong {
    font-size: 16px;
    display: block;
}

.chat-item p {
    font-size: 14px;
    color: #a0b0c0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== Основная область чата ==================== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f1621;
}

.chat-header {
    padding: 15px 20px;
    background: #17212b;
    border-bottom: 1px solid #2b3a4a;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Сообщения */
.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #0f1621;
    background-image: 
        linear-gradient(rgba(15, 22, 33, 0.85), rgba(15, 22, 33, 0.85)),
        url('https://i.imgur.com/2vK8Xzq.jpg');
    background-size: cover;
    background-position: center;
}

.message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    font-size: 15.5px;
    line-height: 1.4;
}

.message.own {
    align-self: flex-end;
    background: #2b5278;
    border-bottom-right-radius: 4px;
}

.message.other {
    align-self: flex-start;
    background: #182533;
    border-bottom-left-radius: 4px;
}

.message img {
    max-width: 280px;
    border-radius: 10px;
    margin: 6px 0 4px 0;
    display: block;
}

.message small {
    display: block;
    font-size: 12px;
    opacity: 0.75;
    margin-top: 4px;
}

/* Поле ввода */
.input-area {
    padding: 12px 15px;
    background: #17212b;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #2b3a4a;
}

.input-area button {
    width: 42px;
    height: 42px;
    background: #2b3a4a;
    border: none;
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-area input[type="text"] {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 25px;
    background: #2b3a4a;
    color: white;
    font-size: 16px;
}

/* Модальное окно */
#new-chat-modal > div {
    background: #17212b;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
}

/* Боковое меню */
.side-menu {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100%;
  background: #17212b;
  transition: left 0.3s ease;
  z-index: 2000;
  padding: 20px;
  box-shadow: 2px 0 10px rgba(0,0,0,0.5);
}

.side-menu.open {
  left: 0;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.menu-item {
  padding: 15px;
  font-size: 17px;
  cursor: pointer;
  border-radius: 8px;
}

.menu-item:hover {
  background: #2b3a4a;
}