/* The look of the GTK shell (Adwaita dark, with the CSS of linux/src/main.c).
   SPDX-License-Identifier: AGPL-3.0-or-later */

:root {
  --bg: #2d2d2d;
  --header: #303030;
  --header-dark: #242424;
  --button: #3a3a3a;
  --button-hover: #454545;
  --button-active: #232323;
  --row-hover: #383838;
  --row-selected: #202020;
  --entry: #232323;
  --card: #353535;
  --border: #1f1f1f;
  --fg: rgba(255, 255, 255, 0.92);
  --dim: rgba(255, 255, 255, 0.55);
  --accent: #78aeed;
  --accent-bg: #1c5fb0;
  --accent-bg-hover: #2468bd;
  --warning: #e5a50a;
  --error: #ff7b63;
  --view-bg: #f6f7f8;
  --radius: 6px;
  font-family: "Inter", "Cantarell", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14.5px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); }
body { display: flex; flex-direction: column; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }
svg { display: block; }

/* ---- buttons ---- */

button {
  background: var(--button);
  border: none;
  border-radius: var(--radius);
  padding: 5px 10px;
  min-height: 32px;
  cursor: default;
}
button:hover:not(:disabled) { background: var(--button-hover); }
button:active:not(:disabled), button.checked { background: var(--button-active); }
button:disabled { opacity: 0.5; }
button.flat { background: transparent; }
button.flat:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); }
button.icon { padding: 5px 8px; display: inline-flex; align-items: center; justify-content: center; }
button.menu-button::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 2px 3px 9px;
  border-right: 1.3px solid currentColor;
  border-bottom: 1.3px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.85;
}
button.suggested { background: var(--accent-bg); color: #fff; width: 100%; }
button.suggested:hover:not(:disabled) { background: var(--accent-bg-hover); }
button.pill { border-radius: 999px; padding: 6px 22px; background: var(--accent-bg); color: #fff; }

/* ---- the header bar ---- */

.headerbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  min-height: 47px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hb-start, .hb-end { display: flex; gap: 6px; align-items: center; z-index: 1; }
.hb-end { margin-left: auto; }
.hb-title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-weight: 700; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 30%;
}

/* ---- the window ---- */

.window { flex: 1; display: flex; min-height: 0; }
.preview { flex: 1; position: relative; background: var(--view-bg); min-width: 0; overflow: hidden; }
.preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.preview.drop { outline: 3px dashed var(--accent-bg); outline-offset: -8px; }
.panel {
  width: 560px; max-width: 46vw; min-width: 340px;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

/* The floating bars of the preview (.zg-float). */
.float {
  position: absolute;
  background: rgba(45, 45, 45, 0.88);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  color: var(--fg);
}
.toolbar { top: 10px; left: 10px; display: flex; gap: 4px; align-items: center; }
.toolbar .tool { min-height: 34px; padding: 4px 11px; }
.toolbar .tool.icon { padding: 4px 10px; }
.linked { display: flex; }
.linked .tool { border-radius: 0; }
.linked .tool:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.linked .tool:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.legend { top: 58px; left: 10px; font-size: 0.8em; padding: 3px 10px; font-variant-numeric: tabular-nums; }

.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: #3d3846; pointer-events: none;
}
.empty > * { pointer-events: auto; }
.empty-title { font-size: 1.5em; font-weight: 700; }
.empty-text { opacity: 0.7; }
.busy {
  position: absolute; right: 64px; top: 10px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(36, 36, 36, 0.85); color: #fff; font-size: 0.85em;
}
.toast {
  position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%);
  background: rgba(36, 36, 36, 0.92); color: #fff; padding: 8px 16px; border-radius: 999px; max-width: 80%;
}

/* The layer slider with two knobs (.zg-layers). */
.layers {
  position: absolute; right: 14px; top: 140px; bottom: 140px;
  width: 30px;
  user-select: none;
}
.layers .trough {
  position: absolute; left: 13px; width: 4px; top: 9px; bottom: 9px;
  border-radius: 2px; background: rgba(0, 0, 0, 0.18);
}
.layers .highlight { position: absolute; left: 0; right: 0; border-radius: 2px; background: var(--accent-bg); }
.layers .knob {
  position: absolute; left: 6px; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 9px; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.12);
  outline: none;
}
.layers .knob:hover, .layers .knob:focus-visible {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(28, 95, 176, 0.25);
}
.layers .bubble {
  position: absolute; right: 34px; margin-top: -10px;
  font-size: 0.75em; font-variant-numeric: tabular-nums; color: #fff;
  background: rgba(32, 35, 38, 0.82); border-radius: 6px; padding: 1px 6px; white-space: pre; text-align: right;
}

.scrub {
  left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 14px;
  width: min(460px, 70%);
}
.scrub input { flex: 1; }
.scrub-label { font-size: 0.8em; font-variant-numeric: tabular-nums; min-width: 130px; }
input[type=range] { accent-color: var(--accent-bg); }

/* ---- the panel ---- */

