/* Sandbox right panel */
.sandbox-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.sandbox-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.sandbox-head .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.sandbox-head .meta::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--info);
  box-shadow: 0 0 8px rgba(127, 178, 212, 0.6);
}
.sandbox-head h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.sandbox-body {
  flex: 1;
  overflow: auto;
  padding: 14px 18px 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.sandbox-body p { margin-bottom: 10px; }

.snippet-section { margin-top: 18px; }
.snippet-section h4 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.snippet-section h4 span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  font-style: normal;
}

.snippet-list {
  display: flex; flex-direction: column; gap: 4px;
}
.snippet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s;
}
.snippet-row:hover {
  border-color: var(--border-bright);
  background: var(--surface-2);
}
.snippet-row.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.snippet-row.drag-over {
  border-left: 3px solid var(--info);
  background: rgba(127, 178, 212, 0.12);
}
.snippet-row .name {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snippet-row .preview {
  flex: 2;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snippet-row .del {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.snippet-row .del:hover { color: var(--error); }
.snippet-row .ins-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--info);
  font-size: 11px;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 2px;
  line-height: 1.2;
}
.snippet-row .ins-btn:hover { background: var(--info); color: #0a1620; }
.snippet-row .builtin-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.snippet-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--serif);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 3px;
}

/* Built-in snippets section */
.snippet-builtins {
  display: flex; flex-direction: column; gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* Folder tree */
.snippet-folder { display: flex; flex-direction: column; }
.folder-children { display: flex; flex-direction: column; gap: 4px; }
.folder-children.collapsed { display: none; }

.folder-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.folder-row:hover { background: var(--surface-2); }
.folder-row.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.folder-row.drag-over {
  border-left: 3px solid var(--info);
  background: rgba(127, 178, 212, 0.12);
}

.folder-toggle {
  background: none; border: none;
  font-size: 10px; color: var(--text-dim);
  cursor: pointer; padding: 0; width: 14px; line-height: 1;
  flex-shrink: 0;
}
.folder-toggle:hover { color: var(--text); }

.folder-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}

.folder-name {
  flex: 1; font-size: 12.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--sans);
}

.folder-count {
  font-size: 10px; color: var(--text-dim);
  font-family: var(--mono);
  flex-shrink: 0;
}

.folder-menu-btn {
  background: none; border: none;
  font-size: 14px; color: var(--text-dim);
  cursor: pointer; padding: 0 2px; line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.folder-row:hover .folder-menu-btn { opacity: 1; }
.folder-menu-btn:hover { color: var(--text); }

/* Folder context menu (inline, absolute-positioned) */
.folder-context-menu {
  background: var(--surface-1);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  padding: 8px;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; gap: 6px;
}
.ctx-rename-row { display: flex; }
.ctx-rename-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  padding: 4px 6px;
  font-family: var(--sans);
  outline: none;
}
.ctx-rename-input:focus { border-color: var(--info); }
.ctx-color-row {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.color-swatch {
  width: 20px; height: 20px; border-radius: 3px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.15); border-color: rgba(255,255,255,0.5); }
.ctx-delete-row { display: flex; }
.ctx-delete-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  color: var(--error);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  font-family: var(--sans);
  text-align: center;
}
.ctx-delete-btn:hover { background: var(--error-soft); border-color: var(--error); }

/* Snippet search input */
.snippet-search {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s;
}
.snippet-search:focus { border-color: var(--info); }
.snippet-search::placeholder { color: var(--text-dim); }

.sandbox-tip {
  margin-top: 18px;
  padding: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 2px solid var(--info);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.sandbox-tip strong { color: var(--text); }
/* MS SQL mode panel */
.mssql-panel {
  display: flex; flex-direction: column;
  height: 100%;
  min-height: 0;
}
.mssql-output {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
}
.mssql-output .mssql-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.mssql-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--serif);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 3px;
}

/* Sandbox-specific results: no Expected tab needed */
:not(.sandbox-active) .sandbox-only-tab { display: none; }
.sandbox-active .practice-only-tab { display: none; }

/* The "DB modified" indicator */
.dirty-mark {
  display: none;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--error-soft);
  color: var(--error);
  border-radius: 2px;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: none;
}
.dirty-mark.show { display: inline-block; }

/* ─── Sandbox mode ────────────────────────────────── */

/* Fix: tab-bar collapses to 0px height in sandbox mode, making editor unusable */
body.sandbox-active .tab-bar,
body.sandbox-mode .tab-bar {
  min-height: 40px !important;
  height: auto !important;
  overflow: visible !important;
}

/* Sandbox mode: adjust results height */
body.sandbox-mode .results { max-height: 50%; }
body.mssql-mode .right { }
body.mssql-mode .main { grid-template-columns: 1fr 340px !important; }
body.mssql-mode .left { display: none; }
body.mssql-mode .center { grid-column: 1; }

.btn.btn-sandbox {
  background: var(--surface-1);
  border-color: var(--info);
  color: var(--info);
}
.btn.btn-sandbox:hover { background: rgba(127, 178, 212, 0.1); }
.btn.btn-sandbox.active {
  background: var(--info);
  color: #0a1620;
  font-weight: 600;
}
.btn.btn-sandbox::before { content: "▱ "; font-size: 11px; opacity: 0.8; }
.btn.btn-sandbox.active::before { content: "▰ "; }

.sandbox-banner {
  position: relative;
  padding: 14px 22px;
  background: linear-gradient(90deg, rgba(127, 178, 212, 0.08), transparent 70%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.sandbox-banner .label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--info);
  letter-spacing: 0.01em;
}
.sandbox-banner .desc {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  min-width: 200px;
}
.sandbox-banner .actions { display: flex; gap: 8px; }
.sandbox-banner .ghost-btn {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--sans);
}
.sandbox-banner .ghost-btn:hover { color: var(--info); border-color: var(--info); }
.sandbox-banner .ghost-btn.danger:hover { color: var(--error); border-color: var(--error); }
