/* ── Fix the main column so sidebars can scroll independently ────────────── */

body.controller_annie .main-content {
  /* position/width/left applied by annie.js after measuring natural layout */
  height: 100dvh;
  overflow: hidden;
  padding: 1rem;
  box-sizing: border-box;
}

#annie-history-toggle {
  cursor: pointer;
}

#annie-history-toggle:hover .annie-face {
  background-color: var(--bs-primary);
  border-radius: 100px;
}
#annie-history-toggle .annie-name {
  border-bottom: 4px solid #00000000;
}
#annie-history-toggle:hover .annie-name {
  border-bottom: 4px solid var(--bs-body-color);
}


/* Remove Bootstrap's default dropdown padding to eliminate gaps */
#annie-history-dropdown {
  padding: 0;
  gap: 0;
  border-radius: 0;
}

/* Remove spacing from list items */
#annie-history-dropdown li {
  margin: 0;
  padding: 0;
}

/* Ensure dropdown items fully fill the width */
#annie-history-dropdown .dropdown-item {
  padding: 10px 20px;
}
#annie-history-dropdown .dropdown-item.active button {
  color: white !important;
}


/* ── Chat layout ─────────────────────────────────────────────────────────── */

.annie-chat {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.annie-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
  /* Height is set dynamically by annie.js based on available viewport space */
}

/* Align user messages right, assistant messages left */
.annie-message {
  display: flex;
}

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

.annie-message--assistant {
  justify-content: flex-start;
}

#annie-send {
  border-radius: 0 8px 8px 0;
}

.annie-bubble {
  max-width: 80%;
  padding: 0.5rem 0.85rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.annie-message--user .annie-bubble {
  background: var(--bs-primary);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.annie-message--assistant .annie-bubble {
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
  border-bottom-left-radius: 0.25rem;
}

/* System messages (centered, gentle warnings) */
.annie-message--system {
  justify-content: center;
  margin: 0.5rem 0;
}

.annie-message--system .annie-bubble {
  background: transparent;
  max-width: 90%;
  font-style: italic;
  padding: 0.4rem 0.75rem;
}

/* Typing indicator: three bouncing dots */
.annie-bubble--typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 1rem;
}

.annie-bubble--typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bs-secondary-color);
  animation: annie-bounce 1.2s infinite ease-in-out;
}

.annie-bubble--typing span:nth-child(2) { animation-delay: 0.2s; }
.annie-bubble--typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes annie-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* Textarea grows but stays reasonable */
.annie-form textarea {
  resize: none;
  overflow-y: hidden;
  min-height: 2.5rem;
}

/* Wrapper that provides the focus highlight around the whole input group */
.annie-input-wrap {
  padding: 3px;
  border-radius: 0.8rem;
  background: transparent;
  transition: background 0.15s ease;
}

.annie-input-wrap:focus-within {
  /* background: var(--bs-secondary-bg); */
  box-shadow: 5px 9px 3px #ccc;
}

/* Suppress Bootstrap's per-element focus ring since the wrapper handles it */
.annie-form .input-group textarea:focus,
.annie-form .input-group button:focus {
  box-shadow: none;
  outline: none;
}

.annie-face {
  border-radius: 100px;
}

/* ── Edit button (visible on user message hover) ─────────────────────────── */

.annie-edit-btn {
  opacity: 0;
  transition: opacity 0.15s ease;
  align-self: center;
  margin-right: 0.4rem;
  padding: 0.2rem 0.35rem;
  background: none;
  border: none;
  border-radius: 0.4rem;
  color: var(--bs-secondary-color);
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.annie-message--user:hover .annie-edit-btn {
  opacity: 1;
}

.annie-edit-btn:hover {
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

/* ── Inline edit container ────────────────────────────────────────────────── */

.annie-edit-container {
  max-width: 80%;
  display: flex;
  flex-direction: column;
}

.annie-edit-textarea {
  min-height: 2.5rem;
  resize: none;
  font-size: inherit;
  line-height: 1.45;
}

.annie-edit-actions {
  justify-content: flex-end;
}

#linksCollapse {
  z-index: 10;
}