/* ─────────────────────────────────────────
   PROMPT FILLER — style.css
   Two-colour palette: #0a0a0a–#2c2c2c (bg)
   + #f0f0f0–#3a3a3a (text/border)
───────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Backgrounds — darkest to lightest */
  --bg-0: #0a0a0a;
  --bg-1: #111111;
  --bg-2: #161616;
  --bg-3: #1c1c1c;
  --bg-4: #222222;
  --bg-5: #2c2c2c;
  --bg-6: #363636;

  /* Text — brightest to dimmest */
  --text-0: #f0f0f0;
  --text-1: #c8c8c8;
  --text-2: #888888;
  --text-3: #4a4a4a;
  --text-4: #333333;

  /* Borders */
  --border-0: #2a2a2a;
  --border-1: #333333;
  --border-2: #404040;

  /* Danger — kept monochrome-warm */
  --danger-bg: #200e0e;
  --danger-text: #cc6060;
  --danger-border: #3a1515;

  /* Fonts */
  --font-ui: 'SF Pro Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Sizing */
  --sidebar-w: 230px;
  --topbar-h: 40px;
  --pane-head-h: 34px;
  --radius: 3px;
  --transition: 0.13s ease;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── ICONS ───────────────────────────── */
svg.icon {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: block;
}

/* ── BUTTONS ─────────────────────────── */
button {
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  color: var(--text-1);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  padding: 5px 10px;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

button:focus-visible {
  outline: 1px solid var(--border-2);
  outline-offset: 1px;
}

.icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-2);
}
.icon-btn:hover { background: var(--bg-5); color: var(--text-0); }

.btn-primary {
  background: var(--bg-5);
  border: 1px solid var(--border-1);
  color: var(--text-0);
  padding: 5px 12px;
}
.btn-primary:hover { background: var(--bg-6); border-color: var(--border-2); }
.btn-primary:active { background: var(--bg-4); }

.btn-ghost {
  color: var(--text-2);
  padding: 5px 10px;
}
.btn-ghost:hover { background: var(--bg-4); color: var(--text-1); }

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  padding: 5px 12px;
}
.btn-danger:hover { background: #2a1010; border-color: #4a1f1f; }

.btn-danger-full {
  width: 100%;
  justify-content: flex-start;
  padding: 6px 8px;
  color: var(--text-3);
  border-radius: var(--radius);
  font-size: 11px;
}
.btn-danger-full:hover { background: var(--danger-bg); color: var(--danger-text); }

/* How it works button */
.btn-how-it-works {
  width: 100%;
  justify-content: flex-start;
  padding: 6px 8px;
  color: var(--text-2);
  border-radius: var(--radius);
  font-size: 11px;
  border: 1px solid var(--border-0);
  background: var(--bg-3);
}
.btn-how-it-works:hover {
  background: var(--bg-4);
  border-color: var(--border-1);
  color: var(--text-1);
}
.btn-how-it-works svg.icon { color: var(--text-3); }
.btn-how-it-works:hover svg.icon { color: var(--text-2); }

button.sm { padding: 4px 8px; font-size: 11px; }
button.sm svg.icon { width: 12px; height: 12px; }

/* ── INPUTS / TEXTAREAS ──────────────── */
input, textarea, select {
  font-family: var(--font-ui);
  font-size: 12px;
  background: var(--bg-2);
  color: var(--text-0);
  border: 1px solid var(--border-0);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

input { padding: 7px 10px; height: 32px; }
input:hover { border-color: var(--border-1); }
input:focus { border-color: var(--border-2); }
input::placeholder { color: var(--text-3); }

textarea {
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.65;
  min-height: 120px;
}
textarea:hover { border-color: var(--border-1); }
textarea:focus { border-color: var(--border-2); }
textarea::placeholder { color: var(--text-3); }

/* ── APP LAYOUT ──────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border-0);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
  flex-shrink: 0;
}

#sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right-color: transparent;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 12px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border-0);
  flex-shrink: 0;
}

.sidebar-head-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
}

.sidebar-title {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  font-weight: 500;
}

.sidebar-actions {
  display: flex;
  gap: 1px;
  flex-shrink: 0;
}

.sidebar-search {
  position: relative;
  padding: 8px 8px 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-0);
}

.sidebar-search input {
  padding-left: 28px;
  height: 28px;
  background: var(--bg-3);
  font-size: 11px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.sidebar-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.7;
}

/* Sidebar item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  margin-bottom: 1px;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-3);
  border-color: var(--border-0);
}

.sidebar-item.active {
  background: var(--bg-3);
  border-color: var(--border-1);
}

.sidebar-item-icon { color: var(--text-3); flex-shrink: 0; }
.sidebar-item.active .sidebar-item-icon { color: var(--text-2); }

.sidebar-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-item-name {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item.active .sidebar-item-name { color: var(--text-0); }

.sidebar-item-meta {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.sidebar-item-acts {
  display: none;
  gap: 1px;
  flex-shrink: 0;
}

.sidebar-item:hover .sidebar-item-acts { display: flex; }

/* Drag-over visual */
.sidebar-item.drag-over { border-top: 1px solid var(--text-2); }

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border-0);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.warn-notice {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  background: #16130a;
  border: 1px solid #2c2508;
  border-radius: var(--radius);
  padding: 7px 9px;
  font-size: 10px;
  color: #8a7040;
  line-height: 1.55;
}

.warn-notice svg.icon {
  color: #7a6030;
  stroke: #7a6030;
  flex-shrink: 0;
  margin-top: 1px;
  width: 11px;
  height: 11px;
}

/* ── MAIN ────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ──────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border-0);
  background: var(--bg-1);
  gap: 8px;
  flex-shrink: 0;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb-app {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.breadcrumb-sep {
  color: var(--text-3);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.breadcrumb-name {
  font-size: 12px;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.dirty-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ── WORKSPACE / SPLIT ───────────────── */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.pane-left  { flex: 1; border-right: 1px solid var(--border-0); min-width: 280px; }
.pane-right { flex: 1; min-width: 260px; }

.pane-header {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: var(--pane-head-h);
  border-bottom: 1px solid var(--border-0);
  background: var(--bg-1);
  gap: 10px;
  flex-shrink: 0;
}

.pane-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
  flex: 1;
}

