:root {
  --floward-teal: #00575C;
  --floward-bg: #F7F6F2;
  --floward-white: #fff;
  --floward-gray: #bfc5ce;
  --floward-bubble-user: #00575C;
  --floward-bubble-system: #F7F6F2;
  --floward-bubble-system-text: #222;
  --floward-shadow: 0 4px 24px rgba(0, 87, 92, 0.08);
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--floward-bg);
  font-family: 'Open Sans', Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--floward-bg);
}

.header {
  background: var(--floward-white);
  color: var(--floward-teal);
  padding: 32px 0 16px 0;
  text-align: center;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(0, 87, 92, 0.04);
  border-bottom: 1.5px solid #e6e6e6;
  position: relative;
}

.header img {
  height: 48px;
  margin-bottom: 8px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.header-buttons {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
}

.new-conversation-btn,
.logout-btn {
  background: var(--floward-teal);
  color: var(--floward-white);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 87, 92, 0.15);
  flex-shrink: 0;
}

.logout-btn {
  background: #dc3545;
}

.new-conversation-btn .material-icons,
.logout-btn .material-icons {
  font-size: 20px;
}

.new-conversation-btn:hover,
.logout-btn:hover {
  background: #003c3f;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 87, 92, 0.25);
}

.logout-btn:hover {
  background: #c82333;
}

.new-conversation-btn:active,
.logout-btn:active {
  transform: scale(1);
  box-shadow: 0 2px 8px rgba(0, 87, 92, 0.15);
}

@media (max-width: 768px) {
  .header {
    padding: 20px 0 12px 0;
    font-size: 1.6rem;
  }

  .header img {
    height: 36px;
    margin-bottom: 6px;
  }

  .header-buttons {
    right: 12px;
    gap: 10px;
  }

  .new-conversation-btn,
  .logout-btn {
    width: 44px;
    height: 44px;
  }

  .new-conversation-btn .material-icons,
  .logout-btn .material-icons {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 16px 0 10px 0;
    font-size: 1.4rem;
  }

  .header img {
    height: 30px;
    margin-bottom: 4px;
  }

  .header-buttons {
    right: 8px;
    gap: 8px;
  }

  .new-conversation-btn,
  .logout-btn {
    width: 40px;
    height: 40px;
  }

  .new-conversation-btn .material-icons,
  .logout-btn .material-icons {
    font-size: 16px;
  }
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 600px;
  min-width: 500px;
  width: 100%;
  margin: 32px auto 24px auto;
  background: var(--floward-white);
  border-radius: 20px;
  box-shadow: var(--floward-shadow);
  padding: 32px 20px 20px 20px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .chat-container {
    min-width: unset;
    max-width: calc(100vw - 20px);
    width: calc(100vw - 20px);
    margin: 20px 10px 16px 10px;
    padding: 20px 16px 16px 16px;
    border-radius: 16px;
  }
}

@media (max-width: 540px) {
  .chat-container {
    min-width: unset;
    max-width: 100vw;
    width: 100vw;
    border-radius: 0;
    margin: 0;
    padding: 16px 12px 12px 12px;
  }
}

.messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-row.user-row {
  flex-direction: row-reverse;
}

.message-icon {
  display: flex;
  align-items: center;
  font-size: 1.7rem;
  height: 38px;
  width: 38px;
  justify-content: center;
  color: var(--floward-gray);
  background: var(--floward-bg);
  border-radius: 50%;
  margin-bottom: 2px;
  box-shadow: 0 1px 4px rgba(0, 87, 92, 0.04);
}

.message-row.user-row .message-icon {
  color: var(--floward-white);
  background: var(--floward-teal);
}

.message.user {
  margin-left: auto;
  background: var(--floward-bubble-user);
  color: var(--floward-white);
  border-bottom-right-radius: 6px;
  border-top-right-radius: 20px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 87, 92, 0.08);
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
}

.message.system {
  margin-right: auto;
  background: var(--floward-bubble-system);
  color: var(--floward-bubble-system-text);
  border-bottom-left-radius: 6px;
  border-top-right-radius: 20px;
  border-top-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 87, 92, 0.04);
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
}

.message {
  max-width: 70%;
  padding: 14px 22px;
  line-height: 1.7;
  word-break: break-word;
  margin-bottom: 2px;
  transition: background 0.2s;
}

@media (max-width: 768px) {
  .message {
    max-width: 85%;
    padding: 12px 18px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .message {
    max-width: 90%;
    padding: 10px 16px;
    font-size: 0.8rem;
  }
}

.input-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 480px) {
  .input-row {
    gap: 8px;
  }
}

.chat-input {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: 1.5px solid #d0d6e1;
  font-size: 1rem;
  outline: none;
  transition: border 0.2s;
  font-family: 'Open Sans', Arial, sans-serif;
}

@media (max-width: 480px) {
  .chat-input {
    padding: 12px;
    font-size: 0.9rem;
  }
}

.chat-input:focus {
  border: 2px solid var(--floward-teal);
}

.send-btn {
  background: var(--floward-teal);
  color: var(--floward-white);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 87, 92, 0.15);
  flex-shrink: 0;
}

.send-btn .material-icons {
  font-size: 20px;
}

@media (max-width: 480px) {
  .send-btn {
    width: 44px;
    height: 44px;
  }

  .send-btn .material-icons {
    font-size: 18px;
  }
}

.send-btn:hover:not(:disabled) {
  background: #003c3f;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 87, 92, 0.25);
}

.send-btn:disabled {
  background: #bfc5ce;
  color: #fff;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(191, 197, 206, 0.15);
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 32px;
  background: var(--floward-bubble-system);
  color: var(--floward-bubble-system-text);
}

.typing-indicator .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--floward-gray);
  border-radius: 50%;
  opacity: 0.7;
  animation: typing-bounce 1.2s infinite both;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.7;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}
