/* Editor shell — dark theme, compact, designed for full-screen 3-pane work. */

:root {
  --bg-0: #0e1117;
  --bg-1: #161b22;
  --bg-2: #1f2530;
  --bg-3: #2a3140;
  --line: #2d343f;
  --fg-0: #e6edf3;
  --fg-1: #b6becc;
  --fg-2: #7e8896;
  --accent: #7aa2f7;
  --accent-2: #bb9af7;
  --good: #9ece6a;
  --bad:  #f7768e;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--fg-0);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }

.editor-shell { display: grid; grid-template-rows: 44px 1fr; height: 100%; }

.editor-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.bar-left, .bar-center, .bar-right { display: flex; align-items: center; gap: 8px; }
.bar-right { justify-content: flex-end; }
.bar-sep { color: var(--fg-2); }
.brand { font-weight: 700; letter-spacing: .04em; }
.project-title { font-weight: 600; color: var(--fg-1); }

.btn {
  background: var(--bg-2); color: var(--fg-0);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; font: inherit; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--bg-3); }
.btn.primary { background: linear-gradient(180deg, #5b8df1, #4a76d6); border-color: #5b8df1; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { background: #5a2933; border-color: #7e3340; color: #ffd0d8; }
.btn.danger:hover { background: #6e2f3c; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn[data-active="true"] { background: var(--bg-3); border-color: var(--accent); color: var(--accent); }

.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-1); user-select: none; }
.toggle input { accent-color: var(--accent); }

.level-picker {
  background: var(--bg-2); color: var(--fg-0);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px;
}

.presence { display: flex; gap: 4px; }
.presence .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #0e1117;
  border: 2px solid var(--bg-1);
}

.editor-main {
  display: grid;
  grid-template-columns: 290px 1fr 260px;
  min-height: 0;
}

.panel-left, .panel-right {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  overflow: auto;
  min-height: 0;
}
.panel-right { border-right: none; border-left: 1px solid var(--line); }

.search-row {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto;
  gap: 6px; padding: 8px;
  background: var(--bg-1); border-bottom: 1px solid var(--line);
}
.search-row input, .search-row select {
  background: var(--bg-2); color: var(--fg-0);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; font: inherit;
}

.facets {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px; border-bottom: 1px solid var(--line);
}
.chip {
  background: var(--bg-2); color: var(--fg-1);
  border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; cursor: pointer;
}
.chip[data-active="true"] {
  background: var(--accent); color: #0e1117; border-color: var(--accent); font-weight: 600;
}

.asset-grid { padding: 4px 0; }
.asset-group-header {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-1);
  font-size: 10px; font-weight: 700;
  color: var(--fg-2); text-transform: uppercase; letter-spacing: .08em;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--line);
}
.asset-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 4px; padding: 6px 8px 10px;
}
.asset-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px;
  display: flex; flex-direction: column; padding: 4px;
  cursor: grab; user-select: none; text-align: center;
  transition: border-color .12s ease, transform .12s ease;
  overflow: hidden;
}
.asset-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.asset-card .thumb-wrap {
  width: 100%; aspect-ratio: 1;
  background: linear-gradient(180deg, #1a212e, #11151c);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  margin-bottom: 4px;
}
.asset-card img.thumb {
  width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}
.asset-card .name {
  font-size: 10px; line-height: 1.15; color: var(--fg-1);
  word-break: break-word; max-height: 2.4em; overflow: hidden;
}
.asset-empty { padding: 24px; text-align: center; color: var(--fg-2); }
.asset-grid-status { padding: 8px 12px; color: var(--fg-2); font-size: 12px; }

.canvas-wrap { position: relative; min-height: 0; background: #11151c; }
#render-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.canvas-overlay {
  position: absolute; pointer-events: none; inset: 0;
}
.status-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 4px 10px; font-size: 11px; color: var(--fg-2);
  background: rgba(11, 13, 18, 0.7); backdrop-filter: blur(4px);
  border-top: 1px solid var(--line);
}

.panel-section { padding: 12px; border-bottom: 1px solid var(--line); }
.panel-section h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-2); margin: 0 0 8px;
}
.panel-section label {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px;
  color: var(--fg-1);
}
.panel-section input[type="text"],
.panel-section input[type="number"],
.panel-section select,
.panel-section input[type="color"] {
  background: var(--bg-2); color: var(--fg-0);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 5px 7px; font: inherit;
}
.panel-section input[type="range"] { width: 100%; }
.panel-section input[type="color"] { padding: 1px; height: 28px; cursor: pointer; }

.row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.row label { font-size: 11px; color: var(--fg-2); }
.row3 input { width: 33%; }
.row3 { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 4px; align-items: center; margin-bottom: 8px; }
.row3 label { font-size: 11px; color: var(--fg-2); }
.row3 input {
  background: var(--bg-2); color: var(--fg-0);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px;
  width: 100%;
}
.btn-row { flex-direction: row !important; gap: 6px; }
.muted { color: var(--fg-2); font-size: 12px; }

/* Drop indicator overlay shown while dragging an asset over the canvas. */
.drop-indicator {
  position: absolute; pointer-events: none;
  border: 2px dashed var(--accent); background: rgba(122, 162, 247, 0.08);
  border-radius: 6px; transition: opacity .1s ease;
}

/* Toast / notification */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 8px 14px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  font-size: 12px; z-index: 1000;
}
.toast.error { border-color: var(--bad); color: #ffd0d8; }
.toast.good  { border-color: var(--good); color: #d4ffd0; }

@media (max-width: 1100px) {
  .editor-main { grid-template-columns: 240px 1fr 220px; }
}
