/* izradi customizer — admin panel.
   Neutral surface that sits comfortably inside Shopify admin in both themes. */

:root {
  --bg: #f1f1f1;
  --surface: #ffffff;
  --border: #d9d9d9;
  --text: #303030;
  --text-subdued: #616161;
  --accent: #303030;
  --accent-text: #ffffff;
  --danger: #8e1f0b;
  --zone: #3b82f6;
  --radius: 8px;
  --gap: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1a1a1a;
    --surface: #242424;
    --border: #3d3d3d;
    --text: #e3e3e3;
    --text-subdued: #a0a0a0;
    --accent: #e3e3e3;
    --accent-text: #1a1a1a;
    --danger: #ff8a7a;
    --zone: #60a5fa;
  }
}

:root[data-theme='dark'] {
  --bg: #1a1a1a;
  --surface: #242424;
  --border: #3d3d3d;
  --text: #e3e3e3;
  --text-subdued: #a0a0a0;
  --accent: #e3e3e3;
  --accent-text: #1a1a1a;
  --danger: #ff8a7a;
  --zone: #60a5fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__title { margin: 0; font-size: 16px; font-weight: 650; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.badge {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-subdued);
  font-size: 12px;
}

/* Buttons */
.btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.btn:hover:not(:disabled) { border-color: var(--text-subdued); }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--danger { color: var(--danger); border-color: var(--danger); margin-top: var(--gap); width: 100%; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: var(--gap);
  padding: var(--gap);
  align-items: start;
}

.sidebar,
.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap);
}

.sidebar__heading { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-subdued); }

.product-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

.product-list__button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.product-list__button:hover { background: var(--bg); }
.product-list__item--active .product-list__button { border-color: var(--border); background: var(--bg); }

.product-list__thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.product-list__text { display: grid; }
.product-list__text span { color: var(--text-subdued); font-size: 12px; }

.empty { color: var(--text-subdued); font-size: 13px; }

/* Workspace */
.workspace__header { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); margin-bottom: var(--gap); }
.workspace__header h2 { margin: 0; font-size: 16px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: var(--gap); }

.tabs__tab,
.tabs__add {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text-subdued);
  font: inherit;
  cursor: pointer;
}

.tabs__tab--active { background: var(--bg); border-color: var(--border); color: var(--text); font-weight: 600; }
.tabs__add { color: var(--text-subdued); }
.tabs__tab:hover, .tabs__add:hover { background: var(--bg); }

.editor-pane { display: grid; grid-template-columns: 1fr minmax(200px, 260px); gap: var(--gap); align-items: start; }
.editor-pane__stage { min-width: 0; }

/* Zone editor */
.zone-editor__stage {
  position: relative;
  display: block;
  max-width: 560px;
  margin-inline: auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  /* Mockups are large CDN images. Without a reserved box the stage collapses to
     zero height while one loads, and the whole pane jumps when it arrives. */
  min-height: 320px;
}

.zone-editor__image { display: block; width: 100%; height: auto; user-select: none; }

.zone-editor__overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.zone {
  position: absolute;
  border: 2px solid var(--zone);
  background: color-mix(in srgb, var(--zone) 14%, transparent);
  cursor: move;
}

.zone--selected { border-style: solid; box-shadow: 0 0 0 1px var(--surface); }

.zone__label,
.zone__size {
  position: absolute;
  left: 0;
  padding: 1px 6px;
  background: var(--zone);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  border-radius: 4px;
}

.zone__label { top: -20px; }
.zone__size { bottom: -20px; background: color-mix(in srgb, var(--zone) 80%, black); }

.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border: 2px solid var(--zone);
  border-radius: 2px;
}

.handle--nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle--n  { top: -6px; left: calc(50% - 5px); cursor: ns-resize; }
.handle--ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle--e  { top: calc(50% - 5px); right: -6px; cursor: ew-resize; }
.handle--se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle--s  { bottom: -6px; left: calc(50% - 5px); cursor: ns-resize; }
.handle--sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle--w  { top: calc(50% - 5px); left: -6px; cursor: ew-resize; }

/* Side panel */
.side-panel { display: grid; gap: 10px; align-content: start; }
.side-panel__title { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-subdued); }

.field { display: grid; gap: 4px; }
.field__label { font-size: 12px; color: var(--text-subdued); }

.field__input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  width: 100%;
}

.field__readout { font-size: 11px; color: var(--text-subdued); word-break: break-all; }

/* Mockup picker */
.mockup-picker { display: grid; gap: 10px; }
.mockup-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }

.mockup-picker__option {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
}

.mockup-picker__option img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mockup-picker__option:hover { border-color: var(--text-subdued); }
.mockup-picker__option--active { border-color: var(--zone); }

/* Upload dropzone */
.dropzone {
  display: grid;
  place-items: center;
  padding: 16px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-subdued);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}

.dropzone:hover,
.dropzone:focus-visible { border-color: var(--text-subdued); }
.dropzone--over { border-color: var(--zone); background: color-mix(in srgb, var(--zone) 10%, var(--bg)); }
.dropzone--busy { cursor: progress; border-style: solid; border-color: var(--zone); }
.dropzone small { opacity: 0.8; }

.placeholder { display: grid; place-items: center; min-height: 240px; color: var(--text-subdued); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: #303030;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
}

.toast--error { background: var(--danger); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .editor-pane { grid-template-columns: 1fr; }
}
