/* ================================================================
   custom.css — Project-specific styles that override/extend Tailwind.
   This file is NOT gitignored and is deployed alongside tailwind.css.
   ================================================================ */

/* Sidebar Panel — collapsed by default (icons only), expands on hover */
.sidebar-panel {
  width: 72px;
  transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}

@media (min-width: 640px) {
  .sidebar-panel:hover {
    width: 16rem;
  }
}

/* ==========================================================================
   Rendered Markdown preview (click-to-edit prompt fields)
   The field shows formatted markdown by default; clicking swaps to the raw
   textarea. Styling uses the theme tokens so it adapts to every color scheme.
   ========================================================================== */

.markdown-rendered {
  position: relative;
  cursor: text;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--cl-text);
  padding: 0.75rem 1rem;
  border-radius: var(--cl-radius-lg, 1rem);
  word-break: break-word;
  transition: background 0.15s ease;
}

.markdown-rendered:hover {
  background: color-mix(in srgb, var(--cl-text) 4%, transparent);
}

.markdown-rendered.is-empty {
  color: var(--cl-text-2);
  font-style: italic;
}

.markdown-rendered .md-placeholder { opacity: 0.75; }

/* Collapse spacing so the block doesn't add stray top/bottom gaps */
.markdown-rendered > *:first-child { margin-top: 0 !important; }
.markdown-rendered > *:last-child  { margin-bottom: 0 !important; }

/* Headings */
.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6 {
  color: var(--cl-text);
  font-weight: 800;
  line-height: 1.25;
  margin: 0.9em 0 0.4em;
}
.markdown-rendered h1 { font-size: 1.35em; }
.markdown-rendered h2 { font-size: 1.18em; }
.markdown-rendered h3 { font-size: 1.05em; }
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6 {
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cl-text-2);
}

/* Paragraphs & inline */
.markdown-rendered p { margin: 0.5em 0; }
.markdown-rendered strong { font-weight: 700; color: var(--cl-text); }
.markdown-rendered em { font-style: italic; }
.markdown-rendered del { opacity: 0.6; }
.markdown-rendered a {
  color: var(--cl-accent-strong, var(--cl-accent));
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Lists */
.markdown-rendered ul,
.markdown-rendered ol { margin: 0.5em 0; padding-left: 1.4em; }
.markdown-rendered li { margin: 0.25em 0; }
.markdown-rendered ul li::marker { color: var(--cl-accent); }
.markdown-rendered ol li::marker { color: var(--cl-accent); font-weight: 700; }
.markdown-rendered li > ul,
.markdown-rendered li > ol { margin: 0.2em 0; }

/* Code */
.markdown-rendered code {
  background: var(--cl-inset, var(--cl-input));
  color: var(--cl-warm, var(--cl-text));
  padding: 0.1em 0.4em;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: 'JetBrains Mono', monospace;
}
.markdown-rendered pre {
  background: var(--cl-inset, var(--cl-input));
  padding: 0.75em 1em;
  border-radius: 10px;
  overflow-x: auto;
  margin: 0.6em 0;
}
.markdown-rendered pre code {
  background: none;
  padding: 0;
  color: var(--cl-text);
}

/* Blockquote */
.markdown-rendered blockquote {
  border-left: 3px solid var(--cl-border);
  padding-left: 0.8em;
  margin: 0.6em 0;
  color: var(--cl-text-2);
}

/* Rules & tables */
.markdown-rendered hr {
  border: none;
  border-top: 1px solid var(--cl-border);
  margin: 1em 0;
}
.markdown-rendered table {
  border-collapse: collapse;
  margin: 0.6em 0;
  font-size: 0.9em;
}
.markdown-rendered th,
.markdown-rendered td {
  border: 1px solid var(--cl-border);
  padding: 0.4em 0.7em;
}
.markdown-rendered th {
  background: var(--cl-input);
  font-weight: 700;
  text-align: left;
}

/* Mask text using CSS to prevent browser password autofill */
.mask-security {
  -webkit-text-security: disc !important;
  text-security: disc !important;
}

