/* Configurator styles. Everything is scoped under .hm-app so the engine can live inside any page/theme. */
.hm-app {
  --bg: #f3f2ee;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6b66;
  --line: #e2e0d8;
  --accent: #1d1d1b;
  --accent-ink: #ffffff;
  --radius: 10px;
  display: block;
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  box-sizing: border-box;
}
.hm-app *, .hm-app *::before, .hm-app *::after { box-sizing: border-box; }
.hm-app [hidden] { display: none !important; }
.hm-app button, .hm-app input, .hm-app select { font: inherit; color: inherit; }

.hm-app .topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.hm-shop .topbar { position: static; }
.hm-app .brand { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.hm-app .brand span { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 13px; }
.hm-app .brand .shop-title { font-weight: 700; color: var(--ink); margin: 0; font-size: 16px; }
.hm-app .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.hm-app button {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; transition: background .15s, transform .05s; line-height: 1.3;
}
.hm-app button:hover { background: #f6f5f1; }
.hm-app button:active { transform: translateY(1px); }
.hm-app button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.hm-app button.primary:hover { background: #333; }
.hm-app button.danger { color: #a12b2b; }
.hm-app button:disabled { opacity: .55; cursor: wait; }

.hm-app .layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px;
  padding: 20px; max-width: 1500px; margin: 0 auto;
}
/* minmax(0, …): a plain 1fr track has a min-content floor, so on phones the preview (vh-based width + padding)
   pushed the column wider than the screen and the poster was cut off on the right */
@media (max-width: 960px) { .hm-app .layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .hm-app .layout { padding: 12px; } .hm-app .preview-wrap { padding: 14px; } }

.hm-app .preview-col { position: sticky; top: 64px; align-self: start; min-width: 0; }
.hm-shop .preview-col { top: 16px; }
@media (max-width: 960px) { .hm-app .preview-col { position: static; } }
.hm-app .preview-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 24px; background: #e9e7e1; border-radius: var(--radius); min-height: 300px;
}
.hm-app .preview {
  width: min(100%, calc((100vh - 170px) * var(--ar, 0.707)));
  max-width: 100%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.hm-app .preview-wrap.mockup .preview {
  outline: 10px solid #111; outline-offset: 0;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.45), 0 8px 16px rgba(0,0,0,.2);
}
.hm-app .preview-wrap.mockup .preview.with-slug { outline: none; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.hm-app .preview svg { display: block; width: 100%; height: auto; }
.hm-app .preview-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; color: var(--muted); font-size: 12.5px; }
.hm-app .status.error { color: #a12b2b; }
.hm-app .shop-actions { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }

.hm-app .panel { display: flex; flex-direction: column; gap: 10px; }
.hm-app details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.hm-app summary { cursor: pointer; padding: 11px 14px; font-weight: 600; list-style: none; user-select: none; }
.hm-app summary::-webkit-details-marker { display: none; }
.hm-app summary::after { content: '+'; float: right; color: var(--muted); }
.hm-app details[open] summary::after { content: '–'; }
.hm-app .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); }

.hm-app label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #333; margin: 0; }
.hm-app label small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.hm-app label.chk { flex-direction: row; align-items: center; gap: 8px; }
.hm-app label.chk input { width: auto; margin: 0; }
.hm-app input[type="text"], .hm-app input[type="number"], .hm-app input[type="date"], .hm-app input[type="time"], .hm-app select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; width: 100%; min-height: 0; line-height: 1.3; margin: 0;
}
.hm-app input[type="range"] { width: 100%; margin: 0; }
.hm-app textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; width: 100%; font: inherit; resize: vertical; margin: 0; }
.hm-app output { font-size: 12px; color: var(--muted); }
.hm-app input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.hm-app .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hm-app .grid3 { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 8px; }
.hm-app .row { display: flex; gap: 6px; align-items: center; }
.hm-app .row.wrap { flex-wrap: wrap; }
.hm-app .row input { flex: 1; }
.hm-app .colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hm-app .colors label { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; }
.hm-app .hint { margin: 0; font-size: 12px; color: var(--muted); }

.hm-app .line-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fafaf7; }
.hm-app .line-card.off { opacity: .55; }
.hm-app .line-head { display: flex; justify-content: space-between; align-items: center; }
.hm-app .line-tools button { padding: 2px 7px; font-size: 11px; }
.hm-app .line-card select, .hm-app .line-card input[type="number"] { padding: 5px 7px; }

.hm-app label.file { position: relative; display: inline-flex; flex-direction: row; align-items: center; padding: 7px 12px; border: 1px dashed var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.hm-app label.file.btn { border-style: solid; }
.hm-app label.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.hm-app #map { height: 280px; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }

.hm-app .toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1d1d1b; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100000; max-width: 90vw;
}
