html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* --- Chat UI ------------------------------------------------------------- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 230px);
  min-height: 360px;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  overflow: hidden;
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.chat-empty {
  text-align: center;
  margin-top: 2rem;
}

.chat-row {
  display: flex;
  margin-bottom: .5rem;
}

.chat-row-user {
  justify-content: flex-end;
}

.chat-row-assistant, .chat-row-error {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 75%;
  padding: .5rem .85rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

.chat-bubble-user {
  background-color: #0d6efd;
  color: #fff;
  border-bottom-right-radius: .25rem;
}

.chat-bubble-assistant {
  background-color: #fff;
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-bottom-left-radius: .25rem;
}

.chat-bubble-error {
  background-color: #f8d7da;
  color: #842029;
  border: 1px solid #f5c2c7;
}

.chat-input {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid var(--bs-border-color);
  background-color: #fff;
}

.chat-input textarea {
  resize: none;
  overflow-y: auto;
  max-height: 160px;
}

.chat-typing span {
  display: inline-block;
  width: .45rem;
  height: .45rem;
  margin: 0 .1rem;
  background-color: var(--bs-secondary-color, #6c757d);
  border-radius: 50%;
  animation: chat-typing-bounce 1.2s infinite ease-in-out both;
}

.chat-typing span:nth-child(1) { animation-delay: -.32s; }
.chat-typing span:nth-child(2) { animation-delay: -.16s; }

@keyframes chat-typing-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}