/* Adaptive Theme Support using Bootstrap 5 Variables */
body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  min-height: 100vh;
  overflow-x: hidden;
}

.narrative {
  max-inline-size: 40rem;
}


/* Fixed Layout - relaxed for hero scrolling if needed, or keep rigid? 
   The user wants "like DataGen". DataGen scrolls. 
   Let's remove the strict max-height on main-app to allow the new Hero section to exist naturally.
*/
#main-app {
  /* Allow scrolling */
  height: auto;
  overflow: visible;
  padding-bottom: 50px;
}

/* Editor Container - Fixed Size */
#editor-container {
  height: 600px;
  /* Fixed height for editor */
  max-height: 70vh;
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
}

/* Quill Overrides for Theme Compatibility */
.ql-toolbar {
  background-color: var(--bs-tertiary-bg) !important;
  border: none !important;
  border-bottom: 1px solid var(--bs-border-color) !important;
  color: var(--bs-body-color) !important;
}

.ql-container {
  background-color: var(--bs-body-bg) !important;
  border: none !important;
  height: calc(100% - 42px) !important;
  color: var(--bs-body-color) !important;
}

.ql-editor {
  overflow-y: auto !important;
  max-height: 100% !important;
}

/* Placeholder text visibility in all themes */
.ql-editor.ql-blank::before {
  color: var(--bs-secondary-color) !important;
  opacity: 0.6 !important;
}

/* Quill Toolbar Icons - Invert in dark mode if needed */
[data-bs-theme="dark"] .ql-toolbar .ql-stroke {
  stroke: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .ql-toolbar .ql-fill {
  fill: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .ql-toolbar .ql-picker {
  color: var(--bs-body-color) !important;
}

/* Demo Cards */
.demo-card {
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-card-bg);
  border-radius: 8px;
  padding: 1rem;
}

.demo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--bs-primary);
}

.demo-card.active {
  border-color: var(--bs-success);
  background: var(--bs-success-bg-subtle);
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

.demo-card h6 {
  font-weight: 600;
  color: var(--bs-card-title-color);
  margin-bottom: 0.5rem;
}

.demo-card small {
  color: var(--bs-secondary-color);
}

/* Cards */
.card {
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  background-color: var(--bs-card-bg);
}

.card-header {
  background-color: var(--bs-tertiary-bg);
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
  color: var(--bs-card-cap-color);
}

/* Agent Activity Panel */
.agent-item {
  border-left: 4px solid;
  background: var(--bs-tertiary-bg);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  transition: all 0.2s ease;
  color: var(--bs-body-color);
}

.agent-item.working {
  animation: working-pulse 2s ease-in-out infinite;
  border-left-width: 6px;
  /* Make border thicker while working */
}

@keyframes working-pulse {
  0% {
    background-color: var(--bs-tertiary-bg);
    transform: scale(1);
    box-shadow: none;
  }

  50% {
    background-color: var(--bs-secondary-bg);
    /* Flash lighter */
    transform: scale(1.01);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  100% {
    background-color: var(--bs-tertiary-bg);
    transform: scale(1);
    box-shadow: none;
  }
}

.agent-item:hover {
  cursor: pointer;
  background-color: var(--bs-secondary-bg) !important;
  transform: translateX(4px);
}

.agent-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* Sample Prompts */
.sample-prompt {
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid var(--bs-primary);
  background: var(--bs-tertiary-bg);
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  color: var(--bs-body-color);
}

.sample-prompt:hover {
  background: var(--bs-secondary-bg);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bs-tertiary-bg);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--bs-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bs-secondary-text);
}

/* Cursor Enhancements - Make Agent Cursors VERY Visible */
.ql-cursor-caret-container {
  z-index: 100 !important;
}

.ql-cursor-caret {
  width: 3px !important;
  /* Thicker cursor */
  animation: cursor-blink 1s ease-in-out infinite !important;
}

@keyframes cursor-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.ql-cursor-flag {
  white-space: nowrap;
  font-size: 12px !important;
  font-weight: bold;
  padding: 3px 8px !important;
  border-radius: 4px;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
  animation: flag-pulse 2s ease-in-out infinite;
}

@keyframes flag-pulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  }
}

.ql-cursor-flag-container {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Agent Text Highlighting - Each agent gets their unique color */
[class*="agent-id-"] {
  /* Background will be set dynamically per agent via inline styles */
  border-bottom: 2px solid currentColor;
  padding: 2px 4px;
  border-radius: 2px;
  animation: text-highlight-pulse 2s ease-in-out infinite;
  position: relative;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

@keyframes text-highlight-pulse {

  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.01);
  }
}

/* Glow effect for actively typing agent */
.ql-editor [class*="agent-id-"]:last-of-type {
  animation: typing-glow 1.5s ease-in-out infinite;
}

@keyframes typing-glow {

  0%,
  100% {
    box-shadow: 0 0 8px currentColor;
    filter: brightness(1.1);
  }

  50% {
    box-shadow: 0 0 20px currentColor;
    filter: brightness(1.3);
  }
}

/* Activity Log */
#logs {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  background: var(--bs-tertiary-bg);
  border-radius: 4px;
  padding: 0.5rem;
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
}

/* Parent Agent Card (Custom Colors need to be readable in dark mode) */
#parent-agent-card {
  border: 2px solid var(--bs-warning);
}

#parent-agent-card .card-header {
  background: var(--bs-warning-bg-subtle);
  color: var(--bs-warning-text-emphasis);
  font-weight: 600;
}

#parent-agent-info {
  /* Force dark text for readability on light/warning backgrounds */
  color: #000 !important;
}

[data-bs-theme="dark"] #parent-agent-info {
  color: #fff !important;
}

/* Fixed Panels - No Overflow */
#agent-activity-container {
  height: 300px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
}

/* Layout Utilities */
.row {
  margin-left: 0;
  margin-right: 0;
}

.col-lg-7,
.col-lg-5 {
  padding-left: 12px;
  padding-right: 12px;
}

/* Hero Section Enhancements */
#hero-section {
  padding: 1.5rem 1rem;
  margin-bottom: 1rem !important;
}

.text-gradient {
  background: linear-gradient(135deg, var(--bs-primary) 0%, #d63384 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

/* Feature Badges */
.feature-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--bs-body-color);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
  cursor: default;
}

[data-bs-theme="dark"] .feature-badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--bs-light);
}

.feature-badge:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="dark"] .feature-badge:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Typography Tweaks for Hero */
.display-2 {
  font-size: 4.5rem;
  /* Bigger title */
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .display-2 {
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.narrative p.lead {
  font-size: 1.35rem;
  line-height: 1.7;
  font-weight: 400;
  color: var(--bs-secondary-color);
  max-width: 800px;
  margin-right: auto;
}

/* DIFF VIEW STYLING */
.diff-del {
  text-decoration: line-through;
  color: #dc3545;
  /* Bootstrap danger */
  background-color: rgba(220, 53, 69, 0.1);
}

.diff-ins {
  text-decoration: underline;
  color: #198754;
  /* Bootstrap success */
  background-color: rgba(25, 135, 84, 0.1);
}