/* AshenCinematics Studio - dashboard-hosted editor styles.
   Ported from the AshenCinematics embedded editor; adapted to sit below the
   dashboard nav (h-16 = 64px) instead of the standalone page header. */

:root {
  /* Staff-ledger variant: re-source the editor palette onto the shared
     dashboard theme tokens (theme.css) - parchment surfaces, launcher ink,
     gold accent. Interior drafting-table inlays keep their dark hexes. */
  --bg: var(--ashen-canvas);
  --bg-2: var(--ashen-canvas-deep);
  --panel: var(--ashen-panel);
  --panel-2: var(--ashen-panel-strong);
  --border: var(--ashen-hairline);
  --border-2: var(--ashen-hairline-strong);
  --text: var(--ashen-ink);
  --muted: var(--ashen-ink-muted);
  --accent: var(--ashen-accent);
  --accent-2: var(--ashen-accent-text);
  --accent-dim: var(--ashen-accent-dim);
  --green: var(--ashen-emerald);
  --red: var(--ashen-red);
  --radius: 12px;
  --font: var(--ashen-body);
}

html,
body,
main,
#app,
.layout,
#editor {
  background: var(--bg);
}

#app { min-height: calc(100vh - 64px); }

/* Keep this state helper scoped. A global `.hidden` rule overrides Tailwind's
   responsive `hidden md:flex` nav utility and hides the dashboard tabs. */
#app.hidden,
#app .hidden,
#offline-state.hidden { display: none !important; }

.muted { color: var(--muted); }

/* ------------------------------------------------------------ editor header */

.cinema-header {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(20, 16, 31, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 64px; /* below the dashboard nav */
  z-index: 10;
}

.brand { font-size: 15px; font-weight: 700; letter-spacing: 0.3px; display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 17px; }
.brand .sub { color: var(--accent-2); font-weight: 600; font-size: 13px; }

.header-right { display: flex; align-items: center; gap: 8px; }
.server-tag {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 4px 10px;
  border-radius: 999px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ layout */

.layout {
  display: flex;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 64px - 54px);
  min-height: 480px;
}

/* ---------------------------------------------------------------- sidebar */

#sidebar {
  width: 268px;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

#seq-list { flex: 1; overflow-y: auto; padding: 8px; }

.seq-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
  background: var(--panel-2);
}
.seq-item:hover { border-color: var(--border-2); background: var(--accent-dim); }
.seq-item.active { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent) inset; }

.seq-name { font-weight: 600; font-size: 13.5px; word-break: break-all; padding-right: 22px; }
.seq-meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.seq-del {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.12s;
}
.seq-item:hover .seq-del { opacity: 1; }

.seq-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 10px; }

/* Category grouping headers in the sidebar. */
.seq-group { margin-bottom: 4px; }
.seq-group-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--accent-2);
  padding: 8px 6px 4px;
}
.seq-group > .seq-item { margin-left: 6px; }

/* ------------------------------------------------------------------ editor */

#editor {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 4px 4px 24px 0;
  background: var(--bg);
  border-radius: var(--radius);
}

.empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.empty-logo { font-size: 52px; margin-bottom: 10px; opacity: 0.7; }
.empty h2 { margin: 0 0 6px; color: var(--text); }

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.title-block h2 { margin: 0 0 6px; font-size: 20px; word-break: break-all; }

.chip {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  color: var(--muted);
  background: var(--bg-2);
  margin-right: 6px;
  vertical-align: middle;
}
.chip-ok { color: var(--green); border-color: rgba(95, 191, 143, 0.45); }
.chip-error { color: var(--red); border-color: rgba(226, 85, 85, 0.45); }
.chip-dirty { color: var(--accent-2); border-color: rgba(241, 65, 94, 0.5); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.play-row { display: flex; align-items: center; gap: 8px; }

/* The playback target sits outside .field, so give it the same gold-ledger
   treatment explicitly instead of letting the browser use a white native select. */
.target-select {
  min-width: 132px;
  max-width: 220px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  color-scheme: light;
  border-radius: 8px;
  padding: 8px 28px 8px 10px;
  font-size: 13px;
}
.target-select option {
  background: var(--panel-2);
  color: var(--text);
}
.target-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent-2); display: flex; align-items: center; gap: 8px; }
.panel .hint { color: var(--muted); font-size: 12.5px; margin: -6px 0 12px; line-height: 1.5; }
.count { color: var(--muted); font-size: 12px; }

/* Category-gated waystone playback panel. A gentle border tint sets it apart
   from the generic panels so waystone authors can find the anchor controls. */
.waystone-panel { border-color: rgba(224, 138, 60, 0.4); }
.waystone-panel .coord-grid { margin-top: 2px; }

/* ------------------------------------------------------------------ flags */

.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.field input, .field select {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* switch knob: base .switch lives in theme.css; the compact variant is
   cinema-specific */
.switch.small .slider { width: 30px; height: 16px; }
.switch.small .slider::after { width: 10px; height: 10px; }
.switch.small input:checked + .slider::after { transform: translateX(14px); }

/* ------------------------------------------------------------ player pos */

.pos-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.coord-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* ----------------------------------------------------------------- points */

.points-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }

.point {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: border-color 0.12s;
}
.point:hover { border-color: var(--border-2); }
.point.invalid { border-color: var(--red); }

.point-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.point-index {
  flex: none;
  background: var(--accent-dim);
  color: var(--accent-2);
  border-radius: 7px;
  padding: 3px 9px;
  font-weight: 700;
  font-size: 12px;
}
.point-id {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
}
.point-id:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.point-actions { display: flex; gap: 6px; }
.point-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; padding: 14px; }

.lookhere { padding: 0 14px 14px; }
.lookhere .coord-grid { margin-top: 10px; }

/* ----------------------------------------------------------------- buttons
   base .btn/.btn-accent/.btn-small/.icon-btn live in theme.css; only the
   cinema playback button is editor-specific */

.btn-play { background: linear-gradient(180deg, #7ed6a8, var(--green)); border-color: var(--green); color: #06231a; }
.btn-play:hover { border-color: #8fe6b7; }

/* ------------------------------------------------------------- errors etc. */

.errors {
  background: rgba(181, 66, 46, 0.1);
  border: 1px solid rgba(181, 66, 46, 0.45);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  color: var(--red);
  font-size: 13px;
}
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.errors li { margin-bottom: 2px; }

.warning {
  background: rgba(241, 65, 94, 0.08);
  border: 1px solid rgba(241, 65, 94, 0.45);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  color: var(--accent-2);
  font-size: 13px;
}

/* toasts live in theme.css (canonical #toasts/.toast system) */

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .layout { flex-direction: column; height: auto; }
  #sidebar { width: 100%; max-height: 230px; }
  #editor { overflow: visible; }
  .editor-head { flex-direction: column; }
  .toolbar { width: 100%; justify-content: flex-start; }
}
