:root {
  --primary-color: #4285f4;
  --message-bg: #e9e9e9;
  --own-message-bg: #4285f4;
  --text-color: #333;
  --light-text: #999;
  --input-border: #ddd;
  --container-width: 100%;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
}

.chat-container {
  width: var(--container-width);
  max-width: 800px;
  height: 100vh;
  max-height: 900px;
  margin: 0 auto;
  background: white;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.chat-header {
  background: var(--primary-color);
  color: white;
  padding: 15px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  -webkit-overflow-scrolling: touch;
}

.message {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.message-content {
  max-width: 75%;
}

.own-message {
  align-items: flex-end;
}

.own-message .message-content {
  margin-left: auto;
}

.user-info {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: #ccc;
  border-radius: 50%;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 16px;
}

.message-sender {
  font-weight: bold;
  color: var(--text-color);
  font-size: 15px;
}

.message-text {
  background: var(--message-bg);
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.4;
  word-break: break-word;
  width: fit-content; 
}

.own-message .message-text {
  background: var(--own-message-bg);
  color: white;
}

.message-time {
  font-size: 9px;
  color: var(--light-text);
  margin-top: 4px;
  text-align: left;
}

.message-input {
  padding: 15px;
  background: white;
  position: sticky;
  bottom: 0;
  display: flex;
  border-top: 1px solid #eee;
}

.message-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--input-border);
  border-radius: 24px;
  font-size: 16px;
  outline: none;
}

.message-input button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0 20px;
  margin-left: 12px;
  border-radius: 24px;
  font-size: 16px;
  cursor: pointer;
  min-width: 80px;
}

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

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

.chat-item:hover {
    background-color: #f5f5f5;
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.chat-user-info {
    flex: 1;
}

.chat-user-name {
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 3px;
}

.chat-order-id {
    font-size: 13px;
    color: var(--light-text);
}

.no-chats {
    text-align: center;
    padding: 40px 20px;
    color: var(--light-text);
    font-size: 16px;
}

/* Адаптация под разные устройства */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 0;
    max-height: none;
    box-shadow: none;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .message-text {
    padding: 10px 14px;
    font-size: 15px;
  }
}

@media (min-width: 1200px) {
  .chat-container {
    max-width: 900px;
    height: 90vh;
    margin: 20px auto;
  }
  
  .message-content {
    max-width: 65%;
  }
}

@media (hover: hover) {
  .message-input button:hover {
    background: #3367d6;
  }
}