/* ===== Layout custom properties ===== */
:root {
  /* default == collapsed sidebar (phones / tablets) */
  --sidebar-w: 0px;
}

/* Tool execution styles */
.tool-source-breakdown {
  font-size: 0.75rem;
}
@media (min-width: 1200px) {   /* Desktop - show sidebar */
  :root { --sidebar-w: 160px; }   /* slimmer nav sidebar width */
}

.alert-debug {
  color: black;
  background-color: white;
  border-color: #d6e9c6;
}

.alert-error {
  color: #b94a48;
  background-color: #f2dede;
  border-color: #eed3d7;
}

.profile-picture {
  width: 200px;
  height: 200px;
  object-fit: cover;
}

body {
  padding-top: 70px; /* to account for nav */
  height: 100%;
}

.navbar {
  background-color: #000055;
}

.navbar .nav-link {
  color: white !important;
  margin-right: 10px;
}

.navbar .nav-link:hover {
  text-decoration: underline;
  color: #ccccff !important;
}

.navbar .navbar-brand {
  color: white !important;
  font-weight: bold;
}

.navbar .navbar-brand:hover {
  color: #ccccff !important;
}

/* Custom Hamburger Icon */
.navbar-toggler {
  border-color: white !important;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=UTF8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(255, 255, 255, 1)' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E") !important;
}

.row {
  display: flex;
  flex-wrap: wrap;
}

.equal-height {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Ensure card bodies stretch evenly */
.equal-height .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.main {
  padding-left: var(--sidebar-w);
  transition: padding-left .25s ease;   /* optional smooth slide-in */
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  padding: 58px 0 0; /* Height of navbar */
  box-shadow: 0 2px 5px 0 rgb(0 0 0 / 5%), 0 2px 10px 0 rgb(0 0 0 / 5%);
  width: var(--sidebar-w);
  z-index: 600;
  }

  @media (max-width: 1199px) {
  .sidebar {
  width: 100%;
  }
  }
  .sidebar .active {
  border-radius: 5px;
  box-shadow: 0 2px 5px 0 rgb(0 0 0 / 16%), 0 2px 10px 0 rgb(0 0 0 / 12%);
  }

  .sidebar-sticky {
  position: relative;
  top: 0;
  height: calc(100vh - 48px);
  padding-top: 0.5rem;
  overflow-x: hidden;
  overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
  }


  .loader {
    width: 40px;
    aspect-ratio: 1;
    --c: linear-gradient(var(--bs-primary) 0 0);
    --r1: radial-gradient(farthest-side at bottom, var(--bs-primary) 93%, transparent);
    --r2: radial-gradient(farthest-side at top, var(--bs-primary) 93%, transparent);
    background:
      var(--c), var(--r1), var(--r2),
      var(--c), var(--r1), var(--r2),
      var(--c), var(--r1), var(--r2);
    background-repeat: no-repeat;
    animation: l2 1s infinite alternate;
  }

  @keyframes l2 {
    0%, 25% {
      background-size: 8px 0, 8px 4px, 8px 4px, 8px 0, 8px 4px, 8px 4px, 8px 0, 8px 4px, 8px 4px;
      background-position: 0 50%, 0 calc(50% - 2px), 0 calc(50% + 2px), 50% 50%, 50% calc(50% - 2px), 50% calc(50% + 2px), 100% 50%, 100% calc(50% - 2px), 100% calc(50% + 2px);
    }
    50% {
      background-size: 8px 100%, 8px 4px, 8px 4px, 8px 0, 8px 4px, 8px 4px, 8px 0, 8px 4px, 8px 4px;
      background-position: 0 50%, 0 calc(0% - 2px), 0 calc(100% + 2px), 50% 50%, 50% calc(50% - 2px), 50% calc(50% + 2px), 100% 50%, 100% calc(50% - 2px), 100% calc(50% + 2px);
    }
    75% {
      background-size: 8px 100%, 8px 4px, 8px 4px, 8px 100%, 8px 4px, 8px 4px, 8px 0, 8px 4px, 8px 4px;
      background-position: 0 50%, 0 calc(0% - 2px), 0 calc(100% + 2px), 50% 50%, 50% calc(0% - 2px), 50% calc(100% + 2px), 100% 50%, 100% calc(50% - 2px), 100% calc(50% + 2px);
    }
    95%, 100% {
      background-size: 8px 100%, 8px 4px, 8px 4px, 8px 100%, 8px 4px, 8px 4px, 8px 100%, 8px 4px, 8px 4px;
      background-position: 0 50%, 0 calc(0% - 2px), 0 calc(100% + 2px), 50% 50%, 50% calc(0% - 2px), 50% calc(100% + 2px), 100% 50%, 100% calc(0% - 2px), 100% calc(100% + 2px);
    }
  }


  /* Prevent textarea from growing vertically when user presses Enter */
textarea.resize-none {
  resize: none;
}

/* Hide scrollbar but keep scrollability for messages pane (WebKit) */
#messages::-webkit-scrollbar {
  width: 6px;
}
#messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
#ai-typing.htmx-request {
  display: flex !important;        /* shown only while request is in flight */
}
.typing-dot {
  animation: blink 1.4s infinite both;
  font-weight: bold;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
  0%, 20% { opacity: 0; }
  50%     { opacity: 1; }
  100%    { opacity: 0; }
}

/* Pending user message styling */
.pending-user-message {
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.pending-user-message .bg-primary {
  background-color: var(--bs-primary) !important;
  opacity: 0.75;
}

/* ---- Chat List Styling ---- */
/* Chat list interactions */
.list-group-item-action {
  transition: background-color .15s ease, color .15s ease;
}

.list-group-item-action:hover:not(.active) {
  background-color: var(--bs-gray-100);
}

/* Active (selected) chat row */
.list-group-item.active {
  background-color: var(--bs-primary-bg-subtle);   /* Bootstrap 5.3 token */
  color: var(--bs-primary-text-emphasis);
}
#chat-list {                     /* only the list needs this */
  min-height: 0;                 /* allow shrinking inside flexbox */
}
/* ---- Chat List Styling ---- */

/* ===== Chat Layout ===== */
.chat-outer-wrapper {
  display: flex;
  flex-direction: row;
  width: calc(100% - 2rem); /* side margin from viewport */
  max-width: min(1400px, 95vw);
  margin: 0rem auto; /* reduced margin all around */
  gap: 0; /* remove inner gap so sidebars touch thread */
  height: calc(100vh - 5rem);
  background: #f8f9fa;
  border-radius: 1.5rem;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  overflow: hidden; /* Prevent any content from breaking out */
}

/* Collaborative document: nested blocks and headings */
.doc-block.level-1 { border-left: 3px solid #e9ecef; }
.doc-block.level-2 { border-left: 3px solid #dee2e6; margin-left: 0.5rem; }
.doc-block.level-3 { border-left: 3px solid #ced4da; margin-left: 1rem; }
.doc-block.level-4 { border-left: 3px solid #adb5bd; margin-left: 1.25rem; }

.doc-heading.level-2 { font-size: 1rem; font-weight: 600; }
.doc-heading.level-3 { font-size: 0.95rem; font-weight: 600; }
.doc-heading.level-4 { font-size: 0.9rem; font-weight: 600; }

.doc-children { margin-top: 0.25rem; }

.sidebar-width {
  width: min(200px, 25vw);
  min-width: min(160px, 20vw);
  max-width: min(220px, 30vw);
  flex: 0 0 min(200px, 25vw);
  flex-shrink: 0;
  flex-grow: 0;
}

.chat-main-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sidebar-vertical-margin {
  margin-top: 12px;  /* larger vertical offset so sidebars appear shorter */
  margin-bottom: 12px;
}

.messages-padding-top {
  padding-top: 64px;
}

.chat-header {
  flex: 0 0 auto;
  z-index: 1;
}

.chat-input-row {
  flex: 0 0 auto;
  z-index: 1;
}

#messages {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  max-height: none;
}

html, body {
  height: 100%;
}
.container-fluid.h-100 {
  height: 100vh;
}
.row.flex-grow-1.h-100 {
  height: 100%;
  min-height: 0;
}
.chat-main-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
#messages {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  max-height: none;
}
.chat-header {
  flex-shrink: 0;
}
.chat-input-row {
  flex-shrink: 0;
}

/* --- Chat Layout & Responsive Styles --- */
.thread-title-truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.avatar-32 { width: 32px; height: 32px; font-size: 1.2rem; }
.avatar-32-sm { width: 32px; height: 32px; font-size: 1rem; }
.gap-neg-8 { margin-left: -8px; }
.dropdown-min-width { min-width: 220px; }
.min-vh-64 { min-height: 64px; }
.flex-row { display: flex; height: 100%; min-width: 0; }
.chat-selector-col, .chat-thread-col, .artifacts-col { min-width: 0; display: flex; flex-direction: column; }
.chat-selector-col {
  flex: 0 0 200px;
  max-width: 220px;
  background: #fff;
  border-right: 1px solid #eee;
  border-radius: 1.5rem 0 0 1.5rem; /* fully rounded left side */
}
.chat-thread-col { flex: 1 1 0; min-width: 0; }
.artifacts-col {
  flex: 0 0 240px;
  max-width: 300px;
  background: #fff;
  border-left: 1px solid #eee;
  border-radius: 0 1.5rem 1.5rem 0;
}

/* ===== Right Output Sidebar Normalization ===== */
#artifacts-pane.artifacts-col {
  flex: 0 0 460px;          /* default wider pane */
  min-width: 360px;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#artifacts-pane .composed-output {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;         /* scroller lives on #doc-pane */
}

#artifacts-pane #doc-pane {
  flex: 1 1 auto;
  overflow-y: auto;
}

/* ===== Document Sheet Styling (sidebar and full-page) ===== */
.document-viewport {
  display: flex;
  justify-content: center;
}

.document-sheet {
  width: 816px; /* ~US Letter at 96dpi */
  max-width: calc(100% - 0.5rem);
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.05);
  padding: 14px 16px;
  margin: 4px auto 8px;
  line-height: 1.6;
}

.document-sheet h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
.document-sheet h2 { font-size: 1.25rem; margin: 1rem 0 .5rem; }
.document-sheet h3 { font-size: 1.1rem; margin: .75rem 0 .4rem; }
.document-sheet p  { margin: 0 0 .75rem; }
.document-sheet ul, .document-sheet ol { padding-left: 1.25rem; margin: .5rem 0 .75rem; }

.doc-part-container { margin-bottom: 4px; }
.doc-block { padding: 4px; border-radius: 8px; transition: background-color .15s; }
.doc-block:hover { background: rgba(0,0,0,.02); }
.doc-block .doc-block-actions { opacity: 0; transition: opacity .15s; }
.doc-block:hover .doc-block-actions { opacity: 1; }

