/* ── Playground Editor Styles ─────────────────────────────────────────────── */

/* Full-bleed layout — no scroll on body */
html, body {
  height: 100%;
  overflow: hidden;
  background: #fafafa;
  color: #404040;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
#top-bar {
  height: 48px;
  flex-shrink: 0;
  background: color-mix(in srgb, #fafafa 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e8e8e8;
  color: #404040;
}

#top-bar .text-gray-300,
#top-bar .text-gray-400,
#top-bar .text-gray-500,
#top-bar .text-gray-600,
#left-sidebar .text-gray-400,
#left-sidebar .text-gray-500,
#right-panel .text-gray-500 {
  color: #6b645c !important;
}

#top-bar .border-gray-700,
#left-sidebar .border-gray-800,
#right-panel .border-gray-800 {
  border-color: rgba(28, 25, 23, 0.12) !important;
}

/* ── Main grid ───────────────────────────────────────────────────────────── */
#editor-layout {
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  grid-template-rows: 1fr 40px;
  height: calc(100vh - 48px);
}

/* ── Left sidebar ────────────────────────────────────────────────────────── */
#left-sidebar {
  grid-row: 1 / 3;
  background: #f5f5f5;
  border-right: 1px solid #e8e8e8;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#left-sidebar::-webkit-scrollbar { width: 4px; }
#left-sidebar::-webkit-scrollbar-track { background: transparent; }
#left-sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

/* ── Monaco mount ────────────────────────────────────────────────────────── */
#monaco-editor-mount {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
}

/* ── Right panel ─────────────────────────────────────────────────────────── */
#right-panel {
  grid-column: 3;
  grid-row: 1;
  background: #f5f5f5;
  border-left: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Status bar ──────────────────────────────────────────────────────────── */
#status-bar-row {
  grid-column: 2 / 4;
  grid-row: 2;
  background: #f5f5f5;
  border-top: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
}

/* ── Console / Output panels ─────────────────────────────────────────────── */
#console-content, #output-content {
  flex: 1;
  overflow-y: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #171717;
}

#preview-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

#preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

#console-content::-webkit-scrollbar,
#output-content::-webkit-scrollbar { width: 4px; }
#console-content::-webkit-scrollbar-thumb,
#output-content::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

/* ── Input row ───────────────────────────────────────────────────────────── */
#input-row {
  background: #111827;
  border-top: 1px solid #1e293b;
}

/* ── AI messages ─────────────────────────────────────────────────────────── */
#ai-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  padding: 12px;
}

#ai-messages::-webkit-scrollbar { width: 4px; }
#ai-messages::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

/* ── File tree ───────────────────────────────────────────────────────────── */
.file-item {
  transition: background-color 0.1s, color 0.1s;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ── Pyodide loading overlay ─────────────────────────────────────────────── */
#pyodide-status {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
}

/* ── Responsive: collapse sidebar on small screens ───────────────────────── */
@media (max-width: 768px) {
  #editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  #left-sidebar { display: none; }
  #right-panel { display: none; }
}

/* ── Monaco editor tweaks ────────────────────────────────────────────────── */
.monaco-editor .margin { background: #0f172a !important; }
.monaco-editor { background: #0f172a !important; }

/* ── Hide the loading skeleton once Monaco mounts ───────────────────────── */
/* When #monaco-editor-mount contains a .monaco-editor child, hide the        */
/* skeleton and show the keyboard hint.                                        */
#monaco-editor-mount:has(.monaco-editor) #editor-loading-skeleton {
  display: none !important;
}
#monaco-editor-mount:has(.monaco-editor) #keyboard-hint {
  display: block !important;
}
