/* ============================================================
   ApiamAI — Custom Styles
   Brand palette: teal/green (veterinary/nature theme)
   ============================================================ */

:root {
  --brand-primary:    #00a8a2;
  --brand-dark:       #007a75;
  --brand-light:      #cceeee;
  --brand-accent:     #00c8c2;
  --user-bubble-bg:   #00a8a2;
  --user-bubble-text: #ffffff;
  --asst-bubble-bg:   #f0fbfb;
  --asst-bubble-text: #0d2e2d;
  --error-bubble-bg:  #fff3cd;
  --error-bubble-text:#856404;
  --chat-bg:          #f5fcfc;
  --input-area-bg:    #ffffff;
  --avatar-size:      36px;
  --bubble-radius:    1.25rem;
}

/* ── Base ── */
body {
  background-color: var(--chat-bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Navbar ── */
.bg-brand {
  background-color: var(--brand-primary) !important;
}

.brand-name {
  letter-spacing: 0.03em;
}

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.text-brand-light {
  color: var(--brand-light) !important;
  opacity: 0.85;
}

/* ── Chat container (fills remaining height) ── */
.chat-container {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

/* ── Chat window (scrollable) ── */
.chat-window {
  overflow-y: auto;
  scroll-behavior: smooth;
  min-height: 0;
  padding-right: 12px;
}

/* ── Message rows ── */
.message-row {
  max-width: 100%;
}

/* ── Avatar ── */
.avatar-icon {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  background-color: var(--brand-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
  padding: 4px;
}

.avatar-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Bubbles ── */
.message-bubble {
  max-width: min(75%, 640px);
  padding: 0.65rem 1rem;
  border-radius: var(--bubble-radius);
  line-height: 1.55;
  word-break: break-word;
}

.user-bubble {
  background-color: var(--user-bubble-bg);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 0.3rem;
}

.assistant-bubble {
  background-color: var(--asst-bubble-bg);
  color: var(--asst-bubble-text);
  border-bottom-left-radius: 0.3rem;
  border: 1px solid #99d9d8;
}

.error-bubble {
  background-color: var(--error-bubble-bg);
  color: var(--error-bubble-text);
  border: 1px solid #ffd970;
  border-bottom-left-radius: 0.3rem;
}

/* ── Typing indicator ── */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.75rem 1rem;
  min-width: 56px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--brand-accent);
  animation: dot_bounce 1.2s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: 0s;    }
.dot:nth-child(2) { animation-delay: 0.2s;  }
.dot:nth-child(3) { animation-delay: 0.4s;  }

@keyframes dot_bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1.1); opacity: 1;   }
}

/* ── Input area ── */
.input-area {
  background-color: var(--input-area-bg);
  flex-shrink: 0;
}

.chat-input {
  resize: none;
  border-color: #99d9d8;
  border-radius: 0.75rem !important;
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}

.chat-input:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 0.2rem rgba(0, 168, 162, 0.2);
}

.chat-input:disabled {
  background-color: #f0f0f0;
}

/* ── Send button ── */
.btn-brand {
  background-color: var(--brand-primary);
  color: #fff;
  border-radius: 0.75rem !important;
  border: none;
  padding: 0.5rem 1rem;
  transition: background-color 0.15s ease;
  align-self: flex-end;
}

.btn-brand:hover:not(:disabled) {
  background-color: var(--brand-dark);
  color: #fff;
}

.btn-brand:disabled {
  background-color: #66c4c0;
  color: #fff;
}

/* ── Disclaimer ── */
.disclaimer {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ── Scrollbar (webkit) ── */
.chat-window::-webkit-scrollbar {
  width: 4px;
}

.chat-window::-webkit-scrollbar-track {
  background: transparent;
}

.chat-window::-webkit-scrollbar-thumb {
  background-color: #99d9d8;
  border-radius: 10px;
  opacity: 0.4;
}

.chat-window::-webkit-scrollbar-thumb:hover {
  background-color: var(--brand-accent);
}

/* Firefox */
.chat-window {
  scrollbar-width: thin;
  scrollbar-color: #99d9d8 transparent;
}