/* Inline comment styling */
.doc-comment {
  margin: 4px 0 0 6px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 4px 5px;
  font-size: .9rem;
}
/* Extra Large Desktop - full three-column layout + sidebar (1500px+) */
@media (min-width: 1500px) {
  /* Show desktop sidebar navigation */
  #sidebarMenu {
    display: block !important;
  }

  /* All columns visible - use default layout */
  .artifacts-col {
    display: flex !important;
  }
}

/* Large Desktop - sidebar + chat list visible, output slide-in (1200px-1499px) */
@media (min-width: 1200px) and (max-width: 1499px) {
  /* Show desktop sidebar navigation */
  #sidebarMenu {
    display: block !important;
  }

  /* Hide artifacts by default (slide-in on demand) */
  .artifacts-col {
    display: none !important;
  }
  .chat-selector-col {
    flex: 0 0 220px;
    max-width: 260px;
  }
  .chat-main-thread {
    flex: 1 1 auto;
    max-width: none;
  }
}

/* Medium Desktop - hide artifacts and sidebar, show chat list and thread (768px-1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
  /* Hide desktop sidebar navigation */
  #sidebarMenu {
    display: none !important;
  }

  /* Remove sidebar padding */
  .main {
    padding-left: 0 !important;
  }

  .artifacts-col {
    display: none !important;
  }
  .chat-selector-col {
    flex: 0 0 220px;
    max-width: 260px;
  }
  .chat-main-thread {
    flex: 1 1 auto;
    max-width: none;
  }
}

.full-height {
    height: 100%;
}

/* Message bubble styling for chat messages */
.message-bubble {
    border-radius: 1rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    max-width: min(640px, 85vw);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* User message bubble (primary color, max width) */
.message-bubble-user {
    max-width: min(80%, 75vw);
}

/* Image attachment sizing */
.message-image {
    max-width: min(220px, 40vw);
    height: auto;
}

.message-content {
    max-width: min(80%, 75vw);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.artifact-icon {
    font-size: 2rem;
}

.artifact-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
}

.d-none {
    display: none !important;
}

.thread-flex {
    display: flex;
}

.thread-shrink-0 {
    flex-shrink: 0;
}

.thread-flex-1 {
    flex: 1 1 auto;
}

.thread-min-height {
    min-height: 38px;
}

/* Utility for 100% height */
.h-100 {
    height: 100% !important;
}

/* Utility for min-height: 0 */
.min-vh-0 {
    min-height: 0 !important;
}

/* Scrollable messages area */
.messages-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    max-height: none;
}

/* Chat textarea sizing */
.message-textarea {
    min-height: 38px;
    max-height: 180px;
    overflow-y: auto;
    resize: none;
}

/* Marketplace utility classes */
.row-70vh { max-height: 70vh; overflow: hidden; }
.card-body-fixed { min-height: 260px; }
.play-chat-scroll { max-height: 45vh; overflow-y: auto; }
.rating-select { width: 80px; display: inline-block; }

