:root {
  --bimont-teal: #006d77;
  --bimont-teal-dark: #004f56;
  --bimont-teal-mid: #0d8790;
  --bimont-teal-soft: #e8f4f3;
  --bimont-aqua: #8fd3cf;
  --bimont-cream: #fbf7ee;
  --bimont-paper: #ffffff;
  --bimont-ink: #1f3437;
  --bimont-muted: #667b7d;
  --bimont-gold: #d7a94b;
  --bimont-user: #e7f2fb;
  --bimont-shadow: rgba(0, 79, 86, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: transparent;
  color: var(--bimont-ink);
}

#chatbox {
  width: 100%;
  height: calc(100vh - 40px);
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top right, rgba(143, 211, 207, 0.24), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, var(--bimont-cream) 100%);
  overflow: hidden;
}

#chat-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background:
    linear-gradient(135deg, var(--bimont-teal), var(--bimont-teal-dark));
  color: white;
  flex-shrink: 0;
  border-bottom: 4px solid rgba(215, 169, 75, 0.76);
  box-shadow: 0 8px 20px rgba(0, 79, 86, 0.18);
}

.eco-avatar {
  flex: 0 0 auto;
}

.eco-avatar img {
  width: 162px;
  max-width: 34vw;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 12px;
  background: white;
  padding: 7px 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.title {
  font-size: 1.28em;
  font-weight: 850;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.subtitle {
  margin-top: 3px;
  font-size: 0.88em;
  line-height: 1.28;
  color: rgba(255, 255, 255, 0.92);
  max-width: 760px;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  padding-bottom: 88px;
  box-sizing: border-box;
  height: calc(100vh - 130px);
}

.system-note {
  max-width: 900px;
  margin: 0 0 16px 0;
  padding: 11px 13px;
  color: var(--bimont-muted);
  background: rgba(232, 244, 243, 0.86);
  border: 1px solid rgba(0, 109, 119, 0.14);
  border-radius: 15px;
  font-size: 0.83em;
  line-height: 1.38;
}

.message {
  margin-bottom: 18px;
  padding: 13px 15px;
  border-radius: 18px;
  max-width: 86%;
  line-height: 1.46;
  box-shadow: 0 7px 20px var(--bimont-shadow);
}

.from-user {
  margin-left: auto;
  background: var(--bimont-user);
  color: #1f3437;
  border: 1px solid rgba(0, 109, 119, 0.08);
  border-bottom-right-radius: 6px;
}

.from-bot {
  margin-right: auto;
  background: #ffffff;
  color: var(--bimont-ink);
  border-left: 5px solid var(--bimont-teal);
  border-bottom-left-radius: 6px;
}

.from-bot h3 {
  margin: 0 0 8px 0;
  color: var(--bimont-teal-dark);
}

.from-bot h4 {
  margin: 0 0 6px 0;
  color: var(--bimont-teal-dark);
}

.from-bot p {
  margin: 0 0 8px 0;
}

.from-bot ul,
.from-bot ol {
  margin: 6px 0 6px 22px;
  padding: 0;
}

.from-bot li {
  margin: 4px 0;
}

#chat-input {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;

  display: flex;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(0, 109, 119, 0.15);
  box-shadow: 0 -8px 22px rgba(0, 79, 86, 0.08);
  flex-shrink: 0;
  z-index: 20;
  backdrop-filter: blur(9px);
}

#user-input {
  flex: 1;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 109, 119, 0.22);
  font-size: 1em;
  background: white;
  color: var(--bimont-ink);
  outline: none;
}

#user-input::placeholder {
  color: rgba(102, 123, 125, 0.78);
}

#user-input:focus {
  border-color: var(--bimont-teal);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.12);
}

#btn-send {
  background: var(--bimont-teal);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(0, 109, 119, 0.24);
}

#btn-send:hover {
  background: var(--bimont-teal-dark);
}

.typing {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0;
  font-size: 0.9em;
  color: var(--bimont-muted);
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

.typing.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.typing-avatar {
  width: 90px;
  height: auto;
  border-radius: 10px;
  background: white;
  padding: 4px 6px;
  animation: pulse 1.2s infinite ease-in-out;
}

.eco-avatar img.typing {
  animation: ecoPulse 1s infinite alternate ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: .55; }
  50% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); opacity: .55; }
}

@keyframes ecoPulse {
  0% { transform: scale(1); opacity: .80; }
  100% { transform: scale(1.03); opacity: 1; }
}

@media (max-width: 760px) {
  #chatbox {
    height: calc(100vh - 20px);
  }

  #chat-header {
    padding: 13px;
    align-items: flex-start;
  }

  .eco-avatar img {
    width: 126px;
    max-width: 42vw;
    border-radius: 10px;
  }

  .title {
    font-size: 1.12em;
  }

  .subtitle {
    font-size: 0.78em;
  }

  #chat-messages {
    padding: 12px;
    padding-bottom: 88px;
  }

  .message {
    max-width: 92%;
  }

  #btn-send {
    padding: 12px 15px;
  }

  .typing-avatar {
    width: 78px;
  }
}
