/**
 * Restock Studio tool UI (embedded in Webflow /tools page).
 * Loaded from /public/css/restock-studio-app.css
 */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f5f0;
  --bg-card: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #1f1f1f;
  --muted: #6b6b6b;
  --muted-2: #9a9a9a;
  --line: #e8e5dd;
  --line-2: #f1eee6;
  --highlight: #f4d03f;
  --recover: #14794a;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "PT Mono", ui-monospace, "SF Mono", monospace;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
}

.rs-app {
  --rs-font-base: 16px;
  font-size: var(--rs-font-base);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  background: var(--bg);
}

.rs-app * {
  box-sizing: border-box;
}

.rs-app .shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3.5rem;
}

.rs-app .step {
  margin-bottom: 3.5rem;
}

.rs-app .step-head {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.rs-app .step-num {
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.rs-app .step-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

/* Upload */
.rs-app .upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-card);
  cursor: pointer;
  text-align: center;
  padding: 2.5rem 1.5rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.rs-app .upload-zone input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.rs-app .upload-zone:hover,
.rs-app .upload-zone.dragover {
  border-color: #b8b0a4;
  background: var(--bg-soft);
  box-shadow: 0 4px 20px rgba(10, 10, 10, 0.06);
}

.rs-app .upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.rs-app .upload-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rs-app .upload-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.rs-app .upload-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.rs-app .upload-preview {
  display: none;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  width: 100%;
  text-align: left;
}

.rs-app .upload-zone.has-image .upload-icon,
.rs-app .upload-zone.has-image .upload-prompt,
.rs-app .upload-zone.has-image .upload-hint {
  display: none;
}

.rs-app .upload-zone.has-image {
  min-height: auto;
  border-style: solid;
  padding: 1.25rem 1.5rem;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
}

.rs-app .upload-zone.has-image .upload-preview {
  display: flex;
}

.rs-app .upload-thumb {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--r-sm);
  background: var(--line-2) center / cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.rs-app .upload-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rs-app .upload-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

.rs-app .upload-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.rs-app .upload-replace {
  margin-left: auto;
  background: var(--ink);
  color: #fff;
  border: 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

/* Customize */
.rs-app .customize {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
}

@media (max-width: 640px) {
  .rs-app .customize {
    grid-template-columns: 1fr;
  }
}

.rs-app .field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rs-app .field-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--mono);
}

.rs-app .field input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rs-app .field input[type="text"]:focus {
  outline: 0;
  border-color: #9a9488;
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.04);
}

.rs-app .swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.1rem;
}

.rs-app .swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #ddd;
  cursor: pointer;
  padding: 0;
  background: #ccc;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.rs-app .swatch:hover {
  transform: scale(1.1);
}

.rs-app .swatch.active {
  box-shadow: 0 0 0 2px var(--ink);
}

.rs-app .swatch-custom {
  position: relative;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #ddd;
  display: block;
  cursor: pointer;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  overflow: hidden;
}

.rs-app .swatch-custom input[type="color"] {
  position: absolute;
  width: 150%;
  height: 150%;
  left: -25%;
  top: -25%;
  padding: 0;
  border: 0;
  cursor: pointer;
  opacity: 0;
}

/* Template cards */
.rs-app .templates {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 800px) {
  .rs-app .templates {
    grid-template-columns: 1fr;
  }
}

.rs-app .template-card {
  text-align: left;
  display: block;
  padding: 0;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.rs-app .template-card:hover {
  border-color: #c0c0cc;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.rs-app .template-card.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.rs-app .template-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  min-height: 5.5rem;
  background: var(--line-2) center / cover;
  background-color: #e0dcd3;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  margin: 0;
}

.rs-app .template-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  padding: 0.6rem 0.9rem 0.15rem;
}

.rs-app .template-desc {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 0.9rem 0.85rem;
  line-height: 1.35;
}

/* Preview */
.rs-app #previewContainer {
  min-height: 3rem;
}

.rs-app .preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.rs-app .preview-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.65rem 0.65rem 0.5rem;
  max-width: 100%;
  overflow: hidden;
}

.rs-app .preview-canvas-wrap {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
  background: #0a0a0a0a;
}

.rs-app .preview-canvas-wrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
  margin: 0 auto;
}

.rs-app .preview-meta {
  padding: 0.4rem 0.15rem 0.15rem;
}

.rs-app .preview-platform {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}

.rs-app .preview-dim {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}

.rs-app .preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.2rem 1.5rem;
  border: 1.5px dashed #ddd;
  border-radius: var(--r-md);
  background: var(--bg-soft);
  color: var(--muted);
}

.rs-app .preview-empty-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.rs-app .preview-empty-text {
  font-size: 0.95rem;
  text-align: center;
  max-width: 18rem;
  line-height: 1.45;
}

/* Download */
.rs-app .download-row {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}

.rs-app .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #0a0a0a;
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.35rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  text-decoration: none;
}

.rs-app .btn-primary:hover {
  transform: translateY(-1px);
  background: #222;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.rs-app .btn-primary svg {
  width: 0.9rem;
  height: 0.9rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rs-app .download-status {
  text-align: center;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--recover);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.rs-app .download-status.show {
  opacity: 1;
}

@media (min-width: 1000px) {
  .rs-app .shell {
    padding: 0 0 4rem 0;
  }
}
