/* CNC Peck Converter — styles */

:root {
  --bg: #14171c;
  --panel: #1b2027;
  --panel-2: #20262f;
  --border: #2c3440;
  --text: #c9d4e0;
  --muted: #7a8494;
  --accent: #5aa9ff;
  --accent-2: #ff6a3d;
  --green: #4fe08b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { display: flex; align-items: center; }
.titles h1 { margin: 0; font-size: 17px; letter-spacing: .3px; }
.tagline { margin: 0; font-size: 12px; color: var(--muted); max-width: 620px; }
.file-name {
  color: var(--muted);
  font-size: 12px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 9px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.toolbar { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #27303b; border-color: #3a4654; }
.btn.primary { background: #1f4a86; border-color: #2a63ab; color: #fff; }
.btn.primary:hover { background: #25579c; }
.btn.wide { width: 100%; margin-bottom: 6px; }

main { flex: 1; display: flex; min-height: 0; }

.main-left { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.canvas-wrap { position: relative; flex: 1; min-width: 0; min-height: 0; }
#cnv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

.drop-hint {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  text-align: center;
  font-size: 15px;
  pointer-events: none;
  background: rgba(20,23,28,.6);
  padding: 18px 26px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: none;
}
.canvas-wrap.has-file .drop-hint { display: none; }
.drop-hint.show { display: block; }

#sidebar {
  width: 310px;
  max-width: 85vw;
  flex: none;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
}

.panel { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.panel h2 { margin: 0 0 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.panel .hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }

/* draggable dividers */
.resizer { flex: none; background: transparent; }
.resizer.h { height: 6px; cursor: row-resize; background: var(--panel); border-top: 1px solid var(--border); }
.resizer.h:hover, .resizer.h.active { background: rgba(90,169,255,.35); }

.list { display: flex; flex-direction: column; gap: 3px; }
#settingsPanel .list, .actions .list { max-height: none; }

.muted { color: var(--muted); font-size: 12.5px; padding: 2px 0; }

.group-row, .offcut-row, .cut-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.group-row:hover, .offcut-row:hover { background: #262e39; }
.group-row input { accent-color: var(--accent-2); width: 15px; height: 15px; flex: none; }
.group-label { font-weight: 600; }
.group-label.cut-label { font-weight: 500; color: var(--green); font-family: ui-monospace, Menlo, monospace; }
.group-sel { color: var(--accent-2); font-size: 12px; margin-left: auto; }
.group-count { color: var(--muted); font-size: 12px; }
.offcut-row.sel { background: rgba(255,196,87,.14); outline: 1px solid rgba(255,196,87,.4); }
.cut-row { color: var(--green); font-family: ui-monospace, Menlo, monospace; cursor: default; }
.cut-row:hover { background: transparent; }

.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 9px; }
.field span { font-size: 12px; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check input { width: 16px; height: 16px; accent-color: var(--accent-2); }
.field input, .field select {
  background: #171b21;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
}
.field input:focus, .field select:focus { outline: 1px solid var(--accent); }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  min-height: 26px;
}
#status.err { color: #ff7b6b; }
.summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* before/after code comparison */
.diff-panel {
  flex: none;
  display: flex;
  flex-direction: column;
  height: 210px;
  gap: 5px;
  padding: 5px 10px 8px;
  border-top: 1px solid var(--border);
  background: #101318;
}
.diff-head { display: flex; align-items: center; gap: 10px; }
.diff-label { flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-label.right { text-align: right; }
.diff-cols { flex: 1; display: flex; gap: 8px; min-height: 0; }
.diff-col { flex: 1; min-width: 0; display: flex; }
.diff-scroll {
  flex: 1;
  overflow: auto;
  background: #0c0f13;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
}
.diff-line { display: flex; white-space: pre; min-height: 1.45em; }
.diff-line .ln {
  flex: none;
  min-width: 56px;
  text-align: right;
  padding-right: 8px;
  color: #56606c;
  user-select: none;
  border-right: 1px solid #1d232c;
}
.diff-line .code { flex: 1; padding-left: 8px; }
.diff-line.del .code { color: #ff7b6b; background: rgba(255,70,70,.07); }
.diff-line.add .code { color: #57e38a; background: rgba(70,255,130,.06); }
.diff-line.comment .code { color: #6b7686; font-style: italic; }
.diff-line.gap .code { background: rgba(255,255,255,.025); }
.diff-line.gap { box-shadow: inset 0 -1px 0 rgba(255,255,255,.04); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn.active { background: #1f4a86; border-color: #2a63ab; color: #fff; }

@media (max-width: 900px) {
  .diff-panel { height: 140px; }
}
.tooltip {
  position: absolute;
  z-index: 30;
  max-width: 460px;
  background: #0c0f13;
  color: #c9d4e0;
  border: 1px solid #3a4654;
  border-radius: 7px;
  padding: 7px 9px;
  font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre;
  pointer-events: none;
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
}
.tooltip .tt-line { display: block; }
.tooltip .tt-line.cur { background: rgba(255,196,87,.18); }
.tooltip .tt-title { color: var(--accent-2); font-family: system-ui, sans-serif; font-size: 11px; margin-bottom: 3px; }

@media (max-width: 900px) {
  .diff-panel { height: 140px; }
}

.btn.side { display: none; }

@media (max-width: 900px) {
  .tagline { display: none; }
  #sidebar {
    position: fixed;
    right: 0; top: 52px; bottom: 26px;
    z-index: 20;
    transform: translateX(105%);
    transition: transform .2s ease;
    box-shadow: -8px 0 24px rgba(0,0,0,.5);
  }
  #sidebar.open { transform: translateX(0); }
  .btn.side { display: inline-block; }
}
