/* =========================================
   AI Chat (compact + fullscreen)
   Drop-in replacement
   ========================================= */

/* Container */
.ai-chat {
  border: 1px solid var(--bs-border-color, #e5e7eb);
  border-radius: 16px;
  overflow: hidden;
}

.ai-chat--standalone .ai-chat__toggle {
  cursor: default;
}

.ai-chat--standalone .ai-chat__collapse {
  min-height: 620px;
}

.ai-chat--standalone .ai-chat__body {
  min-height: 620px;
}

/* Subtle placeholder styling */
textarea.ai-chat__input::placeholder {
  font-size: 0.65rem;
  color: var(--bs-secondary-color, #6c757d);
  opacity: 0.7;
}
/* vendor fallbacks */
textarea.form-control.ai-chat__input::-webkit-input-placeholder {
  font-size: 0.75rem;
  color: rgba(108,117,125,.85);
}
textarea.form-control.ai-chat__input::-moz-placeholder {
  font-size: 0.75rem;
  color: rgba(108,117,125,.85);
}
textarea.form-control.ai-chat__input:-ms-input-placeholder {
  font-size: 0.75rem;
  color: #6c757d;
}

/* Toggle bar (collapsed header) */
.ai-chat__toggle {
  background: var(--bs-body-bg);
  padding: .8rem 1rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--bs-border-color, #e5e7eb);

  /* shared base */
  border-radius: 0.5rem 0.5rem 0 0;
  transition: background 0.3s ease;
  color: var(--bs-body-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ai-chat__toggle:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}
.ai-chat__chevron { transition: transform .2s ease; }
.ai-chat__toggle[aria-expanded="true"] .ai-chat__chevron { transform: rotate(180deg); }
.ai-chat__spark { opacity: .9; }

/* Keep the active answer scope visible in compact and fullscreen modes. */
.ai-chat__identity-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.ai-chat__identity {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  min-width: 0;
}

.ai-chat__identity-title,
.ai-chat__scope-separator {
  flex: 0 0 auto;
}

.ai-chat__scope-separator {
  color: var(--bs-secondary-color, #6c757d);
}

.ai-chat__scope-name {
  min-width: 0;
  max-width: min(42vw, 28rem);
  overflow: hidden;
  color: var(--bs-secondary-color, #6c757d);
  font-size: .9rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat__header-actions {
  flex: 0 0 auto;
}

@media (max-width: 575.98px) {
  .ai-chat__scope-name {
    max-width: 34vw;
    font-size: .8rem;
  }
}

/* Collapsible area */
.ai-chat__collapse {
  /* Bootstrap collapse handles show/hide */
}

/* Body */
.ai-chat__body {
  background: var(--bs-tertiary-bg, #f8f9fa);
  padding: 1rem;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;  /* critical for nested flex scrolling */
}

/* Top bar inside body */
.ai-chat__topbar {
  --ai-chat-option-control-height: 2.4rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.ai-chat__session-controls,
.ai-chat__session-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
}

.ai-chat:not(.ai-chat--fullscreen) .ai-chat__session-controls {
  display: none;
}

.ai-chat__topbar-controls {
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Main (history + chat columns) */
.ai-chat__main {
  flex: 1 1 auto;     /* fill remaining height */
  min-height: 0;      /* allow children to scroll */
  display: flex;
  gap: .75rem;
}

/* History panel (sidebar) */
.ai-chat__history {
  flex: 0 0 280px;
  max-width: 280px;
  min-width: 240px;
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  background: var(--bs-body-bg);
  overflow: hidden;

  transition: opacity .15s ease, transform .15s ease;
}

.ai-chat__history-inner {
  padding: .75rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ai-chat__history-list {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  border-radius: 10px;
}

.ai-chat__history-list .list-group-item.active {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-body-color);
  border-color: var(--bs-primary-border-subtle);
}

.ai-chat__history-item {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: 0;
}

.ai-chat__history-load {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: var(--bs-list-group-item-padding-y, .5rem) .25rem
    var(--bs-list-group-item-padding-y, .5rem)
    var(--bs-list-group-item-padding-x, 1rem);
}

.ai-chat__history-load:focus-visible,
.ai-chat__history-actions:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

.ai-chat__history-actions {
  flex: 0 0 auto;
  opacity: 0;
  pointer-events: none;
  margin-right: .25rem;
  color: inherit;
  transition: opacity .12s ease;
}

.ai-chat__history-item:hover .ai-chat__history-actions,
.ai-chat__history-item:focus-within .ai-chat__history-actions,
.ai-chat__history-item.ai-chat__history-item--actions-visible .ai-chat__history-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Chat column */
.ai-chat__chatcol {
  flex: 1 1 auto;
  min-width: 0;       /* prevents overflow into history column */
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Conversation log */
.ai-chat__log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;

  padding: .25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;

  /* The footer occupies its own flex row below the scrolling log. */
  padding-bottom: .5rem;
}

/* Keep compact mode reasonable */
.ai-chat:not(.ai-chat--fullscreen) .ai-chat__log {
  max-height: 48vh;
}
@media (min-width: 768px) {
  .ai-chat:not(.ai-chat--fullscreen) .ai-chat__log {
    max-height: 70vh;
  }
}
@media (min-width: 1200px) {
  .ai-chat:not(.ai-chat--fullscreen) .ai-chat__log {
    max-height: 80vh;
  }
}

/* Messages */
.ai-chat__msg {
  display: flex;
  width: 100%;
}
.ai-chat__msg--user { justify-content: flex-end; }
.ai-chat__msg--assistant {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
}
.ai-chat__msg--system { justify-content: center; }

.ai-chat__bubble {
  max-width: min(780px, 100%);
  border: 1px solid var(--bs-border-color, #e5e7eb);
  border-radius: 16px;
  padding: .65rem .8rem;
  box-shadow: 0 3px 12px rgba(0,0,0,.04);
  line-height: 1.45;

  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

/* Wider bubbles on wide screens */
@media (min-width: 992px) {
  .ai-chat__bubble { max-width: min(1100px, 96%); }
}

/* System bubble cap so it doesn't feel like it spans under history */
.ai-chat__msg--system .ai-chat__bubble {
  max-width: min(700px, 92%);
}

.ai-chat__bubble:has(.ai-thinking) {
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.ai-chat__msg--user .ai-chat__bubble {
  border-color: var(--bs-primary-border-subtle, #dbe4ff);
}
.ai-chat__msg--assistant .ai-chat__bubble {
  background: var(--bs-body-bg, #fff);
}

.ai-chat__citation {
  color: var(--bs-link-color);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.ai-chat__citation:hover,
.ai-chat__citation:focus {
  text-decoration: underline;
}

.ai-chat__sources {
  width: min(1100px, 96%);
  margin-top: .45rem;
  padding: .6rem .7rem;
  border: 1px solid var(--bs-border-color, #e5e7eb);
  border-radius: 12px;
  background: var(--bs-tertiary-bg, #f8f9fa);
}

.ai-chat__sources-title {
  margin-bottom: .4rem;
  color: var(--bs-secondary-color, #6c757d);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.ai-chat__source {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  padding: .35rem 0;
  scroll-margin-top: 1rem;
}

.ai-chat__source + .ai-chat__source {
  border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, .08));
}

.ai-chat__source:target {
  border-radius: 6px;
  background: var(--bs-primary-bg-subtle, #cfe2ff);
}

.ai-chat__source-number {
  flex: 0 0 auto;
  color: var(--bs-primary);
  font-size: .8rem;
  font-weight: 700;
}

.ai-chat__source-copy {
  min-width: 0;
}

.ai-chat__source-link {
  display: block;
  overflow-wrap: anywhere;
  font-size: .85rem;
  font-weight: 600;
}

.ai-chat__source-meta {
  color: var(--bs-secondary-color, #6c757d);
  font-size: .75rem;
  line-height: 1.3;
}

.ai-chat__msg--assistant .formatted-ai-response {
  line-height: 1.3;
  white-space: normal;
}

.ai-chat__msg--assistant .formatted-ai-response br + br {
  display: block;
  content: "";
  margin-top: .65rem;
}

.ai-chat__msg--assistant .formatted-ai-response p,
.ai-chat__msg--assistant .formatted-ai-response ul,
.ai-chat__msg--assistant .formatted-ai-response ol {
  margin-top: 0;
  margin-bottom: .65rem;
}

.ai-chat__msg--assistant .formatted-ai-response p:last-child,
.ai-chat__msg--assistant .formatted-ai-response ul:last-child,
.ai-chat__msg--assistant .formatted-ai-response ol:last-child {
  margin-bottom: 0;
}

.ai-chat__msg--assistant .formatted-ai-response ul,
.ai-chat__msg--assistant .formatted-ai-response ol {
  padding-left: 1.25rem;
}

.ai-chat__msg--assistant .formatted-ai-response li {
  margin-bottom: 0;
}

.ai-chat__msg--assistant .formatted-ai-response li:last-child {
  margin-bottom: 0;
}

/* Footer (composer + disclaimer) — sticky at bottom */
.ai-chat__footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding-top: 0.5rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-top: 1px solid var(--bs-border-color);
}

.ai-chat__usage {
  line-height: 1.3;
}

#aiChatUsageHint:empty {
  display: none;
}

/* Composer */
.ai-chat__composer {
  flex: 0 0 auto;
  position: static;
  border-top: 0;
  margin-top: 0;
  background: transparent;
}

.ai-chat__inputwrap {
  display: flex;
  flex-wrap: nowrap;
  gap: .5rem;
  align-items: flex-end;
}

.ai-chat__input {
  flex: 1 1 0;
  min-width: 0;
  resize: none;
  min-height: 40px;
  max-height: 280px;
  box-shadow: none !important;
}

.ai-chat__toolbar {
  display: flex;
  flex: 0 0 auto;
  gap: .5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.ai-chat__toolbar .btn {
  min-height: 40px;
  white-space: nowrap;
}

.ai-chat__location-control {
  min-width: 0;
}

/* Disclaimer */
.ai-chat__disclaimer {
  font-size: 0.75rem;
  opacity: 0.85;
  line-height: 1.2;
  padding: 0.25rem 0.1rem 0.25rem;
}

/* Subtle scrollbars on WebKit */
.ai-chat__log::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.ai-chat__log::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.15);
  border-radius: 8px;
}

/* Toggle bar gradients */
:root {
  --ai-chat-subtle-gradient: linear-gradient(135deg, #f8f9fa, #e9ecef);
  --ai-chat-accent-gradient: linear-gradient(
    135deg,
    var(--bs-primary-bg-subtle),
    var(--bs-info-bg-subtle)
  );
}
[data-bs-theme="dark"] {
  --ai-chat-subtle-gradient: linear-gradient(135deg, #343a40, #212529);
  --ai-chat-accent-gradient: linear-gradient(
    135deg,
    var(--bs-primary),
    var(--bs-info)
  );
}

.ai-chat__toggle--subtle { background: var(--ai-chat-subtle-gradient); }
.ai-chat__toggle--accented { background: var(--ai-chat-accent-gradient); }

.ai-chat__toggle:hover,
.ai-chat__toggle:focus {
  filter: brightness(1.1);
}

.ai-chat__toggle strong,
.ai-chat__toggle small,
.ai-chat__toggle svg {
  color: var(--bs-body-color);
}

/* Thinking dots */
.ai-thinking {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1;
}
.ai-thinking__label {
  line-height: 1.25;
  color: var(--bs-secondary-color, #6c757d);
  white-space: normal;
}
.ai-thinking__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #6c757d;
  opacity: 0.4;
  animation: aiThinkingBlink 1.2s infinite;
}
.ai-thinking__dot + .ai-thinking__dot { animation-delay: 0.2s; }
.ai-thinking__dot + .ai-thinking__dot + .ai-thinking__dot { animation-delay: 0.4s; }

@keyframes aiThinkingBlink {
  0%, 80%, 100% { opacity: 0.4; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* =========================================
   Fullscreen
   ========================================= */

/* Fullscreen base — pinned to viewport with small gutter */
.ai-chat--fullscreen {
  position: fixed;
  inset: 1rem;            /* change to .5rem for “almost edge-to-edge” */
  z-index: 1080;

  width: auto;
  height: auto;
  max-width: none;
  margin: 0;

  border-radius: 1.25rem !important;
  overflow: hidden;

  transform: translateY(8px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.ai-chat--fullscreen .ai-chat__collapse,
.ai-chat--fullscreen .ai-chat__body {
  height: 100%;
  min-height: 0;
}

/* Active fullscreen (visible) */
.ai-chat--fullscreen.ai-chat--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Body locked while fullscreen */
body.ai-chat-fullscreen-open { overflow: hidden; }

/* Overlay behind chat */
.ai-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1079;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.95));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease-out, visibility 0.18s ease-out;
}
.ai-chat-overlay.ai-chat-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* Fullscreen body padding */
.ai-chat--fullscreen .ai-chat__body {
  padding: 0.75rem 1rem 0.75rem;
}

/* Header behaves like titlebar in fullscreen */
.ai-chat--fullscreen .ai-chat__toggle { cursor: default; }

/* Fullscreen: log uses flex sizing, not vh caps */
.ai-chat--fullscreen .ai-chat__log {
  max-height: none;
}

/* On small screens: stack history above chat */
@media (max-width: 576px) {
  .ai-chat--fullscreen { inset: .5rem; }
  .ai-chat__main { flex-direction: column; }
  .ai-chat__history { max-width: 100%; flex-basis: auto; }

  .ai-chat--fullscreen #aiChatHistory.show {
    flex: 0 0 auto;
    max-height: min(42vh, 20rem);
  }

  .ai-chat--fullscreen #aiChatHistory.show .ai-chat__history-inner {
    max-height: min(42vh, 20rem);
  }
}

/* =========================================
   History / New buttons only in fullscreen
   ========================================= */

/* History UI hidden by default */
#aiChatHistoryToggle,
#aiChatHistory { display: none; }

/* New chat button hidden by default */
#aiChatNewChatBtn { display: none; }

/* Show only in fullscreen */
.ai-chat--fullscreen #aiChatHistoryToggle { display: block; }

.ai-chat--fullscreen #aiChatNewChatBtn { display: inline-flex; }

/* History should not reserve layout space when collapsed. */
.ai-chat--fullscreen #aiChatHistory:not(.show) {
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}

.ai-chat--fullscreen #aiChatHistory.show {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

/* RAG toggle hidden by default (compact mode) */
.ai-chat__rag-mode {
  --ai-mode-accent: #2563eb;
  --ai-mode-accent-end: #4f46e5;
  --ai-mode-border: #93c5fd;
  --ai-mode-bg: #eff6ff;
  --ai-mode-text: #1e40af;
  display: none;
  align-items: center;
  gap: .12rem;
  padding: .2rem;
  border: 1px solid var(--ai-mode-border);
  border-radius: .58rem;
  background: var(--ai-mode-bg);
  box-shadow: 0 2px 8px rgba(30, 64, 175, .12);
}
/* Only show in fullscreen mode */
.ai-chat--fullscreen .ai-chat__rag-mode {
  display: inline-flex;
}

.ai-chat__rag-mode .btn {
  margin-left: 0 !important;
  padding: .35rem .52rem;
  border: 0 !important;
  border-radius: .4rem !important;
  background: transparent;
  color: var(--ai-mode-text);
  font-size: .7rem;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.ai-chat__rag-mode .btn:hover {
  background: rgba(37, 99, 235, .1);
  color: var(--ai-mode-text);
}

.ai-chat__rag-mode .btn-check:checked + .btn {
  background: linear-gradient(135deg, var(--ai-mode-accent), var(--ai-mode-accent-end));
  color: #fff;
  box-shadow: 0 2px 5px rgba(30, 64, 175, .28);
}

.ai-chat__rag-mode .btn-check:focus-visible + .btn {
  box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .24);
}

.ai-chat__interest-scope {
  --ai-scope-accent: var(--bs-success, #198754);
  --ai-scope-border: var(--bs-success-border-subtle, #a3cfbb);
  --ai-scope-bg: color-mix(
    in srgb,
    var(--bs-success-bg-subtle, #d1e7dd) 65%,
    var(--bs-body-bg, #fff)
  );
  --ai-scope-text: var(--bs-success-text-emphasis, #0a3622);
  padding: .22rem .35rem .22rem .45rem;
  border: 1px solid var(--ai-scope-border);
  border-left-width: .25rem;
  border-radius: .58rem;
  background: var(--ai-scope-bg);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ai-scope-accent) 12%, transparent);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.ai-chat__rag-mode,
.ai-chat__interest-scope {
  box-sizing: border-box;
  height: var(--ai-chat-option-control-height, 2.4rem);
}

.ai-chat__interest-scope[data-interest-scope="all_accessible"] {
  --ai-scope-accent: #0f766e;
  --ai-scope-border: #14b8a6;
  --ai-scope-bg: #f0fdfa;
  --ai-scope-text: #115e59;
  box-shadow: 0 2px 8px rgba(15, 118, 110, .14);
}

.ai-chat__interest-scope-label {
  display: flex;
  flex-direction: column;
  color: var(--ai-scope-text);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .045em;
  line-height: 1.05;
  text-transform: uppercase;
}

.ai-chat__interest-scope-hint {
  margin-top: .08rem;
  color: var(--ai-scope-text);
  font-size: .54rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.05;
  opacity: .72;
  text-transform: none;
}

.ai-chat__interest-scope .form-select {
  min-width: 10.75rem;
  min-height: 1.75rem;
  width: auto;
  padding: .18rem 1.75rem .18rem .45rem;
  border-color: var(--ai-scope-border);
  background-color: var(--bs-body-bg, #fff);
  background-position: right .45rem center;
  background-size: 12px 9px;
  color: var(--ai-scope-text);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.15;
}

.ai-chat__interest-scope .form-select:focus {
  border-color: var(--ai-scope-accent);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--ai-scope-accent) 22%, transparent);
}

@media (max-width: 575.98px) {
  .ai-chat--fullscreen .ai-chat__body {
    padding: .5rem .625rem .375rem;
  }

  /* Keep the selectors grouped on desktop, but share the actions row on mobile. */
  .ai-chat--fullscreen .ai-chat__topbar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ai-chat--fullscreen .ai-chat__topbar-controls {
    display: contents !important;
  }

  .ai-chat--fullscreen .ai-chat__rag-mode {
    justify-self: end;
  }

  .ai-chat__interest-scope {
    grid-column: 1 / -1;
  }

  .ai-chat__session-actions,
  .ai-chat__inputwrap,
  .ai-chat__toolbar {
    gap: .375rem;
  }

  .ai-chat__session-actions .btn {
    padding-inline: .4rem;
    font-size: .8rem;
  }

  .ai-chat__rag-mode .btn {
    padding-inline: .35rem;
  }

  .ai-chat__help {
    margin-block: .25rem !important;
    gap: .25rem !important;
  }

  .ai-chat__topbar-controls,
  .ai-chat__interest-scope {
    width: 100%;
  }

  /* The select has its own accessible label; leave room for the option text. */
  .ai-chat__interest-scope-label {
    display: none;
  }

  .ai-chat__interest-scope .form-select {
    flex: 1 1 auto;
    min-width: 0;
  }
}

[data-bs-theme="dark"] .ai-chat__interest-scope[data-interest-scope="all_accessible"] {
  --ai-scope-border: #2dd4bf;
  --ai-scope-bg: rgba(19, 78, 74, .55);
  --ai-scope-text: #ccfbf1;
}

[data-bs-theme="dark"] .ai-chat__interest-scope .form-select {
  background-color: rgba(15, 23, 42, .88);
  color: var(--ai-scope-text);
}

[data-bs-theme="dark"] .ai-chat__rag-mode {
  --ai-mode-accent: #2563eb;
  --ai-mode-accent-end: #6366f1;
  --ai-mode-border: #60a5fa;
  --ai-mode-bg: rgba(30, 58, 138, .35);
  --ai-mode-text: #dbeafe;
}

[data-bs-theme="dark"] .ai-chat__rag-mode .btn:hover {
  background: rgba(96, 165, 250, .16);
}


/* =========================================
   Theme-specific fullscreen polish
   ========================================= */

[data-bs-theme="dark"] .ai-chat--fullscreen {
  background: radial-gradient(circle at top left, #0f172a 0, #020617 40%, #111827 100%);
  color: #f9fafb;
  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.85),
    0 0 0 1px rgba(148, 163, 184, 0.25);
}

[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__toggle {
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  padding-inline: 1rem;
  padding-block: 0.6rem;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.9), rgba(30, 64, 175, 0.85));
  color: #e5e7eb;
}

[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__bubble {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.6);
}

[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__input {
  background-color: rgba(15, 23, 42, 0.95);
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__toolbar .btn-outline-secondary {
  border-color: rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
  background-color: transparent;
}
[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__toolbar .btn-outline-secondary:hover {
  background-color: rgba(148, 163, 184, 0.15);
}

[data-bs-theme="dark"] .ai-chat--fullscreen .ai-chat__fullscreen-toggle {
  border-color: rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
  background-color: transparent;
}

[data-bs-theme="dark"] .ai-chat--fullscreen .text-secondary,
[data-bs-theme="dark"] .ai-chat--fullscreen small {
  color: rgba(209, 213, 219, 0.85) !important;
}

[data-bs-theme="light"] .ai-chat--fullscreen {
  background: radial-gradient(circle at top left,
    rgba(255, 255, 255, 0.96) 0,
    rgba(248, 250, 252, 0.98) 45%,
    rgba(241, 245, 249, 1) 100%);
  color: #0f172a;
  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.28),
    0 0 0 1px rgba(148, 163, 184, 0.18);
}

[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__toggle {
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  padding-inline: 1rem;
  padding-block: 0.6rem;
  background: linear-gradient(90deg, #ffffff, #eff6ff);
  color: #0f172a;
}

[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__bubble {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.10);
}

[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__input {
  background-color: #ffffff;
  border-color: rgba(148, 163, 184, 0.6);
  color: #0f172a;
}
[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__input::placeholder {
  color: rgba(100, 116, 139, 0.9);
}

[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__toolbar .btn-outline-secondary {
  border-color: rgba(148, 163, 184, 0.85);
  color: #334155;
  background-color: rgba(248, 250, 252, 0.9);
}
[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__toolbar .btn-outline-secondary:hover {
  background-color: rgba(226, 232, 240, 0.95);
}

[data-bs-theme="light"] .ai-chat--fullscreen .ai-chat__fullscreen-toggle {
  border-color: rgba(148, 163, 184, 0.75);
  color: #334155;
  background-color: rgba(248, 250, 252, 0.95);
}

[data-bs-theme="light"] .ai-chat--fullscreen .text-secondary,
[data-bs-theme="light"] .ai-chat--fullscreen small {
  color: rgba(100, 116, 139, 0.95) !important;
}

/* Exact calendar rows live outside the prose bubble, like citation cards. */
.ai-chat__calendar {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--bs-border-color, #d9dee3);
  border-radius: 0.6rem;
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #212529);
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}
.ai-chat__calendar-heading, .ai-chat__calendar-title { font-weight: 600; }
.ai-chat__calendar-meta { font-size: 0.8rem; opacity: 0.8; }
.ai-chat__calendar-day { margin: 1rem 0 0.4rem; font-size: 0.95rem; font-weight: 600; }
.ai-chat__calendar-event { padding: 0.6rem 0; border-bottom: 1px solid var(--bs-border-color, #d9dee3); }
.ai-chat__calendar-origins, .ai-chat__calendar-controls { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; }
.ai-chat__calendar-origins { margin-top: 0.25rem; font-size: 0.8rem; }
.ai-chat__calendar-controls { margin-top: 0.9rem; }
