/* ============================================================
   Design tokens from wireframe_board (1).svg
   ============================================================ */
:root {
  --bg: #F3F4F6;
  --panel: #FCFCFD;
  --card: #FFFFFF;
  --field: #F9FAFB;
  --border: #E5E7EB;
  --border-mid: #D1D5DB;
  --border-muted: #9CA3AF;
  --text: #111827;
  --text-muted: #6B7280;
  --btn-primary-bg: #111827;
  --btn-primary-text: #FFFFFF;
  --radius-panel: 18px;
  --radius-card: 16px;
  --radius-field: 12px;
  --radius-btn: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
}

.page-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── Panel ── */
.panel {
  background: var(--panel);
  border-radius: var(--radius-panel);
  padding: 28px 24px;
  border: 1px solid var(--border);
}

/* ── Typography ── */
.title    { font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.label    { font-size: 15px; font-weight: 600; margin-bottom: 8px; display: block; }
.hint     { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ── Form fields ── */
.field {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-field);
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.field:focus { border-color: var(--btn-primary-bg); }
.field::placeholder { color: var(--border-muted); }

select.field { appearance: none; cursor: pointer; }
textarea.field { resize: vertical; min-height: 110px; }

/* ── Buttons ── */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.btn-row .btn { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
.btn-primary:hover:not(:disabled) { opacity: 0.85; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover { background: var(--bg); }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius-card);
  padding: 28px 16px;
  text-align: center;
  background: var(--field);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--btn-primary-bg);
  background: var(--bg);
}
.upload-zone input[type="file"] { display: none; }
.upload-zone .upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone .upload-text { font-size: 14px; color: var(--text-muted); }
.upload-zone .upload-link { color: var(--text); text-decoration: underline; cursor: pointer; }

.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.photo-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-thumb .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Generated image blocks ── */
.variant-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
}
.variant-block .variant-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.variant-img {
  width: 100%;
  border-radius: 10px;
  display: block;
  max-height: 420px;
  object-fit: contain;
  background: var(--bg);
}
.variant-img-placeholder {
  width: 100%;
  height: 300px;
  background: var(--bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Success screen ── */
.success-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }

/* ── Form group ── */
.form-group { margin-bottom: 18px; }

/* ── Checkbox ── */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--btn-primary-bg);
}
.checkbox-row label { font-size: 14px; color: var(--text-muted); cursor: pointer; }

/* ── Loading overlay ── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(243,244,246,0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.loading-overlay.active { display: flex; }
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--btn-primary-bg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; font-weight: 600; color: var(--text); }
.loading-hint { font-size: 13px; color: var(--text-muted); }

/* ── Error banner ── */
.error-banner {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-field);
  padding: 12px 14px;
  font-size: 13px;
  color: #B91C1C;
  margin-bottom: 18px;
}

/* ── Admin ── */
.admin-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.admin-nav a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
}
.admin-nav a.active, .admin-nav a:hover { background: var(--bg); color: var(--text); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); color: var(--text-muted); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.td-mono { font-family: monospace; font-size: 12px; word-break: break-all; max-width: 300px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-red   { background: #FEE2E2; color: #991B1B; }
.badge-gray  { background: var(--bg); color: var(--text-muted); }
