/* Pure Design Admin · 3D Models page */

.models-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 0.6rem + 1vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 0.7rem + 0.8vw, 1.75rem);
}

/* ---------- Settings card ---------- */
.settings-card,
.catalog-card {
  background: var(--surface, #fff);
  border: 1px solid var(--rule, #e3ded2);
  border-radius: 10px;
  padding: clamp(1rem, 0.8rem + 0.5vw, 1.6rem);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.theme-dark .settings-card,
body.theme-dark .catalog-card {
  background: var(--surface-dark, #1f1d20);
  border-color: var(--rule-dark, #2c2a2d);
}

.settings-card__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.2rem;
  align-items: flex-start;
}

.settings-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.settings-card__row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

.status-pill {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e9f6ee;
  color: #1f6f3f;
}
.status-pill[data-state="error"]  { background: #fde7e7; color: #a02020; }
.status-pill[data-state="warn"]   { background: #fdf1d6; color: #8a5a0a; }
.status-pill[data-state="ok"]     { background: #e9f6ee; color: #1f6f3f; }

body.theme-dark .status-pill[data-state="ok"]    { background: #25402e; color: #b1e4c2; }
body.theme-dark .status-pill[data-state="error"] { background: #4a2828; color: #f3b6b6; }
body.theme-dark .status-pill[data-state="warn"]  { background: #463818; color: #f0d28a; }

/* ---------- Toggle switch ---------- */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: #c8c4be;
  border-radius: 999px;
  transition: background 180ms ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease;
}

.toggle-switch input:checked + .toggle-track {
  background: #2a8262;
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle-label {
  font-weight: 500;
  font-size: 0.92rem;
}

/* ---------- Catalog card ---------- */
.catalog-card__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.catalog-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.catalog-card__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.catalog-card__actions .input {
  min-width: 220px;
}

.catalog-card__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.loading-state {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  color: var(--ink-mute, #8b8680);
  font-style: italic;
}

.product-card {
  border: 1px solid var(--rule, #e3ded2);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--surface, #fff);
}

body.theme-dark .product-card {
  border-color: var(--rule-dark, #2c2a2d);
  background: var(--surface-dark, #1f1d20);
}

.product-card__media {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #222;
  position: relative;
}

.product-card__media img,
.product-card__media model-viewer {
  width: 100%;
  height: 100%;
  display: block;
}

.product-card__media model-viewer {
  --poster-color: transparent;
}

.product-card__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(20, 17, 15, 0.78);
  color: #FAF8F4;
}
.product-card__badge--has  { background: #2a8262; }
.product-card__badge--none { background: rgba(140, 106, 72, 0.85); }

.product-card__title {
  font-weight: 600;
  line-height: 1.3;
  font-size: 0.98rem;
}

.product-card__sub {
  font-size: 0.78rem;
  color: var(--ink-mute, #8b8680);
}

.product-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.product-card__row strong { font-weight: 500; }

.product-card__row .toggle-track {
  width: 36px; height: 20px;
}
.product-card__row .toggle-thumb {
  width: 16px; height: 16px;
}
.product-card__row .toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

.product-card__upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.product-card__upload-row .btn {
  flex: 1 1 auto;
  font-size: 0.85rem;
}

.product-card__error {
  font-size: 0.78rem;
  color: #a02020;
  min-height: 1em;
}

.upload-input { display: none; }

.upload-progress {
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.upload-progress__bar {
  position: absolute;
  inset: 0;
  width: 0%;
  background: #2a8262;
  transition: width 180ms ease;
}

/* ---------- Seed models block ---------- */
.catalog-card__seed {
  border-top: 1px dashed var(--rule, #e3ded2);
  padding-top: 1rem;
  margin-top: 1.25rem;
}

.seed-models {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.seed-model {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 1px dashed var(--rule, #e3ded2);
  border-radius: 6px;
  background: rgba(140, 106, 72, 0.04);
  font-size: 0.82rem;
}

.seed-model__title { font-weight: 500; font-size: 0.9rem; }

.seed-model__row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.seed-model__row select {
  flex: 1 1 auto;
  min-width: 0;
}

.seed-model__row .btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}


/* ── Dimensions & weight panel (per product card) ─────────────────── */
.product-card__dims {
  margin-top: 0.6rem;
  padding: 0.75rem;
  border-top: 1px dashed var(--rule, #e3ded2);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.product-card__dims-title {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted, #6c6457);
}
.dims-auto, .dims-manual {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem;
  border-radius: 8px;
  background: rgba(140, 106, 72, 0.04);
}
.dims-auto { background: rgba(46, 124, 90, 0.07); }
.dims-auto__title {
  font-weight: 500;
  font-size: 0.78rem;
}
.dims-proportions { font-size: 0.78rem; }
.dim-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.dim-row .dim-input {
  flex: 1 1 90px;
  min-width: 90px;
  font-size: 0.85rem;
}
.dims-custom-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.dims-savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.2rem;
}
.dims-status { font-size: 0.78rem; }
.dims-status[data-kind="ok"]   { color: #2e7c5a; }
.dims-status[data-kind="warn"] { color: #b34a3a; }
