/* Admin Studio — extends styles.css */
.admin-studio {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - 80px);
}

.studio-sidebar {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  align-self: start;
  position: sticky;
  top: 90px;
}

.studio-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  color: #333;
  transition: background 0.15s;
}

.studio-nav-item:hover {
  background: #f8f9fa;
}

.studio-nav-item.active {
  background: var(--as-red, #b91c1c);
  color: #fff;
}

.testsolve-panel {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--as-green-soft, #ecfdf3);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}

.testsolve-panel h3 {
  margin-top: 0;
  color: var(--as-green, #15803d);
}

.split-editor textarea {
  background: var(--admin-input-bg, #fff);
  border: 1px solid var(--admin-input-border, #b8c9be);
  color: var(--admin-text, #1a1a1a);
}

.task-card {
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--admin-border, #d4ddd6);
  background: var(--admin-surface-2, #f0f7f2);
}

.studio-main .panel {
  display: none;
}

.studio-main .panel.active {
  display: block;
}

.studio-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.studio-card h2 {
  margin-top: 0;
  font-size: 1.5rem;
  color: #dc3545;
  font-family: 'Playfair Display', Georgia, serif;
}

.admin-themed .studio-card h2 {
  color: var(--admin-accent, #dc3545);
}

.editor-label {
  font-weight: 700;
  font-size: 0.88rem;
  display: block;
  margin-bottom: 6px;
  color: var(--admin-text, #333);
}

.editor-label code {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
}

.problem-bank-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.problem-editor-pane {
  min-width: 0;
  overflow: visible;
}

.problem-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  margin-top: 0.5rem;
}

.problem-statement-block {
  width: 100%;
  flex-shrink: 0;
}

.solution-block {
  width: 100%;
  flex-shrink: 0;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--admin-border, #d4ddd6);
}

.preview-mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0.75rem;
}

.split-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
  width: 100%;
}

.split-editor .editor-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  min-height: 0;
}

.split-editor textarea {
  width: 100%;
  height: auto;
  min-height: 240px;
  max-height: min(420px, 45vh);
  box-sizing: border-box;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.88rem;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: vertical;
}

.preview-pane {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 16px;
  overflow: auto;
  background: #fafafa;
  min-height: 240px;
  max-height: min(420px, 45vh);
  box-sizing: border-box;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.problem-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--admin-border, #eee);
  border-radius: 8px;
  background: var(--admin-surface-2, #fafafa);
}

.problem-list.problem-list-empty {
  border-style: dashed;
  background: transparent;
}

.problem-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.problem-list button:hover,
.problem-list button.active {
  background: #fff5f5;
}

.test-builder-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
}

.test-slots {
  min-height: 200px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}

.slot-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.slot-card.dragging {
  opacity: 0.5;
}

.guts-batches {
  margin-top: 1rem;
}

.batch-block {
  border: 1px solid #b6d4fe;
  background: #eef5ff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.batch-block h4 {
  margin: 0 0 8px;
  color: #0b3d91;
}

.drawer-problems {
  max-height: 480px;
  overflow-y: auto;
}

.drawer-item {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  cursor: grab;
  font-size: 0.85rem;
}

.drawer-item:hover {
  background: #f8f9fa;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-draft { background: #e9ecef; color: #495057; }
.badge-active { background: #d1e7dd; color: #0f5132; }
.badge-archived { background: #f8d7da; color: #842029; }
.badge-testsolving { background: #fff3cd; color: #664d03; }
.badge-approved { background: #cfe2ff; color: #084298; }

html.admin-dark .admin-studio .studio-sidebar,
html.admin-dark .admin-studio .studio-card,
body.dark-mode.admin-themed .admin-studio .studio-sidebar,
body.dark-mode.admin-themed .admin-studio .studio-card {
  background: var(--admin-surface, #1a1d21);
  border-color: var(--admin-border, #3d4450);
  color: var(--admin-text, #f1f3f5);
}

html.admin-dark .preview-pane,
body.dark-mode.admin-themed .preview-pane {
  background: var(--admin-surface-2, #22262c);
  color: var(--admin-text, #f1f3f5);
}

@media (max-width: 900px) {
  .admin-studio {
    grid-template-columns: 1fr;
  }
  .split-editor {
    grid-template-columns: 1fr;
  }
  .test-builder-layout {
    grid-template-columns: 1fr;
  }
}