/* Modal scrollable areas */
.modal-scrollable {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.modal-scrollable::-webkit-scrollbar {
    width: 8px;
}

.modal-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.modal-scrollable::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.modal-scrollable::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

/* -- Community utility classes -- */
.maxh-500-scroll { max-height: 500px; overflow-y: auto; }
.maxh-400-img { max-height: 400px; object-fit: contain; }
.maxh-220-scroll { max-height: 220px; overflow-y: auto; }
.cursor-pointer { cursor: pointer; }
.dropdown-menu-260 { min-width: 260px; }

.learning-card-img{height:180px;object-fit:cover;}
.learning-list-thumb{width:64px;height:40px;object-fit:cover;border-radius:.25rem;margin-right:1rem;}
.learning-list-thumb-lg{width:100%;max-width:300px;height:auto;object-fit:cover;border-radius:.25rem;}

.markdown-body table{width:100%;border-collapse:collapse;margin-bottom:1rem;}
.markdown-body th,.markdown-body td{padding:.5rem;border:1px solid #dee2e6;}
.markdown-body thead{background-color:#f8f9fa;}

/* sticky module progress */
#module-progress-wrapper{position:sticky;top:70px;z-index:1;}

.module-header-thumb{width:260px;max-width:35%;height:auto;object-fit:cover;border-radius:.25rem;opacity:.85;}

/* --- Learning Center refined styles --- */
.module-row-thumb{width:96px;height:56px;object-fit:cover;border-radius:4px;position:relative;overflow:hidden;}
.module-row-thumb .order-badge{position:absolute;top:2px;left:2px;font-size:.65rem;}
@media(max-width:575.98px){.module-row-thumb{width:72px;height:42px;}}

.module-header-thumb{width:200px;height:120px;object-fit:cover;border-radius:6px;filter:blur(1px);opacity:.4;}
@media(max-width:575.98px){.module-header-thumb{width:120px;height:72px;}}

/* Module header hero */
.module-header{position:relative;overflow:hidden;padding:1.5rem;border-radius:.5rem;background-color:#f8f9fa;margin-bottom:1rem;}
.module-header-bg{position:absolute;inset:0;background-size:cover;background-position:center;filter:blur(6px);opacity:.25;}
.module-header-content{position:relative;z-index:1;background:rgba(255,255,255,0.85);backdrop-filter:blur(3px);padding:1rem;border-radius:.5rem;}

/* Utility classes moved from inline styles */
.progress-slim { height: 6px; }
.progress-thin { height: 4px; }
.thumbnail-preview { max-height: 150px; }
.cropper-preview-wrapper { max-height: 70vh; }

/* Flexible chat thread width */
.chat-main-thread:not(.sidebar) {
  max-width: none !important;
  min-width: 680px;
}

@media (max-width: 900px) {
  .chat-main-thread:not(.sidebar) { min-width: 100%; }
}

/* === Chat UI Compact Typography === */
.chat-header h5 {
  font-size: 1rem;
  margin-bottom: 0;
}

#chat-list .list-group-item {
  font-size: 0.8rem; /* smaller text */
}
#chat-list .chat-title-truncate {
  max-width: 120px;
  font-size: 0.8rem;
}

/* Chat selector buttons (gear, new chat) */
.chat-selector-col .btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}

/* Smaller text in artifacts sidebar */
.artifacts-col {
  font-size: 0.9rem;
}

.message-bubble {
  padding: 0.75rem 1rem;
}
.message-bubble .message-content {
  font-size: 0.9rem;
}
.message-bubble .fw-semibold,
.message-bubble .small {
  font-size: 0.8rem;
}

/* === Composed Output markdown typography === */
.composed-output .markdown-content {
  font-size: 0.95rem;
  line-height: 1.4;
}
.composed-output .markdown-content h1 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.composed-output .markdown-content h2 {
  font-size: 1.1rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.composed-output .markdown-content h3 {
  font-size: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.4rem;
}

/* Reduce button padding for tighter UI */
.btn-sm {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

/* Avatar sizing tweaks */
.avatar-32 { width: 28px; height: 28px; font-size: 1rem; }

/* --- Nav sidebar compact --- */
.sidebar .list-group-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

@media (min-width: 992px) and (max-width: 1200px) {
  .sidebar .list-group-item span { display: none; }
  .sidebar { text-align: center; }
}

/* Chat selector smaller text */
.chat-selector-col, .chat-selector-col #chat-list, .chat-selector-col #chat-list .list-group-item {
  font-size: 0.8rem !important;
}

/* Artifacts sidebar smaller text */
.artifacts-col {
  font-size: 0.9rem !important;
}

/* Make chat main thread flexible */
.chat-main-thread {
  flex: 1 1 auto !important;
}

/* Center header contents (title + participants) */
.chat-header {
  justify-content: center !important;
}
.chat-header .thread-title-truncate {
  position: static;
  transform: none;
}

/* Inline layout for message action buttons */
.message-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.message-actions .btn { padding: 0.15rem 0.6rem; font-size: 0.75rem; }

/* Quick-add chip button */
.chip-btn { font-size: 0.75rem; padding: 0; border: none; }

/* Scrollable pick list */
.scroll-picker{max-height:240px;overflow-y:auto;border:1px solid #e9ecef;border-radius:.25rem;padding:.5rem;}
.scroll-picker label{display:block;font-size:.85rem;white-space:nowrap;}
.icon-small {
  height: 1rem;
  width: auto;
}

/* Sidebar project hierarchy */
.project-header{background:#f8f9fa;border-radius:.25rem;padding:.25rem .5rem;font-weight:600;display:flex;align-items:center;cursor:pointer;}
.project-header .chevron{transition:transform .2s;}
.project-header.collapsed .chevron{transform:rotate(-90deg);}
.project-chat-list{padding-left:.75rem;}
.project-chat-list .list-group-item{padding-left:1rem;border-left:3px solid transparent;}
.project-chat-list .list-group-item.active{border-left-color:var(--bs-primary);}

.agent-icon-sm { height: 1rem; }

/* --- Chat markdown enhancements --- */
.message-bubble .markdown-body {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
}

/* === AGGRESSIVE MARKDOWN OVERRIDE === */
/* Nuclear option - override everything with maximum specificity */

/* LISTS - Most specific selectors possible */
div.message-bubble div.message-content.small.markdown-body ol,
div.message-bubble div.markdown-body ol,
.message-bubble .markdown-body ol,
.message-bubble ol {
  list-style-type: decimal !important;
  margin: 1em 0 !important;
  padding-left: 2em !important;
  margin-block-start: 1em !important;
  margin-block-end: 1em !important;
  padding-inline-start: 2em !important;
}

div.message-bubble div.message-content.small.markdown-body ul,
div.message-bubble div.markdown-body ul,
.message-bubble .markdown-body ul,
.message-bubble ul {
  list-style-type: disc !important;
  margin: 1em 0 !important;
  padding-left: 2em !important;
  margin-block-start: 1em !important;
  margin-block-end: 1em !important;
  padding-inline-start: 2em !important;
}

/* LIST ITEMS - Maximum override */
div.message-bubble div.message-content.small.markdown-body li,
div.message-bubble div.markdown-body li,
.message-bubble .markdown-body li,
.message-bubble li {
  margin: 0.4em 0 !important;
  line-height: 1.6 !important;
  padding-left: 0.25em !important;
  display: list-item !important;
}

/* PARAGRAPHS IN LIST ITEMS */
div.message-bubble div.message-content.small.markdown-body li p,
div.message-bubble div.markdown-body li p,
.message-bubble .markdown-body li p,
.message-bubble li p {
  margin: 0.2em 0 !important;
  line-height: 1.6 !important;
  display: inline !important;
}

/* NESTED LISTS */
div.message-bubble div.message-content.small.markdown-body li ul,
div.message-bubble div.markdown-body li ul,
.message-bubble .markdown-body li ul,
.message-bubble li ul {
  list-style-type: circle !important;
  margin: 0.5em 0 !important;
  padding-left: 2em !important;
}

div.message-bubble div.message-content.small.markdown-body li ol,
div.message-bubble div.markdown-body li ol,
.message-bubble .markdown-body li ol,
.message-bubble li ol {
  list-style-type: lower-alpha !important;
  margin: 0.5em 0 !important;
  padding-left: 2em !important;
}

/* HEADERS */
div.message-bubble div.message-content.small.markdown-body h3,
div.message-bubble div.markdown-body h3,
.message-bubble .markdown-body h3,
.message-bubble h3 {
  font-weight: 600 !important;
  font-size: 1.1em !important;
  margin: 1.2em 0 0.6em 0 !important;
  line-height: 1.3 !important;
}

div.message-bubble div.message-content.small.markdown-body h1,
div.message-bubble div.message-content.small.markdown-body h2,
div.message-bubble div.message-content.small.markdown-body h4,
div.message-bubble div.markdown-body h1,
div.message-bubble div.markdown-body h2,
div.message-bubble div.markdown-body h4,
.message-bubble .markdown-body h1,
.message-bubble .markdown-body h2,
.message-bubble .markdown-body h4,
.message-bubble h1,
.message-bubble h2,
.message-bubble h4 {
  font-weight: 600 !important;
  margin: 1.5em 0 0.75em 0 !important;
  line-height: 1.3 !important;
}

/* BOLD TEXT */
div.message-bubble div.message-content.small.markdown-body strong,
div.message-bubble div.message-content.small.markdown-body b,
div.message-bubble div.markdown-body strong,
div.message-bubble div.markdown-body b,
.message-bubble .markdown-body strong,
.message-bubble .markdown-body b,
.message-bubble strong,
.message-bubble b {
  font-weight: 600 !important;
}

/* PARAGRAPHS */
div.message-bubble div.message-content.small.markdown-body p,
div.message-bubble div.markdown-body p,
.message-bubble .markdown-body p,
.message-bubble p {
  margin: 0.75em 0 !important;
  line-height: 1.6 !important;
}

/* REMOVE FIRST/LAST MARGINS */
div.message-bubble div.message-content.small.markdown-body > *:first-child,
div.message-bubble div.markdown-body > *:first-child,
.message-bubble .markdown-body > *:first-child,
.message-bubble > *:first-child {
  margin-top: 0 !important;
}

div.message-bubble div.message-content.small.markdown-body > *:last-child,
div.message-bubble div.markdown-body > *:last-child,
.message-bubble .markdown-body > *:last-child,
.message-bubble > *:last-child {
  margin-bottom: 0 !important;
}

/* Table styling */
.message-bubble .markdown-body table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.message-bubble .markdown-body th,
.message-bubble .markdown-body td {
  border: 1px solid var(--bs-border-color, #dee2e6);
  padding: .25rem .4rem;
  white-space: normal;
  word-wrap: break-word;
}

/* User bubbles use primary background; force white text inside markdown */
.message-bubble-user .markdown-body {
  color: #fff;
}

/* User bubble nested lists need white text too */
.message-bubble-user .markdown-body ul,
.message-bubble-user .markdown-body ol,
.message-bubble-user .markdown-body li {
  color: #fff;
}

/* === Utility classes added to replace inline styles (lint fixes) === */
.btn-xs {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.truncate-400 {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-status-completed {
  background-color: #d4edda;
}

.tool-status-failed {
  background-color: #f8d7da;
}

.tool-status-pending {
  background-color: #fff3cd;
}

/* ══════════════════════════════════════════════════════════════════════════════
 * PROJECT SPECIFIC STYLES
 * ══════════════════════════════════════════════════════════════════════════════ */

/* Your custom styles for this project */

/* Agent Type Badges */
.agent-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.card-agent {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #dee2e6;
}

.card-agent:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #0d6efd;
}

/* Type Filter Tabs */
.type-filter-tabs {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 20px;
}

.type-filter-tabs .btn {
    border-radius: 6px;
    margin-right: 8px;
    border: none;
    background: transparent;
    color: #6c757d;
}

.type-filter-tabs .btn.active {
    background: #0d6efd;
    color: white;
}

/* ══════════════════════════════════════════════════════════════════════════════
 * CHAT NEW MODAL STYLES
 * ══════════════════════════════════════════════════════════════════════════════ */

/* Modern Agent Grid */
.agent-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.agent-card {
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.agent-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.agent-card.selected {
    border-color: #0d6efd;
    background: #e7f3ff;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.agent-card.hidden {
    display: none;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background: #f8f9fa;
    font-size: 1.25rem;
}

.agent-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

.agent-description {
    line-height: 1.3;
    margin-top: 0.25rem;
}

.badges {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Selected Agent Chips */
.selected-chip {
    display: inline-flex;
    align-items: center;
    background: #0d6efd;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.selected-chip .remove-chip {
    background: none;
    border: none;
    color: white;
    margin-left: 0.25rem;
    padding: 0;
    font-size: 0.875rem;
    cursor: pointer;
}

.selected-chip .remove-chip:hover {
    opacity: 0.7;
}

/* Participant List */
.participant-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.participant-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s;
    margin: 0;
}

.participant-item:hover {
    background: #f8f9fa;
}

.participant-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

.participant-info {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

/* Tab styling */
.nav-pills .nav-link {
    border-radius: 0.375rem;
    font-weight: 500;
}

.nav-pills .nav-link.active {
    background-color: #0d6efd;
}

/* Responsive adjustments for chat modal */
@media (max-width: 768px) {
    .agent-grid {
        gap: 0.375rem;
    }

    .agent-card {
        padding: 0.5rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
 * AGENT PICKER STYLES (CREATE/EDIT FORMS)
 * ══════════════════════════════════════════════════════════════════════════════ */

/* Icon and Color Picker Styling */
.icon-picker, .color-picker {
    background-image: none !important;
}

.icon-picker option {
    padding: 8px 12px;
    font-size: 16px;
}

.color-picker option {
    padding: 8px 12px;
    font-size: 14px;
}

/* Color preview dots */
.color-preview {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #ddd;
    vertical-align: middle;
}

/* Icon preview */
.icon-preview {
    font-size: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

.form-group {
    margin-bottom: 1rem;
}

/* Enhanced picker styling */
.picker-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.picker-item {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    background: white;
}

.picker-item:hover {
    border-color: #0d6efd;
    background-color: #f8f9fa;
}

.picker-item.selected {
    border-color: #0d6efd;
    background-color: #e7f3ff;
}

/* Agent marketplace and chat interface styles */
.agent-icon {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}

.agent-icon.bi {
    font-size: 32px;
    width: auto;
    height: auto;
}

.agent-icon-small {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 50%;
}

.agent-icon-xs {
    width: 16px;
    height: 16px;
    object-fit: cover;
    border-radius: 50%;
}

.agent-icon-large {
    font-size: 2rem;
}

.agent-icon-xl {
    font-size: 3rem;
}

.agent-icon-medium {
    font-size: 1.2rem;
}

.agent-icon-24 {
    font-size: 24px;
}

.rosie-icon {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}

.modal-body-scrollable {
    max-height: 500px;
    overflow-y: auto;
}

.modal-content-tall {
    height: 80vh;
}

.flex-grow-fill {
    flex-grow: 1;
}

.small-padding {
    padding: 0.25rem;
}

.height-100 {
    height: 100px;
}

.overflow-auto {
    overflow: auto;
}

.playground-chat {
    height: 200px;
    overflow-y: auto;
}

.selected-agent-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.agent-group-item {
    margin-bottom: 5px;
}

.participant-list {
    max-height: 200px;
    overflow-y: auto;
}

.rating-select {
    width: 80px;
}

.pre-wrap {
    white-space: pre-wrap;
}

.overflow-hidden {
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.agent-grid {
    max-height: 300px;
}

/* Keep agent-grid at reasonable height in modals */
.chat-creation-modal .agent-grid,
.chat-edit-modal .agent-grid,
.project-creation-modal .agent-grid {
    max-height: 350px;  /* Slightly larger than default but still contained */
}

/* Fix modal layout - ensure entire modal fits in viewport */
.chat-creation-modal,
.chat-edit-modal,
.project-creation-modal {
    max-height: calc(100vh - 3.5rem) !important; /* Leave space for browser chrome */
    margin: 1.75rem auto !important; /* Center with margin */
}

.chat-creation-modal .modal-content,
.chat-edit-modal .modal-content,
.project-creation-modal .modal-content {
    max-height: calc(100vh - 3.5rem);
    height: calc(100vh - 3.5rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-creation-modal .modal-header,
.chat-edit-modal .modal-header,
.project-creation-modal .modal-header {
    flex: 0 0 auto;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.chat-creation-modal .modal-body,
.chat-edit-modal .modal-body,
.project-creation-modal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 1.5rem;
}

.chat-creation-modal .modal-footer,
.chat-edit-modal .modal-footer,
.project-creation-modal .modal-footer {
    flex: 0 0 auto;
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    background: white;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===== COMMUNITY FEED STYLES ===== */

/* Main Feed Layout */
.community-feed {
  background-color: #f8f9fa;
  min-height: 100vh;
}

.feed-header {
  background: white;
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 0;
  position: sticky;
  top: 70px; /* Account for navbar height */
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.group-selector .form-select {
  border-radius: 20px;
  font-size: 0.9rem;
  min-width: 150px;
}

/* Sidebar Styles - More Compact */
.sidebar-section {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-title {
  color: #495057;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.group-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: #495057;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.group-item:hover {
  background-color: #f8f9fa;
  color: #212529;
  text-decoration: none;
}

.group-item.active {
  background-color: #e7f3ff;
  color: #0d6efd;
  font-weight: 500;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f3f4;
}

.stat-number {
  font-weight: 600;
  color: #0d6efd;
  font-size: 1.1rem;
}

.stat-label {
  font-size: 0.85rem;
  color: #6c757d;
  font-weight: 500;
}

.post-composer {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #e9ecef;
}

.composer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.composer-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #6c757d;
}

.composer-content {
  flex: 1;
}

.post-input-wrapper {
  position: relative;
}

.post-input {
  width: 100%;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.9rem;
  resize: none;
  min-height: 60px;
  transition: border-color 0.2s ease;
}

.post-input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.selected-attachments {
  margin-top: 0.5rem;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.action-buttons .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

.post-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #e9ecef;
  transition: box-shadow 0.2s ease;
}

.post-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #6c757d;
}

.author-info {
  flex: 1;
}

.author-name {
  font-weight: 600;
  color: #212529;
  font-size: 0.9rem;
  margin-bottom: 0.125rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #6c757d;
}

.post-time, .post-group, .post-visibility {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.post-content {
  margin-bottom: 0.75rem;
}

.post-text {
  color: #212529;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.attachment-image {
  margin-bottom: 0.5rem;
}

.attachment-image img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.image-caption {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.25rem;
  font-style: italic;
}

.attachment-file {
  margin-bottom: 0.5rem;
}

.file-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
  text-decoration: none;
  color: #495057;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
}

.file-link:hover {
  background: #e9ecef;
  color: #212529;
  text-decoration: none;
}

.file-caption {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.attachment-agent, .attachment-chat {
  margin-bottom: 0.5rem;
}

.agent-preview, .chat-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #495057;
}

.attachment-agent:hover .agent-preview,
.attachment-chat:hover .chat-preview {
  background: #e9ecef;
  color: #212529;
  text-decoration: none;
}

.agent-icon, .chat-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
}

.agent-info, .chat-info {
  flex: 1;
}

.agent-name, .chat-title {
  font-weight: 600;
  color: #212529;
  font-size: 0.9rem;
  margin-bottom: 0.125rem;
}

.agent-type, .chat-meta {
  font-size: 0.8rem;
  color: #6c757d;
}

.post-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f3f4;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.reaction-buttons {
  display: flex;
  gap: 0.25rem;
}

.reaction-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border: none;
  background: transparent;
  color: #6c757d;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.reaction-btn:hover {
  background: #f8f9fa;
  color: #495057;
}

.reaction-btn.active {
  background: #e7f3ff;
  color: #0d6efd;
}

.reaction-count {
  font-size: 0.75rem;
  font-weight: 500;
}

.comment-toggle, .share-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border: none;
  background: transparent;
  color: #6c757d;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.comment-toggle:hover, .share-btn:hover {
  background: #f8f9fa;
  color: #495057;
}

.comment-count {
  font-size: 0.75rem;
  font-weight: 500;
}

.comments-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f3f4;
}

.comments-section.hidden {
  display: none;
}

.comments-list {
  margin-bottom: 0.75rem;
}

.comment-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #6c757d;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.comment-author {
  font-weight: 600;
  color: #212529;
  font-size: 0.8rem;
}

.comment-time {
  font-size: 0.75rem;
  color: #6c757d;
}

.comment-text {
  color: #495057;
  font-size: 0.85rem;
  line-height: 1.4;
}

.comment-form-wrapper {
  margin-top: 0.5rem;
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.comment-input-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #6c757d;
  flex-shrink: 0;
}

.comment-input-wrapper {
  flex: 1;
  position: relative;
}

.comment-input {
  width: 100%;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.85rem;
  resize: none;
  min-height: 40px;
  transition: border-color 0.2s ease;
}

.comment-input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

.comment-submit {
  padding: 0.375rem 0.75rem;
  background: #0d6efd;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.comment-submit:hover {
  background: #0b5ed7;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
}

.empty-state-icon {
  font-size: 3rem;
  color: #dee2e6;
  margin-bottom: 1rem;
}

.empty-state h5 {
  margin-bottom: 0.5rem;
  color: #495057;
}

.load-more-trigger {
  text-align: center;
  padding: 1rem;
  color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
  .feed-header {
    padding: 0.75rem 0;
  }

  .post-composer {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .post-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }

  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .action-buttons {
    justify-content: center;
  }

  .post-actions .action-buttons {
    justify-content: space-between;
  }

  .reaction-buttons {
    flex-wrap: wrap;
  }
}

/* Dropdown Improvements */
.dropdown-menu-260 {
  width: 260px;
}

.dropdown-header {
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.group-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.group-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.group-option:hover {
  background-color: #f8f9fa;
}

.group-option input[type="radio"] {
  margin: 0;
}

/* Animation for post creation */
@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card {
  animation: slideInFromTop 0.3s ease-out;
}

/* Utility Classes */
.maxh-220-scroll {
  max-height: 220px;
  overflow-y: auto;
}

.maxh-400-img {
  max-height: 400px;
  object-fit: cover;
}

/* Picker Items */
.picker-item {
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.picker-item:hover {
  background-color: #f8f9fa;
  border-color: #e9ecef;
}

.picker-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.picker-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e3f2fd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1976d2;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.picker-item-icon img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.picker-item-info {
  flex: 1;
}

.picker-item-name {
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.picker-item-type {
  font-size: 0.8rem;
  color: #6c757d;
}

.picker-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #6c757d;
}

.picker-empty i {
  font-size: 2rem;
  color: #dee2e6;
  margin-bottom: 0.5rem;
}

.picker-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.picker-load-more {
  text-align: center;
  padding: 1rem;
}

/* ===== LINKEDIN-STYLE USER PROFILE SIDEBAR ===== */

.user-profile-sidebar {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #e9ecef;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.profile-card {
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
}

.profile-background {
  height: 60px;
  background: linear-gradient(135deg, #d30f0f 0%, #4d0006 100%);
  border-radius: 8px 8px 0 0;
  margin-bottom: -30px;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: white;
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 1.5rem;
  color: #6c757d;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-info {
  padding: 0.5rem;
}

.profile-name {
  font-weight: 600;
  color: #212529;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.profile-title {
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.profile-location {
  color: #6c757d;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.profile-company {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: #495057;
  font-size: 0.8rem;
  font-weight: 500;
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.profile-stats .stat-item {
  text-align: center;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
  border: none;
}

.profile-stats .stat-item:last-child {
  border-bottom: none;
}

.profile-stats .stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.profile-stats .stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: #0d6efd;
}

.quick-actions {
  margin-bottom: 1rem;
}

.section-title {
  color: #495057;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.action-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: #495057;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.action-link:hover {
  background: #f8f9fa;
  color: #212529;
  text-decoration: none;
}

.action-link i {
  font-size: 0.9rem;
  color: #6c757d;
}

.groups-section {
  margin-bottom: 1rem;
}

.groups-section .group-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.groups-section .group-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: #495057;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.groups-section .group-item:hover {
  background-color: #f8f9fa;
  color: #212529;
  text-decoration: none;
}

.groups-section .group-item.active {
  background-color: #e7f3ff;
  color: #0d6efd;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .user-profile-sidebar {
    position: static;
    height: auto;
    overflow-y: visible;
    padding-right: 0;
  }
}

/* ===== PREVIEW MODAL STYLES ===== */

/* Agent Preview Modal */
.agent-preview-modal {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9ecef;
}

.agent-icon-large {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: #e3f2fd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  flex-shrink: 0;
}

.agent-icon-large img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.agent-info {
  flex: 1;
}

.agent-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.25rem;
}

.agent-type {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.agent-rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stars {
  display: flex;
  gap: 0.125rem;
}

.rating-text {
  font-size: 0.85rem;
  color: #6c757d;
}

/* Agent Description & Prompt */
.agent-description,
.agent-prompt {
  margin-bottom: 1.5rem;
}

.agent-description h6,
.agent-prompt h6 {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-description p {
  color: #495057;
  line-height: 1.5;
  margin-bottom: 0;
}

.prompt-content {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #495057;
  border: 1px solid #e9ecef;
}

/* Agent Reviews */
.agent-reviews {
  margin-bottom: 1.5rem;
}

.agent-reviews h6 {
  font-weight: 600;
  color: #495057;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.review-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid #e9ecef;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.reviewer-name {
  font-weight: 600;
  color: #212529;
  font-size: 0.9rem;
}

.review-rating {
  display: flex;
  gap: 0.125rem;
}

.review-comment {
  color: #495057;
  font-size: 0.85rem;
  line-height: 1.4;
}

.agent-actions {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}

/* Chat Preview Modal */
.chat-preview-modal {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9ecef;
}

.chat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #e3f2fd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1976d2;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.chat-info {
  flex: 1;
}

.chat-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.25rem;
}

.chat-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: #6c757d;
}

/* Chat Messages */
.chat-messages {
  margin-bottom: 1.5rem;
}

.message-item {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.message-item.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e3f2fd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1976d2;
  font-size: 1rem;
  flex-shrink: 0;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.message-content {
  flex: 1;
  max-width: 70%;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.message-author {
  font-weight: 600;
  color: #212529;
  font-size: 0.85rem;
}

.message-time {
  font-size: 0.75rem;
  color: #6c757d;
}

.message-text {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 12px;
  color: #495057;
  font-size: 0.9rem;
  line-height: 1.4;
  border: 1px solid #e9ecef;
}

.user-message .message-text {
  background: #e3f2fd;
  color: #1976d2;
  border-color: #1976d2;
}

.agent-message .message-text {
  background: #f8f9fa;
  color: #495057;
  border-color: #e9ecef;
}

.empty-chat {
  text-align: center;
  padding: 2rem 1rem;
  color: #6c757d;
}

.empty-chat i {
  font-size: 2rem;
  color: #dee2e6;
  margin-bottom: 0.5rem;
}

.empty-chat p {
  margin: 0;
  font-size: 0.9rem;
}

.chat-actions {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}

/* Modal Improvements */
.modal-dialog {
  max-width: 600px;
}

.modal-dialog.modal-xl {
  max-width: 800px;
}

.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.modal-header {
  border-bottom: 1px solid #e9ecef;
  padding: 1.5rem;
}

.modal-body {
  padding: 0;
}

.modal-footer {
  border-top: 1px solid #e9ecef;
  padding: 1rem 1.5rem;
}

/* HTMX Loading Improvements */
.load-more-trigger {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.load-more-trigger[aria-busy="true"] {
  opacity: 0.7;
}

/* Intersection Observer Support */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Dropdown Improvements for HTMX */
.dropdown-menu {
  max-height: 300px;
  overflow-y: auto;
}

#agent-dropdown-results,
#chat-dropdown-results {
  max-height: 220px;
  overflow-y: auto;
}

/* Post Composer HTMX Improvements */
.post-composer form[aria-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.post-composer form[aria-busy="true"] .btn {
  position: relative;
}

.post-composer form[aria-busy="true"] .btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modal Sticky Headers and Footers */
.modal-header.sticky-top {
  position: sticky;
  top: 0;
  z-index: 1030;
  border-bottom: 1px solid #dee2e6;
  background: white;
  margin: 0;
}

/* Removed sticky-bottom - conflicts with modal layout */

.modal-dialog-scrollable .modal-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 1rem;
}

/* Ensure modal content doesn't overflow */
.modal-content {
  max-height: 100vh;
  display: flex;
  flex-direction: column;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

/* Force sticky positioning to work */
.modal-dialog-scrollable {
  max-height: 90vh;
}

.modal-dialog-scrollable .modal-content {
  height: 100%;
}

/* Remove conflicting footer styles - handled in the main modal CSS above */


/* Responsive sidebar improvements */
@media (max-width: 991px) {
  .user-profile-sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .user-profile-sidebar.show {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: block;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle {
    display: none;
  }
}

/* ===== LINT FIX: Inline style replacements ===== */

/* Button hover effects */
.btn-hover-muted {
  --bs-btn-hover-bg: rgba(0,0,0,0.1);
}

/* Dropdown menu min-widths */
.dropdown-menu-140 {
  min-width: 140px;
}

/* Action icon containers */
.action-icon-container {
  width: 24px;
  height: 24px;
  background-color: #e3f2fd;
}

.action-icon-container.edit {
  background-color: #e3f2fd;
}

.action-icon-container.delete {
  background-color: #ffebee;
}

/* Icon font sizes */
.icon-xs {
  font-size: 12px;
}

/* Chat title truncation */
.chat-title-truncate {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* ===== Modern Dropdown Styles ===== */
.hover-item:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
  transform: translateX(2px);
}

.hover-item.text-danger:hover {
  background-color: rgba(220, 53, 69, 0.08) !important;
  color: #dc3545 !important;
}

.modern-dropdown {
  width: 80px;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 0.5rem;
  padding: 0.25rem 0;
}

.modern-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin: 0 0.25rem;
  transition: all 0.15s ease;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

.modern-dropdown-item i {
  font-size: 0.65rem;
  margin-right: 0.375rem;
  flex-shrink: 0;
}

/* ===== Chat Interface Styles ===== */
.chat-list-item {
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.15s ease;
  position: relative;
  min-height: 32px;
}

.chat-list-item:hover {
  background-color: rgba(0, 0, 0, 0.03) !important;
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

.chat-list-item.active-chat {
  background-color: rgba(13, 110, 253, 0.03);
  border-bottom-color: rgba(13, 110, 253, 0.15) !important;
}

.chat-list-item.active-chat .chat-indicator div {
  background-color: var(--bs-primary) !important;
  width: 4px !important;
  height: 4px !important;
  opacity: 1 !important;
}

.chat-list-item.active-chat .chat-title-text {
  color: var(--bs-primary) !important;
  font-weight: 500 !important;
}

.chat-list-item .chat-actions {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.chat-list-item:hover .chat-actions {
  opacity: 1;
}

.chat-indicator-active {
  width: 4px;
  height: 4px;
}

.chat-indicator-inactive {
  width: 3px;
  height: 3px;
  opacity: 0.4;
}

.chat-title-text {
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.chat-badge {
  font-size: 0.65rem;
  line-height: 1;
}

.chat-actions-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  line-height: 1;
}

.chat-actions-icon {
  font-size: 0.65rem;
  line-height: 1;
}

/* Hide the dropdown caret */
.chat-actions::after {
  display: none !important;
}

.hover-bg-subtle:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
}

.border-light {
  border-color: rgba(0, 0, 0, 0.04) !important;
}

/* ===== Project Styles ===== */
.project-toggle {
  cursor: pointer;
}

.project-icon-sm {
  font-size: 0.7rem;
}

.project-icon-md {
  font-size: 0.8rem;
}

.project-icon-xs {
  font-size: 0.75rem;
}

.empty-state-icon {
  font-size: 0.8rem;
  opacity: 0.5;
}

.transition {
  transition: all 0.15s ease;
}

.hover-bg-subtle:hover {
  background-color: rgba(0, 0, 0, 0.03) !important;
}

.project-toggle .chevron {
  transform: rotate(0deg);
}

.project-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

/* ===== Button Styles ===== */
.btn-clean {
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-width: 1px;
}

.btn-clean:hover {
  transform: translateY(-1px);
}

.btn-outline-secondary.btn-clean {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
  color: #6c757d;
}

.btn-outline-secondary.btn-clean:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
  color: #495057;
}

.btn-primary.btn-clean {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
}

.btn-primary.btn-clean:hover {
  background: #0056b3;
  border-color: #0056b3;
}

.btn-icon-sm {
  font-size: 0.8rem;
}

/* ===== Clickable Media Styles ===== */
.message-image-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-image-clickable:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-table-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.message-table-clickable:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.message-table-clickable::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 110, 253, 0.05);
  border-radius: 0.375rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.message-table-clickable:hover::after {
  opacity: 1;
}

.clickable-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-image-clickable:hover .clickable-overlay,
.message-table-clickable:hover .clickable-overlay {
  opacity: 1;
}

/* ===== Image Zoom Styles ===== */
.image-container {
  position: relative;
  overflow: hidden;
}

.image-zoom {
  cursor: zoom-out;
  transition: transform 0.3s ease;
}

/* ===== Chart Image Styles ===== */
.chart-image {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== Message Action Button Styles ===== */
.view-raw-data,
.preview-site {
  opacity: 0.7;
  transition: all 0.2s ease;
}

.view-raw-data:hover,
.preview-site:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.tool-execution-item:hover .view-raw-data {
  opacity: 1;
}

/* ===== Modern Message Action Buttons ===== */
.modern-action-btn {
  border-radius: 20px;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  transition: all 0.2s ease;
  border-width: 1px;
  font-size: 0.75rem;
}

.modern-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modern-action-btn i {
  font-size: 0.7rem;
}

.modern-mini-btn {
  border-radius: 50%;
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modern-mini-btn:hover {
  transform: scale(1.1);
}

.modern-mini-btn i {
  font-size: 0.7rem;
}

/* ===== Modern Collapse Content ===== */
.modern-collapse-content {
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-top: 0.5rem;
}

.modern-tool-item {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08) !important;
  transition: all 0.2s ease;
}

.modern-tool-item:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.12) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.action-buttons-group {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 0.5rem;
}

.action-content-container {
  width: 100%;
  clear: both;
}

.action-content-container .collapse {
  width: 100%;
}

.action-content {
  margin-top: 0.5rem;
}

/* ===== Tool Status Styling ===== */
.tool-status-completed {
  border-left: 3px solid var(--bs-success) !important;
}

.tool-status-failed {
  border-left: 3px solid var(--bs-danger) !important;
}

.tool-status-pending {
  border-left: 3px solid var(--bs-warning) !important;
}

/* ===== Code Syntax Highlighting ===== */
.sql-code {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 1rem;
  color: #1d1d1d;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  max-height: none;
}

.python-code {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 1rem;
  color: #1d1d1d;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  max-height: none;
}

/* ===== Raw Data Modal Specific Styles ===== */
.modal .nav-tabs {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.modal .nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.2s ease;
}

.modal .nav-tabs .nav-link:hover {
  border-bottom-color: rgba(13, 110, 253, 0.3);
  color: #495057;
}

.modal .nav-tabs .nav-link.active {
  border-bottom-color: var(--bs-primary);
  color: var(--bs-primary);
  background: none;
}

.modal pre {
  max-height: 60vh;
  overflow-y: auto;
  font-size: 0.8rem;
  border-radius: 0.375rem;
}

.modal table {
  margin-bottom: 0;
}

.modal .table-responsive {
  max-height: 60vh;
  overflow-y: auto;
}

/* ===== SQL Results Table Styling ===== */
.sql-results-table {
  margin-bottom: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.sql-results-table thead th {
  background-color: #212529 !important;
  color: white !important;
  border-color: #32383e !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

.sql-results-table tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.1) !important;
}

.sql-table-wrapper {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  max-height: 50vh;
  overflow-y: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sql-table-wrapper::-webkit-scrollbar {
  width: 8px;
}

.sql-table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.sql-table-wrapper::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.sql-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* ===== Chart Image Styling (consistent for all messages) ===== */
.message-content img {
  border-radius: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  max-width: 100%;
  height: auto;
}

.message-content img:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Chart images specifically */
.chart-image {
  border-radius: 0.5rem !important;
  cursor: pointer !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  max-width: 100% !important;
  height: auto !important;
}

.chart-image:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Image viewer chart handling */
.image-zoom {
  border-radius: 0.5rem;
  transition: transform 0.2s ease;
}

/* Ensure charts in Raw Data Modal also get proper styling */
.modal .chart-image {
  border-radius: 0.5rem;
  max-height: 300px;
  cursor: pointer;
}

.modal .chart-image:hover {
  transform: scale(1.02);
}

/* Chart styling */
.message-content img,
.chart-image {
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.message-content img:hover,
.chart-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal .chart-image {
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}

/* Web search results styling */
.web-search-query {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.web-search-results {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.search-result-card {
  background: #ffffff;
  border: 1px solid #e9ecef !important;
  border-radius: 8px !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-result-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: #dee2e6 !important;
}

.search-result-card h6 a {
  color: #0066cc;
  font-weight: 600;
  line-height: 1.3;
}

.search-result-card h6 a:hover {
  color: #0052a3;
  text-decoration: underline !important;
}

.search-result-card .text-muted {
  font-size: 0.875rem;
  line-height: 1.4;
}

.search-result-card .preview-site {
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.search-results-container {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.search-results-container::-webkit-scrollbar {
  width: 6px;
}

.search-results-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.search-results-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* ===== Modal Image Viewer Styles ===== */
.modal-image-container {
  max-height: 70vh;
  overflow: auto;
}

.modal-image-viewer {
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
}

/* ===== Site Preview Modal Styles ===== */
.site-preview-container {
  height: 70vh;
}

.site-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
}

  /* Additional border styles for chat form */
  .chat-form-border {
    border-top: 1px solid #dee2e6;
  }

  /* File size styling for previews */
  .file-size-small {
    font-size: 0.75rem;
  }

  /* ===== MOBILE OPTIMIZATION ===== */

  /* Mobile navigation - show sidebar links in hamburger menu */
  .mobile-main-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-main-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    font-weight: 600;
  }

  /* Navbar logo visibility - hide Robroy logo on small screens */
  @media (max-width: 389px) {
    .navbar-logo-robroy {
      display: none !important;
    }

    .navbar-brand {
      padding: 0.25rem 0.5rem !important;
    }
  }

  /* Mobile header buttons - in thread header */
  .mobile-header-btn {
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    border-width: 1.5px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .mobile-header-btn i {
    font-size: 1.2rem;
  }

  .mobile-header-btn:hover {
    transform: scale(1.05);
  }

  .mobile-header-btn:active {
    transform: scale(0.95);
  }

  /* Active state for mobile buttons when their panel is open */
  .mobile-header-btn.active {
    background-color: var(--bs-primary) !important;
    color: white !important;
    border-color: var(--bs-primary) !important;
  }

  /* Mobile backdrop overlay */
  .mobile-backdrop {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9997 !important; /* Below sidebars (9998) but above everything else */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    will-change: opacity;
  }

  .mobile-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* Utility class for min-width: 0 (allows flex items to shrink) */
  .min-w-0 {
    min-width: 0;
  }

  .mobile-close-btn {
    color: #6c757d;
    transition: all 0.2s ease;
  }

  .mobile-close-btn:hover {
    color: #dc3545;
    transform: scale(1.1);
  }

  /* Fix dropdown menus in mobile sidebars - ensure they appear above everything */
  .chat-selector-col .dropdown-menu,
  .artifacts-col .dropdown-menu,
  #mobile-chat-selector .dropdown-menu,
  #artifacts-pane .dropdown-menu,
  .chat-list-item .dropdown-menu,
  .modern-dropdown {
    z-index: 9999 !important; /* Above everything: backdrop (1035), sidebars (9998) */
    position: absolute !important;
  }

  /* Dropdown toggle buttons */
  .chat-selector-col .dropdown,
  .artifacts-col .dropdown,
  .chat-list-item .dropdown,
  #mobile-chat-selector .dropdown,
  #artifacts-pane .dropdown {
    position: static !important; /* Allow dropdown to escape normal flow */
  }

  /* Chat list item should allow overflow for dropdowns */
  .chat-list-item {
    position: relative;
    overflow: visible !important;
  }

  /* Chat list container overflow handling */
  #chat-list,
  .chat-selector-col .overflow-auto {
    overflow-y: auto !important;
    overflow-x: visible !important; /* Allow dropdowns to escape horizontally */
  }

  /* Mobile responsive breakpoints */
  @media (max-width: 767px) {
    /* Hide desktop sidebar navigation on mobile */
    #sidebarMenu {
      display: none !important;
    }

    /* Remove sidebar padding from main content */
    .main {
      padding-left: 0 !important;
    }

    /* Fix for iOS Safari viewport height issues */
    /* Use CSS custom property set by JavaScript for accurate viewport height */
    body {
      position: fixed;
      width: 100%;
      height: 100vh; /* Fallback */
      height: calc(var(--vh, 1vh) * 100); /* Use JS-calculated height */
      overflow: hidden;
      /* Support for iOS safe area (notch) */
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
    }

    .main {
      height: 100%;
      overflow: hidden;
    }

    /* Navbar adjustment for iOS safe area */
    .navbar {
      padding-top: max(0.5rem, env(safe-area-inset-top));
    }

    /* Chat outer wrapper - mobile layout with iOS Safari fix */
    .chat-outer-wrapper {
      flex-direction: column;
      position: fixed !important;
      top: 70px;
      left: 0;
      right: 0;
      bottom: 0;
      height: calc(var(--vh, 1vh) * 100 - 70px) !important;
      width: 100vw !important;
      max-width: 100vw !important;
      margin: 0 !important;
      padding: 0 !important;
      border-radius: 0 !important;
      gap: 0 !important;
      overflow: hidden !important;
      z-index: auto; /* Don't create stacking context - let children manage their own z-index */
      isolation: isolate; /* Create isolated stacking context for children */
    }

    /* Chat selector - hidden by default on mobile, slides in from left */
    .chat-selector-col,
    aside.chat-selector-col,
    #mobile-chat-selector {
      display: flex !important; /* Override any display: none */
      position: fixed !important;
      top: 70px;
      left: 0;
      bottom: 0;
      width: 80vw !important;
      max-width: 320px !important;
      min-width: 280px !important;
      flex-basis: auto !important;
      height: calc(var(--vh, 1vh) * 100 - 70px) !important;
      z-index: 9998 !important; /* Very high - above backdrop */
      transform: translateX(-100%);
      transition: transform 0.3s ease-in-out;
      will-change: transform;
      box-shadow: none;
      border-radius: 0 !important;
      margin: 0 !important;
      flex-direction: column;
    }

    .chat-selector-col.mobile-show,
    aside.chat-selector-col.mobile-show,
    #mobile-chat-selector.mobile-show {
      transform: translateX(0) !important;
      z-index: 9998 !important; /* Ensure it stays above backdrop when shown */
      box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* Main chat thread - full screen on mobile with iOS fix */
    .chat-main-thread {
      flex: 1 !important;
      width: 100% !important;
      max-width: 100% !important;
      min-width: 100% !important;
      height: 100% !important;
      margin: 0 !important;
      padding: 0 !important;
      border-radius: 0 !important;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    /* Chat container - prevent scrolling */
    .chat-container {
      height: 100% !important;
      max-height: 100% !important;
      overflow: hidden !important;
      display: flex;
      flex-direction: column;
    }

    /* Messages area - should scroll, but within container */
    [id^="messages-"].messages-scroll {
      flex: 1 1 auto;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
      min-height: 0;
    }

    /* Chat input row - fixed at bottom */
    .chat-input-row {
      flex-shrink: 0;
      position: relative;
      padding-bottom: env(safe-area-inset-bottom, 0); /* iOS safe area */
    }

    /* Artifacts pane - hidden by default on mobile, slides in from right */
    .artifacts-col,
    aside.artifacts-col,
    #artifacts-pane {
      display: flex !important; /* Override any display: none from other media queries */
      position: fixed !important;
      top: 70px;
      right: 0;
      bottom: 0;
      width: 85vw !important;
      max-width: 100vw !important;
      height: calc(var(--vh, 1vh) * 100 - 70px) !important;
      z-index: 9998 !important; /* Very high - above backdrop */
      transform: translateX(100%);
      transition: transform 0.3s ease-in-out;
      will-change: transform;
      box-shadow: none;
      border-radius: 0 !important;
      margin: 0 !important;
      flex-basis: auto !important;
      min-width: auto !important;
      flex-direction: column;
    }

    .artifacts-col.mobile-show,
    aside.artifacts-col.mobile-show,
    #artifacts-pane.mobile-show {
      transform: translateX(0) !important;
      z-index: 9998 !important; /* Ensure it stays above backdrop when shown */
      box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* Chat messages - adjust for mobile */
    [id^="messages-"] {
      max-width: 100vw !important;
      padding-left: 0.5rem !important;
      padding-right: 0.5rem !important;
    }

    /* Message bubbles - more compact on mobile */
    .message-bubble {
      max-width: min(90vw, 500px) !important;
      font-size: 0.9rem;
      padding: 0.75rem !important;
    }

    .message-bubble-user {
      max-width: min(85vw, 450px) !important;
    }

    /* Chat header - more compact with mobile buttons */
    .chat-header {
      padding: 0.75rem 0.5rem !important;
      min-height: 52px !important;
      gap: 0.5rem !important;
    }

    .chat-header h5 {
      font-size: 0.9rem !important;
    }

    .thread-title-truncate {
      max-width: 150px !important;
    }

    /* Hide avatars on very small screens to save space */
    .chat-header .gap-neg-8 {
      display: none !important;
    }

    /* Show only title and mobile buttons on mobile */
    .chat-header .flex-grow-1 {
      justify-content: center;
    }

    /* Avatar adjustments */
    .avatar-32 {
      width: 28px !important;
      height: 28px !important;
    }

    /* Message textarea - optimize for mobile keyboards */
    .message-textarea {
      font-size: 16px !important; /* Prevents iOS zoom */
      padding: 10px 12px !important;
    }

    .send-btn,
    .attachment-btn {
      min-width: 44px !important;
      height: 44px !important; /* iOS recommended touch target */
    }

    /* Sidebar vertical margins - remove on mobile */
    .sidebar-vertical-margin {
      margin-top: 0 !important;
      margin-bottom: 0 !important;
    }

    /* Output tab content - full width on mobile */
    .composed-output {
      padding: 0.75rem !important;
    }

    .document-sheet {
      padding: 10px 12px !important;
      font-size: 0.85rem;
    }

    /* Thinking steps - more compact */
    .thinking-message {
      max-width: 95% !important;
      padding: 0.75rem !important;
    }

    .thinking-step-content {
      padding: 8px 10px !important;
    }

    /* File attachments preview - compact */
    .file-preview-item {
      min-width: 150px;
      max-width: 200px;
    }

    /* Modal adjustments for mobile */
    .modal-dialog {
      margin: 0.5rem !important;
      max-width: calc(100vw - 1rem) !important;
    }

    /* Chat list items - more compact */
    .chat-list-item {
      padding: 6px 10px !important;
      font-size: 0.85rem !important;
    }

    .chat-title-text {
      font-size: 0.85rem !important;
    }

    /* Search input - full width */
    #chat-search-input {
      font-size: 16px !important; /* Prevents iOS zoom */
    }

    /* Action buttons - more compact */
    .btn-clean {
      font-size: 0.8rem !important;
      padding: 0.4rem 0.75rem !important;
    }

    /* Dropdown menus - full width on mobile */
    .dropdown-menu {
      max-width: 90vw !important;
    }

    /* Prevent horizontal scrolling */
    body {
      overflow-x: hidden !important;
      max-width: 100vw !important;
    }

    .chat-container {
      max-width: 100vw !important;
      overflow-x: hidden !important;
    }

    /* Ensure all flex containers respect viewport */
    .d-flex,
    .flex-row {
      max-width: 100vw !important;
    }

    /* Agent mention dropdown - adjust for mobile */
    #agent-mention-dropdown {
      max-width: 80vw !important;
      left: 10px !important;
      right: 10px !important;
    }

    /* Multi-agent controls - stack vertically on mobile */
    #multi-agent-controls .row {
      flex-direction: column !important;
    }

    #multi-agent-controls .col-md-6 {
      width: 100% !important;
      margin-bottom: 0.5rem;
    }
  }


  /* Medium desktop (768px - 1499px) - show output toggle button */
  @media (min-width: 768px) and (max-width: 1499px) {
    /* Show the output button since artifacts are hidden by default */
    #mobile-toggle-output {
      display: inline-flex !important;
    }

    /* Chat selector is visible, not a slide-in */
    .chat-selector-col,
    aside.chat-selector-col,
    #mobile-chat-selector {
      display: flex !important;
      position: relative !important;
      transform: none !important;
      transition: none !important;
      flex: 0 0 220px;
      max-width: 260px;
      width: auto !important;
      height: auto !important;
      top: auto;
      left: auto;
      bottom: auto;
      z-index: auto;
    }

    /* Output still slides in on these sizes - same as mobile */
    .artifacts-col,
    aside.artifacts-col,
    #artifacts-pane {
      display: flex !important;
      position: fixed !important;
      top: 70px;
      right: 0;
      bottom: 0;
      width: 50vw !important; /* Responsive width for medium screens */
      max-width: 600px !important;
      min-width: 400px !important;
      height: calc(100vh - 70px) !important;
      z-index: 9998 !important; /* Very high - above backdrop */
      transform: translateX(100%);
      transition: transform 0.3s ease-in-out;
      will-change: transform;
      flex-direction: column;
      border-radius: 0 !important;
      margin: 0 !important;
    }

    .artifacts-col.mobile-show,
    aside.artifacts-col.mobile-show,
    #artifacts-pane.mobile-show {
      transform: translateX(0) !important;
      z-index: 9998 !important; /* Ensure it stays above backdrop when shown */
      box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* Show close button in output panel */
    .artifacts-col .mobile-close-btn {
      display: inline-flex !important;
    }

    /* Hide chat toggle button since chat list is always visible */
    #mobile-toggle-chats {
      display: none !important;
    }

    /* Enable backdrop functionality */
    .mobile-backdrop {
      display: block !important;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .mobile-backdrop.show {
      opacity: 1;
      pointer-events: auto;
    }
  }

  /* Large Desktop - sidebar visible but hamburger menu still present (1200px-1499px) */
  @media (min-width: 1200px) and (max-width: 1499px) {
    /* Sidebar is visible (from earlier media query) */
    /* Hamburger menu still visible (Bootstrap .navbar-expand-xl) */

    /* Mobile-main-nav hidden (sidebar items now in sidebar) */
    .mobile-main-nav {
      display: none !important;
    }

    /* Chats button hidden (chat list always visible) */
    #mobile-toggle-chats {
      display: none !important;
    }

    /* Output button visible (artifacts still slide-in) - already handled above */

    /* Chat list always visible */
    .chat-selector-col,
    aside.chat-selector-col {
      display: flex !important;
      position: relative !important;
      transform: none !important;
      transition: none !important;
    }
  }

  /* Extra Large Desktop (1500px and up) - full layout, hide all mobile controls */
  @media (min-width: 1500px) {
    /* All mobile controls hidden */
    .mobile-header-btn {
      display: none !important;
    }

    .mobile-close-btn {
      display: none !important;
    }

    .mobile-main-nav {
      display: none !important;
    }

    .mobile-backdrop {
      display: none !important;
    }

    /* Ensure all sidebars are always visible on extra large desktop */
    .chat-selector-col,
    .artifacts-col {
      transform: none !important;
      position: relative !important;
      transition: none !important;
      display: flex !important;
    }

    /* Ensure dropdown menus work normally on desktop */
    .chat-selector-col .dropdown-menu,
    .artifacts-col .dropdown-menu {
      position: absolute !important; /* Reset to normal dropdown behavior */
    }
  }

  /* Landscape mobile phones - special handling */
  @media (max-width: 767px) and (orientation: landscape) {
    .chat-main-thread {
      height: calc(100vh - 60px) !important; /* Reduced navbar height effect */
    }

    .mobile-header-btn {
      padding: 0.4rem 0.6rem !important;
      min-width: 36px;
      height: 36px;
    }
  }


  /* Very small screens (< 360px) */
  @media (max-width: 359px) {
    .chat-selector-col {
      width: 85vw !important;
      max-width: 85vw !important;
      min-width: 85vw !important;
    }

    .artifacts-col {
      width: 90vw !important;
    }

    .message-bubble {
      max-width: 92vw !important;
      font-size: 0.85rem;
    }

    .mobile-header-btn {
      padding: 0.4rem 0.5rem !important;
      min-width: 36px;
      height: 36px;
    }

    .mobile-header-btn i {
      font-size: 1rem;
    }

    .thread-title-truncate {
      max-width: 120px !important;
      font-size: 0.85rem !important;
    }
  }

/* ===== LINT FIX: Chat Interface Inline Style Replacements ===== */

/* Chat container styles */
.chat-container {
  height: 100vh;
  overflow: hidden;
}

/* Chat pane styles */
.chat-pane {
  min-height: 0;
}

/* Messages container styles */
.messages-container {
  min-height: 0;
  max-height: 100%;
}

/* Chat input row positioning - overrides for specific use case */
.chat-input-row {
  position: relative;
  z-index: 10; /* Override lower z-index values */
}

/* Message bubble border styling */
.message-bubble-agent {
  border-left: 3px solid #DC4C3E;
}

/* ===== Multi-Agent & Mentioned Agents Styles ===== */

/* Mentioned agent badge styling */
.mentioned-agent-badge {
  font-size: 0.7rem;
}

/* Small agent icons in badges */
.agent-icon-small {
  width: 12px;
  height: 12px;
}

/* Tiny agent icons */
.agent-icon-tiny {
  font-size: 10px;
}

/* Agent mention dropdown positioning */
.agent-mention-dropdown {
  z-index: 1000;
  max-width: 300px;
}

/* Multi-agent controls container */
.multi-agent-controls {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
  border-left: 1px solid var(--bs-primary);
}

/* Small font for multi-agent controls */
.multi-agent-text-small {
  font-size: 0.8rem;
}

/* ===== Agent Marketplace Styles ===== */

/* Main marketplace container height adjustment */
.marketplace-container {
  height: calc(100vh - 70px);
}

/* Search input width */
.marketplace-search-input {
  width: 280px;
}

/* Agent card icon container */
.agent-icon-container {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Agent card icon size */
.agent-icon {
  font-size: 24px;
}

/* Agent card header section height */
.agent-card-header {
  min-height: 70px;
}

/* Agent card badges section height */
.agent-card-badges {
  min-height: 32px;
}

/* Agent card rating section height */
.agent-card-rating {
  min-height: 20px;
}

/* Agent card details section height */
.agent-card-details {
  height: 40px;
}

/* Agent card description box */
.agent-description-box {
  height: 55px;
  overflow: hidden;
  line-height: 1.3;
}

/* Agent card action section height */
.agent-card-actions {
  min-height: 40px;
}

/* Empty state container */
.empty-state-container {
  min-height: 60vh;
}

/* Empty state icon container */
.empty-state-icon {
  height: 35vh;
}

/* Empty state icon size */
.empty-state-icon i {
  font-size: 20rem;
  opacity: 0.3;
}

/* Agent modal width override */
.agent-marketplace-modal {
  max-width: 90%;
}

/* Create modal body scrolling */
.create-modal-body {
  max-height: 70vh;
}

/* Empty state grid span */
.empty-state-grid-span {
  grid-column: 1 / -1;
}

/* Empty state text styling */
.empty-state-text {
  font-size: 1.1rem;
}

/* ===== WELCOME MODAL STYLES (Lint Fix) ===== */

/* Welcome modal header styling */
.welcome-modal-header {
  padding: 1.5rem;
}

/* Welcome modal icon styling */
.welcome-modal-icon-container {
  width: 80px;
  height: 80px;
  padding: 4px; /* Minimal padding to keep border visible */
}

.welcome-modal-rosie-icon {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
}

/* Welcome back modal header styling */
.welcome-back-modal-header {
  padding: 2rem;
}

/* Welcome back modal icon styling */
.welcome-back-modal-icon-container {
  width: 80px;
  height: 80px;
  padding: 4px; /* Minimal padding to keep border visible */
}

.welcome-back-modal-rosie-icon {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
}

/* Welcome modal step icons */
.welcome-step-icon {
  font-size: 2.5rem;
}

/* Welcome modal button display none */
.welcome-modal-btn-hidden {
  display: none;
}

/* Step indicators styling */
.step-indicators {
  display: flex;
  gap: 8px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #dee2e6;
  transition: background-color 0.3s ease;
  cursor: pointer;
}

.step-dot.active {
  background-color: #0d6efd;
}

.welcome-step {
  min-height: 350px;
}

.modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

/* ===== USER DASHBOARD STYLES (Lint Fix) ===== */

/* User dashboard icon container */
.user-dashboard-icon-container {
  width: 60px;
  height: 60px;
}

/* User dashboard icon */
.user-dashboard-icon {
  font-size: 1.5rem;
}

/* Dashboard chart container */
.dashboard-chart-container {
  height: 300px;
}

/* Dashboard skeleton loaders */
.skeleton-metric {
  width: 60px;
  height: 2rem;
}

.skeleton-chart {
  width: 100%;
  height: 200px;
}

.skeleton-chart-label {
  width: 150px;
  height: 1.2rem;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== Logout Page Styles ===== */
.logout-rosie-avatar {
  width: 80px;
  height: 80px;
  background: white;
  border: 3px solid #dc3545;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.logout-rosie-icon {
  width: 60px;
  height: 60px;
  border: 2px solid rgba(220, 53, 69, 0.1);
}

.logout-farewell-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.logout-farewell-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.logout-action-buttons .btn {
  transition: all 0.3s ease;
  font-weight: 500;
}

/* ===== Tour Snapshot Styles (Moved from inline) ===== */
.tour-preview-container {
  height: 280px;
  overflow: auto;
  background: #f8f9fa;
}

/* ===== Enhanced Welcome Modal Styles (Moved from inline) ===== */
.welcome-modal-body {
  height: 60vh;
  min-height: 400px;
  max-height: 600px;
}

.welcome-avatar-circle {
  width: 60px;
  height: 60px;
}

.welcome-avatar-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 50%;
}

.memory-import-prompt-container {
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
}

.memory-import-prompt-pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.7rem;
  line-height: 1.2;
  font-family: 'Courier New', monospace;
}

.conversation-card {
  height: 450px;
}

.conversation-messages {
  height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
}

.logout-action-buttons .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logout-footer-message {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid #e9ecef;
}

.logout-rosie-mini {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(220, 53, 69, 0.2);
}

/* ===== Welcome Modal Introduction Step ===== */
.welcome-intro-avatar {
  width: 60px;
  height: 60px;
}

.welcome-intro-rosie {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 50%;
}

.welcome-intro-mini {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 50%;
  margin-right: 8px;
}

/* ===== Memory Container Scrollable ===== */
.memory-scroll-container {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 0.75rem;
  background-color: #fafafa;
}

.memory-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.memory-scroll-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.memory-scroll-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.memory-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Empty state styling within scroll container */
.memory-scroll-container .text-center {
  padding: 2rem 1rem;
}

/* ===== Memory Import Template Styles ===== */
.memory-import-rosie-avatar {
  width: 40px;
  height: 40px;
}

.memory-import-prompt-container {
  max-height: 300px;
  overflow-y: auto;
}

/* ===== Enhanced Memories Modal Styles ===== */
.memories-modal-content {
  padding: 0;
}

/* ===== LINT FIX: Agent Marketplace Inline Style Replacements ===== */

/* Agent icon container sizing */
.agent-icon-container-3rem {
  width: 3rem;
  height: 3rem;
}

/* Agent custom icon styling */
.agent-custom-icon {
  width: 48px;
  height: 48px;
  object-fit: cover;
  object-position: center;
}

/* Agent bootstrap icon sizing */
.agent-bootstrap-icon {
  font-size: 1.5rem;
}

/* Avatar icon styling for thread header */
.avatar-icon-fill {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-bootstrap-icon {
  font-size: 16px;
}

/* Dropdown agent icon styling */
.dropdown-agent-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.dropdown-icon-fill {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 50%;
}

.dropdown-bootstrap-icon {
  font-size: 12px;
}

/* Playground loading dots animation */
.playground-loading-dots {
  display: none;
}

.playground-loading-dots.show {
  display: flex;
}

.playground-loading-dots div {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6c757d;
  margin: 0 2px;
  animation: playground-bounce 1.4s ease-in-out infinite both;
}

.playground-loading-dots div:nth-child(1) {
  animation-delay: -0.32s;
}

.playground-loading-dots div:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes playground-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Agent playground message bubble user styling */
.playground-message-bubble-user {
  background-color: var(--bs-primary);
}

/* Agent modal content icon sizing */
.agent-modal-icon {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
  object-position: center;
}

.agent-modal-icon-bootstrap {
  font-size: 2rem;
}

/* Chat interface agent icon sizing */
.chat-agent-icon {
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  object-position: center;
}

.chat-agent-icon-bootstrap {
  font-size: 1rem;
}

/* Community post agent icon sizing */
.community-agent-icon {
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  object-position: center;
}

.community-agent-icon-bootstrap {
  font-size: 1rem;
}

/* Preview agent icon sizing */
.preview-agent-icon {
  width: 64px;
  height: 64px;
  object-fit: cover;
  object-position: center;
}

.preview-agent-icon-bootstrap {
  font-size: 3rem;
}

/* Filter Bar Styles */
.memories-filter-bar {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #dee2e6;
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  z-index: 2;
}

.search-input {
  padding-left: 40px;
  padding-right: 40px;
  border-radius: 25px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  background: white;
}

.search-input:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.1);
  background: white;
}

.search-focused .search-icon {
  color: #dc3545;
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.search-clear-btn:hover {
  background: #f8f9fa;
  color: #dc3545;
}

.filter-select {
  border-radius: 12px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

.filter-select:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.1);
}

.refresh-btn {
  border-radius: 12px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  border-color: #dc3545;
  color: #dc3545;
}

/* Results Summary */
.memories-summary {
  margin-bottom: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e9ecef;
}

.results-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: #dc3545;
}

.results-text {
  color: #6c757d;
  margin-left: 0.25rem;
}

.filter-indicator {
  margin-left: 1rem;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  background: #dc3545;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.875rem;
  margin-right: 0.5rem;
}

.filter-tag-close {
  background: none;
  border: none;
  color: white;
  margin-left: 0.5rem;
  cursor: pointer;
  font-weight: bold;
  padding: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.filter-tag-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pagination-info {
  color: #6c757d;
  font-size: 0.875rem;
}

/* Memory Cards Grid */
.memories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.memory-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.memory-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #dc3545;
}

.memory-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem 0.75rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.memory-category-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.memory-importance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.importance-stars {
  display: flex;
  gap: 2px;
  margin-bottom: 0.25rem;
}

.star-filled {
  color: #ffc107;
  font-size: 0.875rem;
}

.star-empty {
  color: #e9ecef;
  font-size: 0.875rem;
}

.importance-score {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 600;
}

.memory-card-body {
  padding: 0 1.25rem 1rem;
}

.memory-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.memory-content {
  color: #6c757d;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.memory-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.memory-category-badge .category-label {
  background: #e9ecef;
  color: #495057;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.memory-dates {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.date-item {
  display: flex;
  align-items: center;
  color: #6c757d;
  font-size: 0.75rem;
}

.date-item i {
  font-size: 0.7rem;
}

.memory-card-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.memory-card:hover .memory-card-actions {
  opacity: 1;
}

.memory-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.edit-btn {
  background: #17a2b8;
  color: white;
}

.edit-btn:hover {
  background: #138496;
  transform: scale(1.1);
}

.delete-btn {
  background: #dc3545;
  color: white;
}

.delete-btn:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* Modern Pagination */
.memories-pagination {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e9ecef;
}

.pagination-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  color: #495057;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

.pagination-btn:hover {
  border-color: #dc3545;
  color: #dc3545;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
}

.pagination-numbers {
  display: flex;
  gap: 0.5rem;
}

.pagination-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  background: white;
  color: #495057;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

.pagination-number:hover {
  border-color: #dc3545;
  color: #dc3545;
}

.pagination-number.active {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

/* Enhanced Empty State */
.memories-empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-icon {
  font-size: 4rem;
  color: #e9ecef;
  margin-bottom: 1.5rem;
}

.empty-state-title {
  color: #495057;
  font-weight: 600;
  margin-bottom: 1rem;
}

.empty-state-description {
  color: #6c757d;
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.empty-state-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
  .memories-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .memories-filter-bar {
    padding: 1rem;
  }

  .memories-filter-bar .row {
    gap: 1rem;
  }

  .pagination-wrapper {
    flex-direction: column;
    gap: 1rem;
  }

  .pagination-numbers {
    order: -1;
  }
}

/* Chat unread badge styles */
.chat-badge {
  font-size: 0.65rem !important;
  min-width: 18px;
  height: 16px;
  line-height: 16px;
  padding: 0 6px !important;
  margin-left: 4px;
  font-weight: 600;
}

.chat-list-item:hover .chat-badge {
  background-color: var(--bs-primary-dark) !important;
}

/* Ensure badge stays visible even with long chat titles */
.chat-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0; /* Allow flex item to shrink */
}

/* ===== HIGH ZOOM LEVEL RESPONSIVE FIXES ===== */

/* Detect high zoom levels and apply responsive scaling */
@media (max-width: 600px) and (min-resolution: 150dpi),
       (max-width: 800px) and (min-resolution: 200dpi),
       (max-width: 1000px) and (min-resolution: 250dpi) {

  /* Force all containers to use viewport-relative sizing at high zoom */
  .chat-outer-wrapper {
    width: 98vw !important;
    max-width: 98vw !important;
    margin: 0 1vw !important;
  }

  /* Scale down message bubbles more aggressively */
  .message-bubble {
    max-width: min(500px, 90vw) !important;
    font-size: 0.85rem;
  }

  .message-bubble-user {
    max-width: min(70%, 85vw) !important;
  }

  .message-content {
    max-width: min(70%, 85vw) !important;
  }

  /* Scale down images more aggressively */
  .message-image {
    max-width: min(180px, 35vw) !important;
  }

  /* Ensure sidebars don't take too much space */
  .sidebar-width,
  .chat-selector-col {
    width: min(150px, 15vw) !important;
    min-width: min(120px, 12vw) !important;
    max-width: min(180px, 18vw) !important;
    flex-basis: min(150px, 15vw) !important;
  }

  /* Hide artifacts panel at extreme zoom to save space */
  .artifacts-col {
    display: none !important;
  }

  /* Ensure chat thread takes remaining space efficiently */
  .chat-main-thread {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  /* Scale down form elements */
  .chat-input-row {
    padding: 0.5rem !important;
  }

  .message-textarea {
    font-size: 0.9rem !important;
  }

  /* Scale down buttons */
  .attachment-btn,
  .send-btn {
    min-width: 40px !important;
    height: 40px !important;
  }

  /* Ensure proper text wrapping in all containers */
  * {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
}

/* Ultra-high zoom detection (browser zoom > 300%) */
@media (max-width: 400px) and (min-resolution: 300dpi),
       (max-width: 500px) and (min-resolution: 400dpi) {

  /* Ultra-compact layout */
  .chat-outer-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  /* Hide all sidebars */
  .chat-selector-col,
  .artifacts-col {
    display: none !important;
  }

  /* Full-width chat thread */
  .chat-main-thread {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Ultra-compact message bubbles */
  .message-bubble {
    max-width: 95vw !important;
    font-size: 0.8rem !important;
    padding: 0.5rem !important;
  }

  .message-bubble-user {
    max-width: 90vw !important;
  }

  .message-content {
    max-width: 90vw !important;
  }

  /* Ultra-compact images */
  .message-image {
    max-width: 30vw !important;
  }

  /* Compact form */
  .chat-input-row {
    padding: 0.25rem !important;
  }

  .attachment-btn,
  .send-btn {
    min-width: 36px !important;
    height: 36px !important;
  }
}

/* Additional zoom-agnostic fixes for horizontal overflow prevention */
@media (max-width: 768px) {
  /* Ensure no element can cause horizontal overflow */
  body {
    overflow-x: hidden !important;
  }

  /* Force all flex containers to respect viewport width */
  .d-flex,
  .flex-row,
  .chat-outer-wrapper,
  .chat-container {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Ensure message containers wrap properly */
  .messages-container,
  #messages-* {
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Force break long words in all text content */
  .message-bubble *,
  .message-content *,
  .thinking-step-title,
  .thinking-step-details {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
}

/* ===== Analytics Dashboard Styles ===== */

/* Filter dropdowns */
.analytics-filter-dropdown {
  width: 140px;
  text-align: left;
}

.analytics-dropdown-menu {
  width: 200px;
}

.analytics-dropdown-menu-scrollable {
  width: 200px;
  max-height: 300px;
  overflow-y: auto;
}

.analytics-search-input {
  width: 200px;
}

/* Autocomplete */
.analytics-autocomplete-dropdown {
  position: absolute;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Skeleton loaders for analytics */
.analytics-skeleton-large {
  height: 500px;
}

.analytics-skeleton-medium {
  height: 370px;
}

.analytics-skeleton-small {
  height: 85px;
}

.analytics-skeleton-chart {
  height: 450px;
}

/* Chart containers */
.analytics-chart-container {
  width: 100%;
  height: 100%;
}

.analytics-chart-small {
  min-height: 450px;
}

.analytics-chart-medium {
  min-height: 500px;
  height: 500px;
  width: 100%;
  position: relative;
}

.analytics-chart-large {
  min-height: 550px;
  height: 550px;
}

.analytics-chart-xlarge {
  min-height: 750px;
}

.analytics-chart-370 {
  height: 370px;
  width: 100%;
}

.analytics-chart-400 {
  height: 450px;
  width: 100%;
}

.analytics-chart-500 {
  height: 500px;
  width: 100%;
}

/* Table containers */
.analytics-table-responsive {
  overflow-x: auto;
  max-height: 600px;
}

/* Account header value styling */
.analytics-account-value {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
}

/* Favorite star icon */
.analytics-favorite-icon {
  font-size: 1.5rem;
  cursor: pointer;
}
