* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #0e1621;
  color: #ffffff;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden { display: none !important; }

/* Модалка авторизации */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-content {
  background: #17212b;
  padding: 30px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.modal-content h2 { margin-bottom: 20px; font-size: 20px; }

.modal-content input[type="text"] {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #242f3d;
  background: #242f3d;
  color: white;
  margin-bottom: 15px;
  outline: none;
}

.file-label {
  display: block;
  padding: 10px;
  background: #2b5278;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 15px;
  font-size: 14px;
}

.modal-content button {
  width: 100%;
  padding: 12px;
  background: #5288c1;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.error-message { color: #ff5959; margin-top: 10px; font-size: 13px; }

/* Главный макет */
.chat-app {
  width: 100vw;
  height: 100vh;
  display: flex;
  background: #0e1621;
}

.sidebar {
  width: 280px;
  background: #17212b;
  border-right: 1px solid #0e1621;
  display: flex;
  flex-direction: column;
}

.current-user {
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #242f3d;
  font-weight: bold;
}

.current-user img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.chats-header { padding: 12px 15px; font-size: 12px; color: #7f91a4; text-transform: uppercase; }

.user-list { flex: 1; overflow-y: auto; }

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  cursor: pointer;
  transition: 0.2s;
}

.user-item:hover, .user-item.active { background: #202b36; }

.user-avatar-wrap { width: 40px; height: 40px; border-radius: 50%; background: #2b5278; display: flex; align-items: center; justify-content: center; overflow: hidden;}
.user-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }

.user-name { font-size: 15px; font-weight: 500; }
.user-status { font-size: 12px; color: #7f91a4; }

/* Чат */
.chat-window { flex: 1; display: flex; flex-direction: column; background: #0e1621; }

.chat-header { padding: 15px 20px; background: #17212b; font-weight: bold; border-bottom: 1px solid #0e1621; }

.messages-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 60%;
  padding: 8px 12px;
  border-radius: 12px;
  background: #182533;
  align-self: flex-start;
  position: relative;
  word-wrap: break-word;
}

.message.my-message {
  align-self: flex-end;
  background: #2b5278;
}

.message-sender { font-size: 12px; color: #e58273; font-weight: bold; margin-bottom: 4px; }
.message-time { font-size: 10px; color: #7f91a4; text-align: right; margin-top: 4px; }

.message-img { max-width: 100%; max-height: 250px; border-radius: 8px; margin-top: 5px; }

/* Панель ввода */
.input-panel {
  padding: 12px 20px;
  background: #17212b;
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-panel input[type="text"] {
  flex: 1;
  padding: 12px;
  background: #242f3d;
  border: none;
  border-radius: 8px;
  color: white;
  outline: none;
}

.attach-btn, .mic-btn, .send-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #7f91a4;
}

.send-btn { color: #5288c1; font-weight: bold; font-size: 15px; }
.mic-btn.recording { color: #ff5959; animation: pulse 1s infinite; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }