/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/*
 * Fix for dropdowns inside modals being clipped
 * Makes dropdown-content use fixed positioning to escape modal overflow constraints
 */
dialog .dropdown-content {
  position: fixed !important;
}

.badge {
  white-space: nowrap;
}

/*
 * Brain assistant chat: markdown tables must scroll inside the bubble
 * instead of stretching the narrow (400px) panel.
 */
.chat-bubble.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

/*
 * Style links inside Lexxy rich text editor
 * Lexxy strips inline styles for security, so we must use CSS
 * Target .lexxy-editor__content which is the contenteditable area
 */
.lexxy-editor__content a {
  color: #0066cc !important;
  text-decoration: underline !important;
}

.lexxy-editor__content a:hover {
  color: #004499 !important;
}

/*
 * Lexxy editor styled as a plain textarea for message compose
 * Used in messaging/messages/_compose.html.erb
 */
lexxy-editor.lexxy-message-compose {
  border: 1px solid oklch(var(--bc) / 0.2);
  border-radius: var(--rounded-btn, 0.5rem);
  padding: 0;
  min-height: 42px;
  max-height: 150px;
  overflow-y: auto;
  width: 100%;
  font-size: inherit;
  line-height: 1.5;
  background: transparent;
  display: block;
}

lexxy-editor.lexxy-message-compose .lexxy-editor__content {
  min-height: unset;
  padding: 0.375rem 0.75rem;
  margin: 0;
}

lexxy-editor.lexxy-message-compose:focus-within {
  outline: 2px solid oklch(var(--p) / 0.5);
  outline-offset: 2px;
  border-color: oklch(var(--p) / 0.5);
}

/* Hide any toolbar or chrome that Lexxy might render */
lexxy-editor.lexxy-message-compose .lexxy-editor__toolbar {
  display: none !important;
}

/* Static content fields: make bold text visibly bolder than prose-sm default (600) */
.prose strong,
.prose b {
  font-weight: 800;
}

/* Collapse empty paragraphs from rich text editors so they don't create excessive whitespace */
.lexxy-content p:empty,
.lexxy-content p:has(br:only-child) {
  display: none;
}

/* Token chips in editor (form builder) */
.token-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background-color: #e5e7eb;
  color: #374151;
  padding: 2px 8px;
  font-size: 0.875rem;
  font-weight: 500;
  user-select: all;
}

.token-chip-input {
  background-color: #fef3c7;
  color: #92400e;
}

/* Resolved tokens in filled forms */
.token-resolved {
  font-weight: 500;
}

/* Inline token inputs in filled forms */
input.token-input {
  display: inline;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  background-color: #fafafa;
  padding: 1px 4px;
  font-size: 0.75rem !important;
  border-radius: 3px;
  min-width: 80px;
  width: auto;
  outline: none !important;
}

input.token-input:focus {
  border-bottom: 2px solid #3b82f6;
  background-color: white !important;
  outline: none !important;
}

/* Hide native scrollbar while keeping scroll functionality */
.hide-scrollbar {
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Force always-visible scrollbar (overrides macOS overlay scrollbars) */
.force-scrollbar::-webkit-scrollbar {
  -webkit-appearance: none;
  height: 10px;
}

.force-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.force-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: 5px;
}

.force-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.4);
}