.panel-top { display: flex; align-items: center; padding: 8px 8px 4px; gap: 6px; }
.panel-top .switcher { margin: 0 auto; transform: translateX(-14px); }
.switcher { display: flex; background: var(--button); border-radius: var(--radius); }
.switcher button { min-width: 133px; background: transparent; }
.switcher button.checked { background: var(--button-active); }
.page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.crumbbar { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-bottom: 1px solid var(--border); min-height: 40px; }
.crumbs { display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; }
.crumbs button { background: transparent; min-height: 24px; padding: 2px 6px; white-space: nowrap; }
.crumbs button:hover { background: rgba(255, 255, 255, 0.07); }
.crumbs button.here { font-weight: 700; }
.crumbs .sep { opacity: 0.6; padding: 0 2px; font-size: 0.85em; }
.scopebar { display: flex; align-items: center; gap: 6px; padding: 4px 8px 2px; }
.scopebar .dim { white-space: nowrap; }
.dropdown { flex: 1; text-align: left; background: var(--button); }
.searchbar {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 8px; padding: 0 9px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid rgba(255, 255, 255, 0.1);
}
.searchbar input { flex: 1; background: transparent; border: none; outline: none; padding: 7px 0; }

.columns { flex: 1; min-height: 0; position: relative; }
.column { position: absolute; inset: 0; overflow-y: auto; padding: 4px 6px 12px; }
.group-title { font-weight: 700; padding: 14px 6px 6px; }
.group-title:first-child { padding-top: 6px; }
.row {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 18px; min-height: 38px; border-radius: var(--radius);
}
.row:hover { background: var(--row-hover); }
.row.selected { background: var(--row-selected); }
.row .label { flex: 1; min-width: 0; }
.row .label .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .label .tag { font-size: 0.8em; opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .label .tag.mine { color: var(--accent); opacity: 1; }
.chevron { width: 7px; height: 7px; border-right: 1.3px solid currentColor; border-top: 1.3px solid currentColor; transform: rotate(45deg); opacity: 0.7; margin: 0 6px 0 4px; flex: none; }
.setting-row { min-height: 48px; padding-right: 6px; }
.editor { display: flex; align-items: center; gap: 6px; flex: none; }
.unit { font-size: 0.9em; min-width: 3.2em; color: var(--dim); }
input.num, input.text {
  background: var(--entry); border: 1px solid transparent; border-radius: var(--radius);
  padding: 4px 8px; min-height: 30px; outline: none;
  font-variant-numeric: tabular-nums;
}
input.num { width: 72px; text-align: right; }
input.text { width: 180px; }
input.num:focus, input.text:focus { border-color: var(--accent-bg); }
input.error { color: var(--error); }
input.unusual { color: var(--warning); }
select.choice {
  background: var(--button); border: none; border-radius: var(--radius); padding: 4px 8px; min-height: 32px;
}
.switch {
  position: relative; width: 50px; height: 26px; border-radius: 13px;
  background: #555; flex: none; cursor: default; border: none; padding: 0; min-height: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 10px;
  background: #fff; transition: left 120ms;
}
.switch.on { background: var(--accent-bg); }
.switch.on::after { left: 27px; }
.switch:hover:not(:disabled) { background: #5e5e5e; }
.switch.on:hover:not(:disabled) { background: var(--accent-bg-hover); }

.detail { padding: 10px 14px 16px; }
.detail h3 { margin: 4px 0 2px; font-size: 1.05em; }
.detail .path { font-size: 0.8em; color: var(--dim); margin-bottom: 8px; }
.detail .edit-line { display: flex; align-items: center; gap: 8px; }
.detail .edit-line .name { flex: 1; }
.detail .edit-line input.num { width: 108px; }
.detail .slider { width: 100%; margin: 8px 0 2px; }
.detail .formula { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.detail .formula .name { flex: 1; color: var(--dim); }
.detail .formula input { width: 268px; }
.detail .default { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; }
.detail .default .text { flex: 1; color: var(--dim); }
.detail .error-text { color: var(--error); font-size: 0.9em; margin-top: 4px; }
.detail .doc { margin: 14px 0 0; line-height: 1.35; white-space: pre-wrap; }
.detail h4 { margin: 16px 0 4px; font-size: 1em; }
.feature-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius); }
.feature-row .dot { font-size: 1.15em; line-height: 1; }
.feature-row .what { flex: 1; }
.feature-row .stat { color: var(--dim); font-variant-numeric: tabular-nums; }
.note { color: var(--dim); margin-top: 6px; }

.placeholder { margin: auto; text-align: center; padding: 30px; }
.placeholder-title { font-weight: 700; font-size: 1.1em; margin-bottom: 6px; }

/* The print card (.zg-summary). */
.summary { background: var(--card); padding: 12px 14px 14px; border-top: 1px solid var(--border); }
.summary.stale > :not(.progress):not(button) { opacity: 0.55; }
.sum-time { font-size: 1.6em; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-detail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-took { font-size: 0.85em; margin-bottom: 8px; }
.progress { height: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; margin: 0 0 8px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent-bg); transition: width 80ms linear; }

/* ---- menus ---- */

.menu-layer { position: fixed; inset: 0; z-index: 10; }
.menu {
  position: absolute; min-width: 180px; max-height: 70vh; overflow-y: auto;
  background: #383838; border-radius: 10px; padding: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.menu .section-title { font-size: 0.8em; font-weight: 700; color: var(--dim); padding: 6px 10px 3px; }
.menu .sep { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 5px 4px; }
.menu button { display: flex; width: 100%; text-align: left; background: transparent; min-height: 30px; gap: 8px; }
.menu button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.menu button .check { width: 14px; }

.dialog-text { white-space: pre-wrap; font-size: 0.85em; max-width: 640px; max-height: 60vh; overflow: auto; padding: 8px 10px; }
