/* ── Bundled font @font-face declarations ── */
@font-face {
  font-family: 'Roboto';
  src: url('/fonts/Roboto-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: url('/fonts/OpenSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Lato';
  src: url('/fonts/Lato-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Global component styles for Kerf Engine app ── */

/* File Upload Zone */
.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  user-select: none;
}

.file-upload-zone:hover,
.file-upload-zone--drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.file-upload-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.file-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.file-upload-icon {
  font-size: 28px;
}

.file-upload-prompt p {
  margin: 0;
  color: var(--text-h);
  font-size: 15px;
}

.file-upload-prompt small {
  color: var(--text);
  font-size: 13px;
}

.file-upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-upload-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.file-upload-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.file-upload-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-h);
  word-break: break-all;
}

.file-upload-size {
  font-size: 13px;
  color: var(--text);
}

.file-upload-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Preset Selector */
.preset-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-h);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preset-loading,
.preset-error {
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

.preset-error {
  color: #e74c3c;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background-color 0.12s;
  font-family: inherit;
}

.preset-card:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.preset-card--selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 1px var(--accent);
}

.preset-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-h);
  text-transform: capitalize;
}

.preset-card-desc {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
}

/* Parameter Sliders */
.parameter-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.parameter-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-h);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slider-row {
  display: grid;
  grid-template-columns: 120px 1fr 48px;
  align-items: center;
  gap: 8px;
}

.slider-label {
  font-size: 13px;
  color: var(--text-h);
  white-space: nowrap;
}

.slider-input {
  width: 100%;
  height: 4px;
  cursor: pointer;
  accent-color: var(--accent);
}

.slider-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* SVG Preview */
.svg-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.svg-preview--loading {
  gap: 12px;
}

.svg-preview-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.svg-preview-status {
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

.svg-preview--error {
  gap: 4px;
}

.svg-preview-error {
  font-size: 14px;
  color: #e74c3c;
  margin: 0;
}

.svg-preview-hint {
  font-size: 13px;
  color: var(--text);
  margin: 0;
}

.svg-preview--empty {
  opacity: 0.7;
}

.svg-preview-placeholder {
  font-size: 15px;
  color: var(--text);
  text-align: center;
  margin: 0;
}

.svg-preview--ready {
  justify-content: flex-start;
  gap: 12px;
}

.svg-preview-container {
  width: 100%;
  max-height: 70vh;
  overflow: auto;
}

.svg-preview-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.svg-preview-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text);
  padding: 6px 0;
  border-top: 1px solid var(--border);
  width: 100%;
}

.svg-preview-warnings {
  color: #e67e22;
}

/* Use This button */
.use-this-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

.use-this-btn:hover {
  opacity: 0.9;
}

.use-this-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Output Info Bar */
.output-info-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.output-info-bar--empty {
  opacity: 0.6;
}

.output-info-placeholder {
  color: var(--text);
  font-size: 13px;
}

.output-info-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.output-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.output-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
}

.output-stat-value {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.output-stat--green .output-stat-value {
  color: #27ae60;
}

.output-stat--yellow .output-stat-value {
  color: #f39c12;
}

.output-stat--red .output-stat-value {
  color: #e74c3c;
}

.output-info-warnings {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.output-info-warning {
  font-size: 12px;
  color: #e67e22;
}

/* Placeholder views */
.placeholder-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  font-size: 20px;
  color: var(--text);
}

/* Canvas toolbar buttons */
.canvas-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-h);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
  user-select: none;
}

.canvas-tool-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.canvas-tool-btn--active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.canvas-tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.canvas-tool-icon {
  font-size: 16px;
  line-height: 1;
}

.canvas-tool-label {
  font-size: 12px;
}

/* Canvas view: override #root width constraint */
#app:has([data-testid="canvas-container"]) {
  max-width: 100%;
}

/* Artboard setup styling */
.artboard-setup-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 24px;
}

.artboard-setup-modal {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  width: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.artboard-setup-modal h2 {
  margin: 0 0 4px;
}

.artboard-setup-shapes {
  border: none;
  padding: 0;
  margin: 0;
}

.artboard-setup-shapes legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-h);
  margin-bottom: 8px;
}

.artboard-shape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
}

.artboard-shape-btn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-h);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}

.artboard-shape-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.artboard-shape-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.artboard-setup-dimensions {
  display: flex;
  gap: 12px;
}

.artboard-setup-dimensions label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-h);
  font-weight: 500;
  flex: 1;
}

.artboard-setup-dimensions input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-h);
}

.artboard-setup-dimensions input:disabled {
  opacity: 0.5;
}

.artboard-setup-units {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 16px;
  align-items: center;
}

.artboard-setup-units legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-h);
  margin-right: 8px;
}

.artboard-setup-units label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-h);
  cursor: pointer;
}

.artboard-setup-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.artboard-setup-confirm:hover {
  opacity: 0.9;
}

/* ── Canvas Toolbar (CanvasToolbar component) ── */

.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

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

.canvas-toolbar-zoom-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-h);
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* ── Object Panel (layer list) ── */

.object-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.object-panel-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--border);
}

.object-panel-empty {
  font-size: 13px;
  color: var(--text);
  opacity: 0.6;
  padding: 12px 0;
  text-align: center;
}

.object-panel-list {
  display: flex;
  flex-direction: column;
}

.object-panel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.1s;
  font-size: 13px;
  color: var(--text-h);
}

.object-panel-row:hover {
  background: var(--accent-bg);
}

.object-panel-row--selected {
  background: var(--accent-bg);
  border-left: 2px solid var(--accent);
  padding-left: 2px;
}

.object-panel-row--hidden {
  opacity: 0.4;
}

.object-panel-drag {
  cursor: grab;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.object-panel-type-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.object-panel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-panel-name-input {
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-h);
  outline: none;
}

.object-panel-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  border-radius: 3px;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.1s;
}

.object-panel-icon-btn:hover {
  background: var(--accent-bg);
}

.object-panel-icon-btn--off {
  opacity: 0.35;
}

.object-panel-icon-btn--on {
  color: var(--accent);
}

/* ── Alignment Bar ── */

.alignment-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.alignment-bar-group {
  display: flex;
  gap: 2px;
}

.alignment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-h);
  padding: 0;
  transition: border-color 0.1s, background-color 0.1s;
}

.alignment-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.alignment-btn:active {
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* ── Shape Properties ── */

.shape-properties {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.shape-properties-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  padding: 0 0 6px;
}

.shape-prop-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.shape-prop-section:last-child {
  border-bottom: none;
}

.shape-prop-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text);
}

.shape-prop-dims {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-h);
}

.shape-prop-color-input {
  width: 100%;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px;
  background: var(--bg);
}

.shape-prop-number-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-h);
}

.shape-prop-fill-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shape-prop-fill-row .shape-prop-color-input {
  flex: 1;
}

.shape-prop-fill-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-h);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.shape-prop-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-h);
  cursor: pointer;
}

.shape-prop-range-input {
  width: 100%;
  accent-color: var(--accent);
}

.shape-prop-range-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
