body {
  margin: 0;
  font-family: 'Roboto', sans-serif;
  background-color: #f0f2f5;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100dvh;
  overflow: hidden;
}

.chat-container {
  max-width: 700px;
  width: 100%;
  height: auto; /* відключаємо vh */
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

body.no-scroll {
  overflow: hidden;
}

.chat-header {
  position: relative;
  background-color: #2F3314;
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #3e4422;
}

.chat-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.chat-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.clear-button {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.clear-button:hover {
  transform: translateY(-50%) scale(1.2);
}

.messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}

.bot {
  flex-direction: row;
  justify-content: flex-start;
}

.user {
  flex-direction: row-reverse;
  justify-content: flex-end;
  margin-left: auto;
}

.message-content {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.4;
  max-width: 75%;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bot .message-content {
  background-color: #ececec;
  color: #000;
  border-bottom-left-radius: 4px;
}

.user .message-content {
  background-color: #2F3314;
  color: white;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 12px;
  color: #999;
  text-align: right;
  align-self: flex-end;
}

.user .message-time {
  color: #ccc;
}

/* Аватар в сообщении */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

.bot .avatar {
  background-image: url('{{ url_for('static', filename='bot.png') }}');
}

.input-container {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background-color: #f9f9f9;
  border-top: 1px solid #ddd;
  gap: 10px;
}

input[type="text"] {
  flex-grow: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  background-color: #fff;
  border-radius: 20px;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.send-button {
  background-color: #2F3314;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.send-button:hover {
  background-color: #3e4422;
  transform: scale(1.1);
}

.send-icon {
  transform: rotate(0deg);
  fill: white;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding-left: 16px;
  padding-bottom: 10px;
  align-items: center;
}

.dot {
  width: 6px;
  height: 6px;
  background-color: #999;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

@media (max-width: 600px) {
  .chat-container {
    box-shadow: none;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .message-content {
    font-size: 15px;
  }

  .message-time {
    font-size: 11px;
  }

  .send-button {
    width: 40px;
    height: 40px;
  }

  .send-icon {
    width: 20px;
    height: 20px;
  }
}
