/* ============================================================
   Die Line Editor — Layout & Toolbar Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family, 'Inter', 'Segoe UI', system-ui, sans-serif);
  background: hsl(220, 15%, 10%);
  color: hsl(220, 15%, 90%);
  font-size: 13px;
}

/* ── App shell ───────────────────────────────────────────── */
.editor {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.editor__toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: hsl(220, 18%, 14%);
  border-bottom: 1px solid hsl(220, 15%, 22%);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-sep {
  width: 1px;
  height: 22px;
  background: hsl(220, 15%, 28%);
  margin: 0 6px;
  flex-shrink: 0;
}

.toolbar-label {
  font-size: 11px;
  color: hsl(220, 10%, 55%);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px;
}

.toolbar-spacer { flex: 1; }

/* toolbar buttons */
.tb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid hsl(220, 15%, 26%);
  border-radius: 5px;
  background: hsl(220, 18%, 18%);
  color: hsl(220, 15%, 82%);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, color 120ms;
  line-height: 1;
}
.tb:hover { background: hsl(220, 18%, 24%); border-color: hsl(220, 15%, 38%); color: #fff; }
.tb:active { background: hsl(220, 18%, 20%); }
.tb:disabled { opacity: 0.4; cursor: default; }
.tb svg { width: 14px; height: 14px; flex-shrink: 0; }

.tb--primary {
  background: hsl(230, 65%, 48%);
  border-color: hsl(230, 65%, 55%);
  color: #fff;
}
.tb--primary:hover { background: hsl(230, 65%, 55%); border-color: hsl(230, 65%, 62%); }

.tb--danger { border-color: hsl(0, 60%, 40%); color: hsl(0, 70%, 70%); }
.tb--danger:hover { background: hsl(0, 50%, 22%); border-color: hsl(0, 60%, 52%); }

/* DIE spot color badge */
.die-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid hsl(180, 100%, 28%);
  background: hsl(180, 100%, 10%);
  font-size: 11px;
  font-weight: 700;
  color: #00e5ff;
  letter-spacing: 0.04em;
}
.die-badge__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #00ffff;
  box-shadow: 0 0 6px #00ffff;
  flex-shrink: 0;
}

/* zoom indicator */
.zoom-indicator {
  font-size: 11px;
  color: hsl(220, 10%, 55%);
  min-width: 42px;
  text-align: center;
}

/* ── Workspace ───────────────────────────────────────────── */
.editor__workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── Canvas panel ────────────────────────────────────────── */
.editor__canvas-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 50%, hsl(220, 16%, 14%) 0%, hsl(220, 18%, 10%) 100%);
  padding: 24px;
  position: relative;
}

/* canvas dot-grid background */
.editor__canvas-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(hsl(220, 15%, 22%) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.canvas-stage {
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  cursor: default;
  /* actual size set by JS */
}

.canvas-stage canvas {
  display: block;
}

/* ── Properties panel (right sidebar) ───────────────────── */
.editor__props {
  width: 220px;
  flex-shrink: 0;
  background: hsl(220, 18%, 13%);
  border-left: 1px solid hsl(220, 15%, 20%);
  overflow-y: auto;
  padding: 12px;
}

.props-section {
  margin-bottom: 14px;
}
.props-section__title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(220, 10%, 48%);
  margin-bottom: 8px;
}
.props-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.props-row label {
  font-size: 11px;
  color: hsl(220, 10%, 62%);
  min-width: 50px;
}
.props-input {
  flex: 1;
  background: hsl(220, 18%, 18%);
  border: 1px solid hsl(220, 15%, 26%);
  border-radius: 4px;
  color: hsl(220, 15%, 90%);
  font-size: 12px;
  padding: 4px 7px;
  outline: none;
}
.props-input:focus { border-color: hsl(230, 65%, 55%); }
.props-input[type="color"] { padding: 1px 4px; height: 26px; cursor: pointer; }

.props-section--hidden { display: none; }

/* die line info panel */
.die-info {
  background: hsl(180, 50%, 8%);
  border: 1px solid hsl(180, 80%, 18%);
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  line-height: 1.6;
}
.die-info strong { color: #00e5ff; }
.die-info code {
  display: inline-block;
  background: hsl(220, 18%, 18%);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  font-family: monospace;
  color: hsl(120, 60%, 70%);
}

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.is-hidden { display: none; }

.modal-box {
  background: hsl(220, 18%, 16%);
  border: 1px solid hsl(220, 15%, 28%);
  border-radius: 10px;
  padding: 24px;
  min-width: 320px;
  max-width: 420px;
  width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #fff;
}
.modal-field {
  margin-bottom: 12px;
}
.modal-field label {
  display: block;
  font-size: 11px;
  color: hsl(220, 10%, 60%);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-field input,
.modal-field select {
  width: 100%;
  padding: 8px 10px;
  background: hsl(220, 18%, 20%);
  border: 1px solid hsl(220, 15%, 32%);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  outline: none;
}
.modal-field input:focus,
.modal-field select:focus { border-color: hsl(230, 65%, 55%); }

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ── Status bar ──────────────────────────────────────────── */
.editor__statusbar {
  padding: 4px 12px;
  background: hsl(220, 18%, 12%);
  border-top: 1px solid hsl(220, 15%, 20%);
  font-size: 11px;
  color: hsl(220, 10%, 50%);
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

/* ── Context menu ────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  background: hsl(220, 18%, 16%);
  border: 1px solid hsl(220, 15%, 28%);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 500;
  min-width: 140px;
}
.ctx-menu.is-hidden { display: none; }
.ctx-item {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  color: hsl(220, 15%, 82%);
}
.ctx-item:hover { background: hsl(220, 18%, 24%); color: #fff; }
.ctx-item--danger { color: hsl(0, 70%, 70%); }
.ctx-item--danger:hover { background: hsl(0, 50%, 22%); }
