/* Huisstijl van mastertools.nl: blauw #1F4898, groen #0BAA06 (In winkelwagen), Lexend voor knoppen/koppen, Inter voor tekst. */
:root {
  --blue: #1f4898;
  --green: #0baa06;
  --green-text: #e9ffe6;
  --text: #111;
  --muted: #5b6270;
  --line: #e3e6ec;
  --bg: #f4f5f7;
  --card: #fff;
  --warn-bg: #fff6e0;
  --warn: #8a5a00;
  --top: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

.top {
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
}
.top .brand { color: #fff; text-decoration: none; font-family: Lexend, Inter, sans-serif; font-weight: 500; font-size: 14px; }
.top .brand:hover { text-decoration: underline; }
.top .title { font-family: Lexend, Inter, sans-serif; font-weight: 700; margin-left: auto; }

main { position: relative; height: calc(100% - var(--top)); }
body.embedded .top { display: none; }
body.embedded main { height: 100%; }

/* Eigen maat in plaats van packout.css (die zet ook lettergrootte en achtergrond van de hele pagina). */
#builder.packout { position: absolute; inset: 0; width: 100%; height: 100%; }
#builder.packout iframe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border: 0; }

#status {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  max-width: min(520px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: 6px;
  background: var(--card);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
  text-align: center;
  z-index: 2;
}
#status[data-kind="error"] { background: var(--warn-bg); color: var(--warn); }

/* ---------- Overzicht ---------- */
#overview {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 17, 17, .45);
}
#overview[hidden] { display: none; }
.card {
  width: 100%;
  max-width: 760px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
  overflow: hidden;
}
.card header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card h2 { margin: 0; font-family: Lexend, Inter, sans-serif; font-size: 20px; color: var(--blue); }
.link {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
}
.link:hover { text-decoration: underline; }

.lines { list-style: none; margin: 0; padding: 0 20px; overflow: auto; }
.line {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.line img, .line .noimg { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 4px; }
.line .noimg { background: var(--bg); }
.info { min-width: 0; display: flex; flex-direction: column; }
.info a { color: var(--text); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.info a:hover { color: var(--blue); text-decoration: underline; }
.meta { color: var(--muted); font-size: 13px; }
.meta .ok { color: var(--green); font-weight: 600; }
.meta .wait { color: var(--warn); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 4px; }
.qty button {
  width: 34px;
  height: 34px;
  border: 0;
  background: #fff;
  color: var(--blue);
  font-size: 18px;
  cursor: pointer;
}
.qty button:disabled { color: #b8bdc7; cursor: default; }
.qty span { min-width: 28px; text-align: center; font-weight: 600; }

.price { text-align: right; display: flex; flex-direction: column; white-space: nowrap; }
.price strong { color: var(--blue); font-family: Lexend, Inter, sans-serif; }
.price span { color: var(--muted); font-size: 12px; }

.missing, .empty { margin: 12px 20px 0; padding: 10px 12px; border-radius: 4px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.empty { background: var(--bg); color: var(--muted); }

.card footer { padding: 16px 20px 18px; border-top: 1px solid var(--line); margin-top: 12px; }
.total { display: grid; grid-template-columns: 1fr auto; row-gap: 2px; margin-bottom: 12px; }
.total strong { font-family: Lexend, Inter, sans-serif; font-size: 20px; color: var(--blue); }
.total small { font-size: 12px; font-weight: 400; color: var(--muted); }
.total .incl { grid-column: 2; text-align: right; color: var(--muted); font-size: 13px; }
.primary {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 4px;
  background: var(--green);
  color: var(--green-text);
  font-family: Lexend, Inter, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.primary:hover { filter: brightness(.95); }
.primary:disabled { background: #b8bdc7; color: #fff; cursor: default; }
.note { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 600px) {
  .top { gap: 8px; }
  .top .brand, .top .title { font-size: 13px; white-space: nowrap; }
  #overview { padding: 0; align-items: stretch; }
  .card { max-width: none; border-radius: 0; }
  .lines { padding: 0 16px; }
  .line { grid-template-columns: 48px 1fr auto; grid-template-areas: "img info info" "img qty price"; }
  .line img, .line .noimg { grid-area: img; width: 48px; height: 48px; align-self: start; }
  .info { grid-area: info; }
  .qty { grid-area: qty; justify-self: start; }
  .price { grid-area: price; }
  .card header, .card footer { padding-left: 16px; padding-right: 16px; }
  .missing, .empty { margin-left: 16px; margin-right: 16px; }
}
