/* =============================================================================
   styles.css — BPMN Studio chrome
   The diagram surface itself is rendered and styled by bpmn-js
   (vendor/bpmn-js/*.css); this file only styles the surrounding app shell:
   toolbar, sidebar, status bar, modal, and dark-mode chrome.
   ============================================================================= */

:root {
  --accent: #2f6fed;
  --accent-contrast: #ffffff;

  --bg: #f3f2ef;
  --panel-bg: #fbfaf8;
  --canvas-bg: #ffffff;
  --border: #d9d7d0;
  --border-strong: #b9b7ae;
  --text: #26251f;
  --text-muted: #6b6a63;
  --grid-line: #eceae3;

  --toolbar-h: 48px;
  --statusbar-h: 26px;
  --radius: 6px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* NOTE ON DARK MODE: bpmn-js renders the diagram itself with standard BPMN
   notation colors (white shapes, black strokes) per the spec's visual
   language, and recoloring its internal SVG rendering is out of scope for
   a wrapper app. "Dark chrome" therefore only re-themes the surrounding
   toolbar/sidebar/status bar, not the diagram surface - the canvas stays a
   light artboard, the same way most professional diagram tools keep the
   drawing surface neutral regardless of app theme. */
[data-theme="dark"] {
  --accent: #5c8dfa;
  --accent-contrast: #10131a;
  --bg: #1b1d22;
  --panel-bg: #21242b;
  --border: #33363e;
  --border-strong: #454852;
  --text: #e8e7e3;
  --text-muted: #9a9a94;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------- Toolbar */
.toolbar {
  height: var(--toolbar-h);
  min-height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  padding-right: 10px;
  color: var(--text);
}
.brand-icon { width: 20px; height: 20px; color: var(--accent); }

.toolbar-group { display: flex; align-items: center; gap: 4px; }
.toolbar-sep { width: 1px; align-self: stretch; margin: 8px 4px; background: var(--border); flex: 0 0 auto; }
.toolbar-spacer { flex: 1 1 auto; }

.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
.tbtn:hover { background: var(--bg); border-color: var(--border); }
.tbtn:active { background: var(--border); }
.tbtn:disabled { opacity: 0.4; cursor: default; }
.tbtn:disabled:hover { background: transparent; border-color: transparent; }
.tbtn-toggle { gap: 6px; cursor: pointer; }
.tbtn-toggle input { accent-color: var(--accent); }

.zoom-readout { font-size: 12px; color: var(--text-muted); min-width: 40px; text-align: center; }

/* ---------------------------------------------------------------- Body layout */
.body { flex: 1 1 auto; display: flex; min-height: 0; }

.sidebar {
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-right { width: 280px; border-left: 1px solid var(--border); overflow-y: auto; }
.sidebar-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); margin: 0; padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
}

/* ------------------------------------------------------------------- Canvas */
.canvas-wrap { flex: 1 1 auto; position: relative; min-width: 0; background: #ffffff; }
.canvas { position: absolute; inset: 0; }
.canvas.grid-visible {
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 20px 20px;
}

.canvas-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 12px; color: var(--text-muted); display: none; pointer-events: none;
  z-index: 5;
}
.canvas-hint.visible { display: block; }

/* --------------------------------------------------------------- Properties */
.properties { padding: 12px 14px; }
.pp-empty { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.pp-type-badge {
  display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--accent); margin-bottom: 10px;
}
.pp-field { display: block; margin-bottom: 10px; }
.pp-field > span { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.pp-field input[type="text"], .pp-field textarea {
  width: 100%; font-family: inherit; font-size: 12.5px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text);
}
.pp-field textarea { resize: vertical; }
.pp-field input[type="color"] { width: 100%; height: 30px; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; background: #fff; }
.pp-readonly { color: var(--text-muted); background: var(--bg) !important; }
.pp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-note { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; }

/* ------------------------------------------------------------------ Status bar */
.statusbar {
  height: var(--statusbar-h); min-height: var(--statusbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--panel-bg); border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.statusbar-spacer { flex: 1 1 auto; }

/* ---------------------------------------------------------------------- Modal */
.modal { position: fixed; inset: 0; background: rgba(20,18,15,.4); display: flex; align-items: center; justify-content: center; z-index: 900; }
.modal-panel { width: 440px; max-height: 80vh; overflow-y: auto; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 15px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 12px 16px; }
.shortcut-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.shortcut-row kbd { font-family: ui-monospace, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 11px; }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 620px) {
  .sidebar-right { display: none; }
}

/* NEVER hide or cover bpmn-js's required attribution watermark
   (.bjs-powered-by) - this is a license condition, not a style choice. */
.bjs-powered-by { z-index: 20 !important; }