.pane-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Resize handle */
.resize-handle {
  width: 4px;
  background: var(--border-0);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background var(--transition);
  position: relative;
}

.resize-handle:hover,
.resize-handle.dragging {
  background: var(--border-2);
}

/* ── STATS ROW ───────────────────────── */
.stats-row { display: flex; gap: 5px; }

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border-0);
  border-radius: var(--radius);
  padding: 2px 8px;
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-mono);
}

.stat-chip b { color: var(--text-0); font-weight: 500; }
.stat-chip svg.icon { color: var(--text-3); }

/* ── EMPTY STATE ─────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  text-align: center;
  flex: 1;
}

.empty-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--border-0);
  border-radius: var(--radius);
  color: var(--text-3);
}

.empty-icon svg.icon { width: 18px; height: 18px; }

.empty-title {
  font-size: 13px;
  color: var(--text-1);
  font-weight: 500;
}

.empty-sub {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 220px;
}

/* ── EDITOR FIELDS ───────────────────── */
.editor-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group { display: flex; flex-direction: column; gap: 5px; }

.field-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-hint {
  font-size: 10px;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}

.field-hint code {
  font-family: var(--font-mono);
  background: var(--bg-4);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  color: var(--text-1);
}

.field-input { }
.field-textarea {
  min-height: 160px;
  max-height: 380px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Placeholder inputs */
#inputsWrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ph-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.ph-num {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  padding-top: 9px;
  min-width: 16px;
  text-align: right;
  flex-shrink: 0;
  user-select: none;
}

.ph-input {
  flex: 1;
  min-height: 32px;
  max-height: 100px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: none;
}

.ph-empty-msg {
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 2px;
  font-family: var(--font-mono);
}

/* ── OUTPUT ──────────────────────────── */
.output-actions { display: flex; gap: 5px; align-items: center; }

.output-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.output-content {
  width: 100%;
  flex: 1;
  min-height: 200px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border-0);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-0);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  cursor: text;
  user-select: text;
}

.output-placeholder {
  color: var(--text-3);
  font-style: normal;
  font-family: var(--font-ui);
}

.output-meta {
  display: flex;
  gap: 10px;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  padding: 0 2px;
}

/* ── MODALS ──────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 4px;
  width: 480px;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-sm { width: 360px; }
.modal-how { width: 500px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-0);
  flex-shrink: 0;
}

.modal-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.65;
}

.modal-desc code {
  font-family: var(--font-mono);
  background: var(--bg-4);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 11px;
  color: var(--text-0);
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border-0);
  flex-shrink: 0;
}

.import-example {
  background: var(--bg-3);
  border: 1px solid var(--border-0);
  border-radius: var(--radius);
  overflow: hidden;
}

.import-example-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-0);
  background: var(--bg-4);
}

.import-example-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-1);
  line-height: 1.7;
  padding: 10px 12px;
  white-space: pre-wrap;
}

#importTextArea { min-height: 140px; font-family: var(--font-mono); font-size: 12px; }

/* ── HOW IT WORKS MODAL ──────────────── */
.how-body {
  gap: 0 !important;
  padding: 12px 18px !important;
}

.how-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-0);
}

.how-step:last-child { border-bottom: none; }

.how-step-num {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--bg-4);
  border: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.how-step-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.how-step-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-0);
}

.how-step-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.65;
}

.how-step-desc code {
  font-family: var(--font-mono);
  background: var(--bg-4);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  color: var(--text-1);
}

.how-step-desc b { color: var(--text-1); font-weight: 500; }

.how-step-desc kbd {
  font-family: var(--font-mono);
  background: var(--bg-4);
  border: 1px solid var(--border-1);
  border-radius: 2px;
  padding: 0 4px;
  font-size: 10px;
  color: var(--text-1);
}

/* ── TOAST ───────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-5);
  border: 1px solid var(--border-1);
  color: var(--text-0);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 300;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── SCROLLBARS ──────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-6); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #404040; }
* { scrollbar-width: thin; scrollbar-color: var(--bg-6) transparent; }

/* ── SELECTION ───────────────────────── */
::selection { background: #2a3a2a; color: var(--text-0); }

/* ── RESPONSIVE ──────────────────────── */
@media (max-width: 640px) {
  :root { --sidebar-w: 200px; }
  .pane-left { min-width: 220px; }
  .pane-right { min-width: 200px; }
}