/* playground.css — Code editor + preview pane */

.playground-layout {
  display: flex;
  height: 100vh;
  background: #1e1e2e;
  color: #cdd6f4;
  user-select: auto;
  -webkit-user-select: auto;
}

/* Sidebar */
.playground-sidebar {
  width: 220px;
  background: #181825;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.playground-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.playground-sidebar-header h1 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.playground-sidebar-header h1 a {
  color: inherit;
  text-decoration: none;
}
.playground-sidebar-header h1 a:hover {
  opacity: 0.8;
}

.playground-sidebar-label {
  padding: 12px 16px 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.35);
}

.example-list {
  list-style: none;
  padding: 0 8px;
}
.example-list li {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s;
  color: rgba(255,255,255,0.7);
}
.example-list li:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.example-list li.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Main area */
.playground-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Toolbar */
.playground-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #181825;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.toolbar-title {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
  flex: 1;
}

.toolbar-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s;
}
.toolbar-btn.run {
  background: var(--accent);
  color: white;
}
.toolbar-btn.run:hover {
  background: #333;
}

.toolbar-size {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-mono);
  padding: 0 8px;
}

/* Split pane */
.playground-split {
  flex: 1;
  display: flex;
  min-height: 0;
}

.playground-editor {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.playground-divider {
  width: 1px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.playground-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.preview-header {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  background: #f0f0f3;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.preview-frame {
  flex: 1;
  border: none;
  background: #fff;
}

/* Console output */
.playground-console {
  background: #11111b;
  border-top: 1px solid rgba(255,255,255,0.06);
  max-height: 120px;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: none;
}
.playground-console.visible {
  display: block;
}
.console-line {
  padding: 2px 0;
  color: rgba(255,255,255,0.6);
}
.console-line.error {
  color: var(--red);
}
.console-line.warn {
  color: var(--yellow);
}

/* CodeMirror overrides */
.cm-editor {
  height: 100%;
  font-size: 13px;
}
.cm-editor .cm-scroller {
  font-family: var(--font-mono);
}

/* Mobile */
@media (max-width: 768px) {
  .playground-sidebar {
    display: none;
  }
  .playground-split {
    flex-direction: column;
  }
  .playground-divider {
    width: 100%;
    height: 1px;
  }
  .playground-editor,
  .playground-preview {
    flex: none;
    height: 50%;
  }
}
