/* Iron Door Visualizer — customer page styles.
   Brand colors and font come from the admin page; they fill in the variables below. */
:root {
  --brand: #111111;
  --accent: #b08d57;
  --logo-bg: #111111;
  --font: Georgia, "Times New Roman", serif;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #e4e2dd;
  --bg: #f6f4f0;
  --card: #ffffff;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}
body.embedded { background: transparent; }
h1, h2, h3 { font-family: var(--font); font-weight: 600; margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--brand); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
body.embedded .topbar { position: static; border-radius: var(--radius) var(--radius) 0 0; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.logo-wrap { background: var(--logo-bg); border-radius: 8px; padding: 4px 6px; display: inline-flex; }
.logo-wrap:empty { display: none; }
#logo { height: 38px; width: auto; max-width: 160px; object-fit: contain; }
.brand-name { font-family: var(--font); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone { color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; border: 1px solid var(--accent); padding: 6px 12px; border-radius: 999px; font-size: .9rem; }

.wrap { max-width: 980px; margin: 0 auto; padding: 16px 14px 40px; }
.hero { text-align: center; padding: 14px 0 6px; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); color: var(--brand); }
.hero p { color: var(--muted); margin: 6px 0 0; }
.fullpage-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: .9rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-head h2 { font-size: 1.2rem; }
.num { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; }

.dropzone { display: block; position: relative; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; overflow: hidden; min-height: 170px; background: #faf9f7; }
.dropzone.dragover { border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--muted); }
.dz-empty strong { color: var(--text); font-size: 1.05rem; }
.dz-icon { font-size: 2.2rem; }
#photoPreview { width: 100%; max-height: 420px; object-fit: contain; background: #111; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.filters label, .glass-row label, form label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
select, input, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font-size: 16px; /* 16px stops iPhone zooming in */ }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.door-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.door { border: 2px solid var(--line); border-radius: 12px; padding: 0; background: #fff; text-align: left; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.door:hover { transform: translateY(-1px); }
.door.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.door .thumb { aspect-ratio: 3 / 4; background: #f1efeb; display: grid; place-items: center; }
.door .thumb img { width: 100%; height: 100%; object-fit: contain; }
.door .info { padding: 8px 10px 10px; }
.door .name { font-weight: 700; font-size: .95rem; }
.door .meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.door .price { color: var(--brand); font-weight: 700; font-size: .85rem; margin-top: 4px; }
.empty { color: var(--muted); text-align: center; }
.glass-row { margin-top: 14px; max-width: 320px; }

.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 11px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { width: 100%; padding: 15px 18px; font-size: 1.05rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 8px 0; font-weight: 600; }
.hint { color: var(--muted); font-size: .88rem; margin: 8px 0 0; text-align: center; }
.error { color: #b3261e; background: #fdecea; border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; }

.loading { text-align: center; padding: 24px 0 8px; color: var(--muted); }
.loading p { color: var(--text); font-weight: 600; margin: 12px 0 2px; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result { margin-top: 14px; }
.ba { position: relative; border-radius: 12px; overflow: hidden; background: #111; user-select: none; }
.ba > img { width: 100%; }
.ba-before { position: absolute; inset: 0; pointer-events: none; }
.ba-before img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; background: #fff; pointer-events: none; transform: translateX(-1px); box-shadow: 0 0 4px rgba(0,0,0,.4); }
.ba-line::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-size: 1rem; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.ba input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; padding: 0; border: 0; }
.ba-tag { position: absolute; top: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; padding: 3px 8px; border-radius: 999px; pointer-events: none; }
.ba-tag.left { left: 8px; } .ba-tag.right { right: 8px; }
.result-caption { text-align: center; color: var(--muted); font-size: .9rem; margin: 8px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.design { position: relative; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: #fff; padding: 0; text-align: left; }
.design.selected { border-color: var(--accent); }
.design img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.design span { display: block; font-size: .75rem; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.design .tick { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; display: none; place-items: center; padding: 0; }
.design.selected .tick { display: grid; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.compare figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.compare figcaption { padding: 6px 10px; font-size: .85rem; font-weight: 600; }

.quote-designs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.quote-designs .qd { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 6px 6px; font-size: .85rem; }
.quote-designs img { width: 54px; height: 40px; object-fit: cover; border-radius: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 10px; }
form textarea { resize: vertical; }
form .btn.big { margin-top: 12px; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.success { text-align: center; padding: 16px 0; }
.success .check { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.8rem; display: grid; place-items: center; margin: 0 auto 10px; }
.disclaimer { color: var(--muted); font-size: .78rem; text-align: center; margin-top: 18px; }

@media (max-width: 520px) {
  .wrap { padding: 10px 10px 30px; }
  .card { padding: 14px 12px; }
  .door-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .brand-name { display: none; }
  .actions .btn { flex: 1 1 auto; }
}

/* "Box your door" step */
.marker { margin-top: 4px; }
.mark-help { margin: 0 0 10px; font-size: .92rem; color: var(--text); background: #faf6ee; border-left: 4px solid var(--accent); padding: 8px 10px; border-radius: 6px; }
.mark-stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; border-radius: 12px; overflow: hidden; background: #111; }
.mark-stage img { width: 100%; display: block; pointer-events: none; }
.mark-box { position: absolute; border: 3px solid #e53935; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); border-radius: 2px; pointer-events: none; }
.mark-box::after { content: "Your door"; position: absolute; top: -26px; left: -3px; background: #e53935; color: #fff; font-size: .75rem; font-weight: 700; padding: 3px 7px; border-radius: 4px 4px 0 0; white-space: nowrap; }

/* Product type picker (entry doors / garage doors / windows) */
.type-q { font-size: 1.1rem; margin: 0 0 10px; }
.type-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.type-tab { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 10px; cursor: pointer; font: inherit; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 4px; color: inherit; }
.type-tab .ico { font-size: 1.6rem; line-height: 1; }
.type-tab.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.door-grid.wide .door .thumb { aspect-ratio: 4 / 3; }

/* Add to home screen */
.install-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 9px 18px; border-radius: 999px; border: 1.5px solid var(--accent); background: transparent; color: var(--brand); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; }
.install-btn:hover { background: var(--accent); color: #fff; }
.install-btn[hidden], .install-help[hidden] { display: none; }
.install-help { max-width: 420px; margin: 12px auto 0; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; font-size: .95rem; }
.install-help p { margin: 0 0 6px; color: var(--text); }
.install-help ol { margin: 0 0 10px; padding-left: 20px; }
.install-help li { margin-bottom: 4px; }
.install-close { border: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 7px 16px; font: inherit; font-weight: 600; cursor: pointer; }
