/* Outside AI Dock: body-level, next to the modal */
.ai-dock {
  position: fixed;
  z-index: 1060; /* Above Bootstrap modal (1055) */
  width: var(--ai-dock-width, 420px);
  max-width: min(90vw, 480px);
  background: #fff;
  border: 1px solid #dee2e6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  border-radius: 0.5rem;
  overflow: auto; /* Only scroll if content exceeds available height */
  opacity: 0;
  transform: translateX(
    12px
  ); /* default slide-in from the side; will be flipped for left side */
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
  pointer-events: none; /* disabled while hidden */
}

/* Become interactive and slide in */
.ai-dock.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Tweak when dock is on the left side (flip slide direction) */
.ai-dock.left {
  transform: translateX(-12px);
}
.ai-dock.left.show {
  transform: translateX(0);
}

/* Dock header/footer/body (reuse previous look) */
.ai-dock-header,
.ai-dock-footer {
  padding: 0.75rem 1rem;
  background: #fff;
}
.ai-dock-header {
  border-bottom: 1px solid #e9ecef;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}
.ai-dock-footer {
  border-top: 1px solid #e9ecef;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}
.ai-dock-body {
  padding: 1rem;
}

/* Helpers reused */
#aiPreview {
  min-height: 160px;
  max-height: 40vh; /* internal guard; JS will expand the dock to reduce scroll need */
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  background: #fafafa;
  white-space: pre-wrap;
  overflow-y: auto;
}
.ai-chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 6px 2px 0;
  background: #eef2ff;
  color: #1e3a8a;
  border-radius: 999px;
  font-size: 12px;
}
.spinner-inline {
  width: 1rem;
  height: 1rem;
  border-width: 0.15rem;
}

/* Base read-only block */
.readonly-block {
  display: block;
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  -webkit-text-fill-color: var(--bs-body-color);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  cursor: not-allowed;
  min-height: 3.5rem; /* visible even when empty */
  max-height: 9rem; /* keep compact; scroll if longer */
  overflow: auto;
}

/* Placeholder when empty */
.readonly-block:empty::before {
  content: attr(data-placeholder);
  color: var(--bs-secondary-color);
  opacity: 0.9;
}

/* Accent + border (non-input look) */
.ai-dock {
  --ai-accent: var(--bs-info); /* tweak if you like */
  --ai-accent-subtle: var(--bs-info-border-subtle);
}

.ro-outlined {
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 0 0 1px var(--bs-border-color) inset; /* crisp edge on all themes */
  position: relative;
  padding-left: 0.75rem; /* base padding; we’ll add more for accent */
}

/* Left accent bar */
.ro-outlined::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.35rem;
  border-radius: 0.5rem 0 0 0.5rem;
  background: var(--ai-accent-subtle);
}

/* Optional tiny lock glyph */
.ro-outlined::after {
  content: "🔒";
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.6;
  pointer-events: none;
}

/* Focus state (keyboard accessibility without looking like an input) */
.readonly-block:focus-visible {
  outline: 2px dashed var(--ai-accent-subtle);
  outline-offset: 2px;
}
