/* css styles */
#quarto-header {
    background-color: #593196;
    color: white; /* Ensure text is readable */
}


/* --- Prompt Box Component Styles --- */
.prompt-box {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  display: flex;       
  flex-direction: column;
}

/* The Generated Header (JS will create this) */
.prompt-header {
  display: flex;
  width: 100%;
  border-bottom: 1px solid #dee2e6;
  order: -1; 
}

/* The Buttons */
.prompt-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f8f9fa;
  color: #6c757d;
  transition: all 0.2s ease;
}

.prompt-tab:first-child { border-right: 1px solid #dee2e6; }
.prompt-tab:hover { background: #e9ecef; color: #495057; }

/* Active States */
.prompt-tab.active-bad { background: #fff5f5; color: #dc3545; box-shadow: inset 0 -2px 0 #dc3545; }
.prompt-tab.active-good { background: #f0fff4; color: #198754; box-shadow: inset 0 -2px 0 #198754; }

/* Content Areas */
.prompt-box .bad, 
.prompt-box .good { 
  padding: 20px; 
  display: none;
}

/* Visible State - JS adds this class */
.prompt-box .bad.visible, 
.prompt-box .good.visible { 
  display: block; 
  animation: fadeIn 0.3s ease; 
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Helper classes for text formatting */
.prompt-text { 
  font-style: italic; 
  color: #495057; 
  margin-bottom: 1rem; 
  padding-left: 1rem; 
  border-left: 3px solid #dee2e6; 
}

.prompt-explanation { 
  margin-top: 1rem; 
  padding: 1rem; 
  border-radius: 4px; 
  font-size: 0.95rem; 
}

.explain-bad { background: #fff5f5; color: #a61b29; }
.explain-good { background: #f0fff4; color: #155724; }

/* Image styling */
.prompt-box img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-top: 1rem;
  border-radius: 4px;
  border: 1px solid #dee2e6;
}


/* --- Transform Stack Component Styles --- */
.transform-stack {
  margin-bottom: 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  background: white;
  padding: 10px 20px;
}

/* Original content - Red */
.transform-stack .original {
  background: #fff5f5;
  border-left: 4px solid #dc3545;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 10px;
}

/* Reduce padding when original section contains code blocks */
.transform-stack .original:has(pre) {
  padding: 0;
}

.transform-stack .original pre {
  margin: 0;
  padding: 20px;
  background: #fff5f5;
  border: none;
  border-radius: 0;
}

.transform-stack .original pre code {
  background: #fff5f5;
  border: none;
  padding: 0;
}

.transform-stack .original div.sourceCode {
  border: none !important;
}

/* Special handling for images in original section */
.transform-stack .original img {
  padding: 0;
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
}

/* Prompt section - Yellow */
.transform-stack .prompt {
  background: white;
  margin-bottom: 10px;
}

.transform-stack .prompt p {
  margin: 0;
  padding: 15px 20px;
  font-style: italic;
  color: #856404;
  font-weight: 500;
  background: #fffbf0;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
}

/* Improved content - Green */
.transform-stack .improved {
  background: #f0fff4;
  border-left: 4px solid #198754;
  border-radius: 4px;
  padding: 20px;
}

/* Reduce padding when improved section contains code blocks */
.transform-stack .improved:has(pre) {
  padding: 0;
}

.transform-stack .improved pre {
  margin: 0;
  padding: 20px;
  background: #f0fff4;
  border: none;
  border-radius: 0;
}

.transform-stack .improved pre code {
  background: #f0fff4;
  border: none;
  padding: 0;
}

.transform-stack .improved div.sourceCode {
  border: none !important;
}

/* Reset margins for content inside improved section */
.transform-stack .improved > *:first-child {
  margin-top: 0;
}

.transform-stack .improved > *:last-child {
  margin-bottom: 0;
}

/* Special handling for lists in improved section */
.transform-stack .improved ol,
.transform-stack .improved ul {
  margin-bottom: 1rem;
}

.transform-stack .improved li {
  margin-bottom: 0.5rem;
}


/* --- Collapsible Component Styles --- */
.collapsible-component {
  margin-bottom: 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  background: white;
}

.collapsible-button {
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: white;
  color: #2c5282;
  font-weight: 600;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  word-wrap: break-word;
  white-space: normal;
  box-shadow: inset 0 0 0 transparent;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.collapsible-button:hover {
  background: #f8fafc;
}

.collapsible-button.active {
  background: linear-gradient(to bottom, #e8f4fc, #dceef8);
  box-shadow: inset 0 -3px 0 #4a90a4;
}

.collapsible-button .icon {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #4a90a4;
  margin-left: 10px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.collapsible-button.active .icon {
  transform: rotate(90deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  background: white;
  transition: max-height 0.25s ease-out;
}

/* Note: .collapsible-content.visible max-height is set dynamically by JavaScript */

/* Collapsible prompt section - white background */
.collapsible-prompt {
  background: white;
  padding: 20px 25px 0 25px;
  word-wrap: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

/* When prompt is the only content (no response), add bottom padding */
.collapsible-prompt:last-child {
  padding-bottom: 20px;
}

.collapsible-prompt > *:first-child {
  margin-top: 0;
}

.collapsible-prompt > *:last-child {
  margin-bottom: 0;
}

.collapsible-prompt p {
  margin-bottom: 0;
  font-style: italic;
  color: #2d3748;
  font-size: 1.05rem;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

/* AI Generated separator with lines and sparkle */
.collapsible-separator {
  display: flex;
  align-items: center;
  padding: 8px 25px;
  background: white;
  color: #718096;
  font-size: 0.9rem;
  gap: 12px;
}

.collapsible-separator::before {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.collapsible-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* Sparkle icon - using ✨ style */
.sparkle-icon {
  font-size: 1.2rem;
  background: linear-gradient(135deg, #d4a853 0%, #f0c674 45%, #5ba3c0 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sparkle-icon::before {
  content: "✨";
}

/* Collapsible response section - white with blue heading */
.collapsible-response {
  background: white;
  padding: 0 25px 25px 25px;
  word-wrap: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

.collapsible-response > *:first-child {
  margin-top: 0;
}

.collapsible-response > *:last-child {
  margin-bottom: 0;
}

.collapsible-response p {
  margin-bottom: 1rem;
  color: #2d3748;
  line-height: 1.7;
  word-wrap: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

.collapsible-response p:first-child {
  color: #2c5282;
  font-weight: 600;
  font-size: 1.05rem;
}

.collapsible-response strong {
  color: #2d3748;
  font-weight: 600;
}

/* Code formatting within collapsible response - darker turquoise, grey background, same font */
.collapsible-response code {
  background: #e8edf2;
  color: #2a7d8c;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1em;
}