/* DXF → SVG converter — styling shared with the Illustrated Thumbnails app:
 * warm cream canvas, white panels, near-black ink, quiet uppercase headers. */

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

[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f0eb;
  color: #1a1a1a;
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: #666;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

main {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ── upload panel ─────────────────────────────── */

.dropzone {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.drag-over {
  border-color: #1a1a1a;
  background: #faf8f5;
  outline: none;
}

.dropzone-content svg {
  color: #999;
  margin-bottom: 0.5rem;
}

.dropzone-content p {
  font-size: 0.85rem;
  line-height: 1.45;
}

.dropzone-content .dim {
  color: #999;
  font-size: 0.8rem;
}

/* ── file list ────────────────────────────────── */

.file-list {
  list-style: none;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-list:empty { display: none; }

.file-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #f5f0eb;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}

.file-list li:hover { border-color: #ccc; }
.file-list li.active { border-color: #1a1a1a; }

.file-list li .fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list li .fmeta {
  color: #999;
  font-size: 0.7rem;
  font-weight: 400;
  flex: none;
}

.file-list li.error .fmeta { color: #c00; }

.file-list li .remove {
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #999;
  padding: 0 0.25rem;
  flex: none;
}

.file-list li .remove:hover { color: #1a1a1a; }

/* ── settings ─────────────────────────────────── */

.settings {
  margin-top: 1.25rem;
}

.settings h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: 0.75rem;
}

.settings .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.settings .row > span:first-child { color: #666; font-weight: 500; }

.settings select,
.settings input[type="number"] {
  font: inherit;
  font-size: 0.75rem;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  max-width: 170px;
}

.settings select:hover,
.settings input[type="number"]:hover { border-color: #999; }

.settings input[type="number"] { width: 64px; }

.unit-input {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.unit-input em {
  font-style: normal;
  font-size: 0.7rem;
  color: #999;
}

.settings .check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.settings .check input { accent-color: #1a1a1a; }


/* ── preview panel ────────────────────────────── */

.preview-panel {
  padding: 0;
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #eee;
}

.file-title {
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.zoom-btn {
  padding: 0.25rem 0.55rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #666;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.zoom-btn:hover {
  border-color: #999;
  color: #1a1a1a;
}

#zoomLevel {
  font-size: 0.7rem;
  color: #999;
  min-width: 2.8rem;
  text-align: center;
}

.viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 320px;
  overflow: hidden;
  background:
    repeating-conic-gradient(#efe9e2 0% 25%, #f5f0eb 0% 50%)
    0 0 / 20px 20px;
  cursor: grab;
  touch-action: none;
}

.viewport.panning { cursor: grabbing; }

.canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.canvas svg { display: block; }

/* ── actions & stats ──────────────────────────── */

.actions {
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover:not(:disabled) { opacity: 0.85; }

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: #f5f0eb;
  color: #1a1a1a;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: #ebe5dd;
  border-color: #999;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.4rem;
  padding: 0 1.5rem 1rem;
  font-size: 0.75rem;
  color: #666;
}

.stats-bar .chip {
  background: #f5f0eb;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
}

.stats-bar .chip b { color: #1a1a1a; font-weight: 600; }

.stats-bar .chip.warn {
  background: #fff6e0;
  color: #8a6d1a;
}

/* ── toast ────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 10px);
  background: #1a1a1a;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── responsive ───────────────────────────────── */

@media (max-width: 768px) {
  main { grid-template-columns: 1fr; }
}
