* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Arial, sans-serif;
  background: transparent;
}

#chat-widget {
  width: 100%;
  max-width: 420px;
  height: 100vh;
  max-height: 720px;
  margin-left: auto;
  background: #ffffff;
  border-left: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 18px rgba(0, 0, 0, 0.12);
}

#chat-header {
  padding: 16px;
  background: #003366;
  color: white;
}

#chat-header strong {
  display: block;
  font-size: 16px;
}

#chat-header span {
  display: block;
  font-size: 12px;
  opacity: 0.85;
  margin-top: 3px;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
}

.message {
  display: flex;
  margin-bottom: 12px;
}

.message.user {
  justify-content: flex-end;
}

.message.bot {
  justify-content: flex-start;
}

.bubble {
  max-width: 85%;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}

.message.user .bubble {
  background: #003366;
  color: white;
  border-bottom-right-radius: 4px;
}

.message.bot .bubble {
  background: white;
  color: #222;
  border: 1px solid #e1e1e1;
  border-bottom-left-radius: 4px;
}

.bubble p {
  margin: 0 0 8px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

#chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: white;
  border-top: 1px solid #ddd;
}

#message {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

#message:focus {
  border-color: #003366;
}

#send-button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #003366;
  color: white;
  font-size: 17px;
  cursor: pointer;
}

#send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.loading-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: #777;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  #chat-widget {
    max-width: none;
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-left: none;
  }

  .bubble {
    max-width: 92%;
    font-size: 14px;
  }
}