/* ══ Maatadvies voor trapleuningen ══════════════════════════════════════
   Knop boven "Kies uw lengte", bewaard advies eronder en de popup.
   Zie inc/maatadvies.php en assets/js/maatadvies.js. */

.lm-ma-btn,
.lm-ma-saved,
.lm-ma-overlay {
  --ma-black: #111111;
  --ma-text: #141414;
  --ma-grey: #5a5a5a;
  --ma-gold: #e6c27a;
  --ma-gold-dk: #c9a35a;
  --ma-gold-txt: #b8954a;
  --ma-gold-bg: #fbf6ea;
  --ma-fill: #f1e3c2;
  --ma-warn: #7a5b18;
  --ma-line: #e4e4e4;
  --ma-line-lt: #eeeeee;
  --ma-subtle: #fafaf8;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  color: var(--ma-text);
}

/* ── Knop boven de dropdown ── */
.lm-ma-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin: 0 0 10px; padding: 12px 14px;
  background: var(--ma-gold-bg); border: 1px solid var(--ma-gold); border-radius: 6px;
  font: inherit; text-align: left; cursor: pointer;
  transition: background 0.15s;
}
.lm-ma-btn:hover { background: #f7eed7; }
.lm-ma-btn:focus-visible { outline: 2px solid var(--ma-black); outline-offset: 2px; }
.lm-ma-btn__icon {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ma-gold); font-weight: 800; font-size: 15px;
}
.lm-ma-btn__text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lm-ma-btn__title { font-size: 14px; font-weight: 700; }
.lm-ma-btn__sub { font-size: 12.5px; color: var(--ma-grey); line-height: 1.35; }
.lm-ma-btn__arrow { font-size: 18px; }

/* Label "Kies uw lengte" op één lijn met de dropdown in plaats van met de knop.
   De afstand zet het script (hoogte van de knop). Mobiel staat het label erboven. */
@media (min-width: 769px) {
  table.variations tr.lm-ma-row th.label,
  table.variations tr.lm-ma-row td.label { margin-top: var(--lm-ma-offset, 68px); }
}

/* ── Bewaard advies onder de dropdown ── */
.lm-ma-saved {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 10px; padding: 14px;
  background: var(--ma-subtle); border: 1px solid #e6e6e6; border-radius: 6px;
}
.lm-ma-saved[hidden] { display: none; }
.lm-ma-saved__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.lm-ma-saved__head > span:first-child { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: #6a6a6a; }
.lm-ma-saved__actions { display: inline-flex; align-items: center; gap: 12px; font-size: 12.5px; }
.lm-ma-saved__row { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.lm-ma-saved__add {
  padding: 11px 12px; border: 0; border-radius: 4px;
  background: var(--ma-black); color: #fff;
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: 0.4px; cursor: pointer;
}
.lm-ma-saved__add:hover { background: #333; }

.lm-ma-link {
  padding: 0; border: 0; background: none;
  font: inherit; font-size: 12.5px; color: inherit; text-decoration: underline; cursor: pointer;
}
.lm-ma-error { margin: 0; font-size: 12.5px; color: var(--ma-warn); }
.lm-ma-error:empty { display: none; }
.lm-ma-overlay [aria-disabled="true"],
.lm-ma-saved [aria-disabled="true"] { opacity: 0.35; cursor: default; }

/* ── Popup ── */
html.lm-ma-lock, html.lm-ma-lock body { overflow: hidden; }

.lm-ma-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(17, 17, 17, 0.55);
}
.lm-ma-overlay[hidden] { display: none; }
.lm-ma-overlay *, .lm-ma-overlay *::before, .lm-ma-overlay *::after { box-sizing: border-box; }

.lm-ma-modal {
  width: 100%; max-width: 620px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: auto;
  background: #fff; border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

.lm-ma-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 24px 14px; background: #fff; border-bottom: 1px solid var(--ma-line-lt);
}
.lm-ma-head__row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lm-ma-head__text { display: flex; flex-direction: column; gap: 4px; }
.lm-ma-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; color: var(--ma-gold-txt); }
.lm-ma-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.25; color: var(--ma-text); }
.lm-ma-close {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--ma-line); background: #fff; color: var(--ma-text);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.lm-ma-close:hover { border-color: var(--ma-text); }
.lm-ma-progress { height: 4px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.lm-ma-progress__bar { height: 100%; width: 0; background: var(--ma-gold); transition: width 0.3s; }

.lm-ma-body { display: flex; flex-direction: column; gap: 16px; padding: 20px 24px; }
.lm-ma-intro { margin: 0; font-size: 15px; line-height: 1.5; color: #4a4a4a; }

.lm-ma-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 24px 18px; background: #fff; border-top: 1px solid var(--ma-line-lt);
}
.lm-ma-foot .lm-ma-error { flex: 1 0 100%; }
.lm-ma-back {
  padding: 13px 18px; border: 1px solid #ddd; border-radius: 4px; background: #fff;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ma-text); cursor: pointer;
}
.lm-ma-back:hover { border-color: var(--ma-text); }
.lm-ma-next {
  padding: 14px 26px; border: 0; border-radius: 4px; background: var(--ma-black); color: #fff;
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0.4px; cursor: pointer;
}
.lm-ma-add {
  flex: 1; min-width: 240px; padding: 12px 16px; border: 0; border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--ma-black); color: #fff; font: inherit; cursor: pointer;
}
.lm-ma-next:not([aria-disabled="true"]):hover,
.lm-ma-add:not([aria-disabled="true"]):hover { background: #333; }
.lm-ma-add__title { font-size: 14.5px; font-weight: 700; letter-spacing: 0.3px; }
.lm-ma-add__sub { font-size: 12px; color: var(--ma-gold); }

.lm-ma-overlay button:focus-visible,
.lm-ma-overlay input:focus-visible { outline: 2px solid var(--ma-gold-dk); outline-offset: 2px; }

/* Keuzetegels */
.lm-ma-choices { display: grid; gap: 10px; }
.lm-ma-choices--count { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.lm-ma-choices--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.lm-ma-choices--holders { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }

.lm-ma-count,
.lm-ma-card {
  border: 1px solid var(--ma-line); border-radius: 6px; background: #fff;
  font: inherit; color: var(--ma-text); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.lm-ma-count:hover, .lm-ma-card:hover { border-color: var(--ma-gold-dk); }
.lm-ma-count.is-selected,
.lm-ma-card.is-selected { border: 2px solid var(--ma-gold-dk); background: var(--ma-gold-bg); }

.lm-ma-count { height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lm-ma-count__n { font-size: 26px; font-weight: 700; line-height: 1; }
.lm-ma-count__unit { font-size: 11px; font-weight: 500; color: #666; }

.lm-ma-card { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; }
.lm-ma-card__text { display: flex; flex-direction: column; gap: 3px; }
.lm-ma-card__title { font-size: 15px; font-weight: 700; }
.lm-ma-card__sub { font-size: 12.5px; color: var(--ma-grey); line-height: 1.35; }
.lm-ma-card__img {
  flex: 0 0 64px; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--ma-line-lt); border-radius: 4px; background: #fff; overflow: hidden;
}
.lm-ma-card__img img { width: 100%; height: 100%; object-fit: contain; }

.lm-ma-icon { flex: none; }
.lm-ma-icon path { fill: var(--ma-fill); stroke: var(--ma-text); stroke-width: 2; stroke-linejoin: round; }

/* Maten */
.lm-ma-info {
  display: flex; align-items: center; gap: 16px; padding: 14px;
  background: var(--ma-subtle); border: 1px solid var(--ma-line-lt); border-radius: 6px;
}
.lm-ma-info__text { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.45; color: #4a4a4a; }
.lm-ma-info__text strong { font-size: 14px; color: var(--ma-text); }

.lm-ma-seg { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--ma-line-lt); border-radius: 6px; }
.lm-ma-seg__head { display: flex; align-items: flex-start; gap: 10px; }
.lm-ma-seg__head > div { display: flex; flex-direction: column; gap: 2px; }
.lm-ma-seg__num {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ma-text); color: #fff; font-size: 12px; font-weight: 700;
}
.lm-ma-seg__label { font-size: 14.5px; font-weight: 700; }
.lm-ma-seg__hint { font-size: 12.5px; color: var(--ma-grey); line-height: 1.4; }
.lm-ma-input { display: flex; align-items: center; border: 2px solid var(--ma-text); border-radius: 6px; overflow: hidden; }
.lm-ma-input input {
  flex: 1; min-width: 0; height: auto; margin: 0; padding: 12px 14px;
  border: 0; outline: 0; background: #fff; box-shadow: none;
  font: inherit; font-size: 20px; font-weight: 600; color: var(--ma-text);
}
.lm-ma-input input::-webkit-inner-spin-button { opacity: 0.4; }
.lm-ma-overlay .lm-ma-input input:focus-visible { outline: none; }
.lm-ma-input:focus-within { border-color: var(--ma-gold-dk); }
.lm-ma-input span { padding: 0 14px; font-weight: 600; color: #666; }
.lm-ma-seg__calc {
  display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px;
  background: var(--ma-gold-bg); border-radius: 4px; font-size: 13.5px;
}
.lm-ma-seg__calc[hidden] { display: none; }
.lm-ma-seg__calc span:first-child { color: var(--ma-grey); }
.lm-ma-seg__note { margin: 0; font-size: 12.5px; color: var(--ma-warn); }
.lm-ma-seg__note:empty { display: none; }

.lm-ma-stair {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  background: var(--ma-black); color: #fff; border-radius: 6px;
}
/* In de vaste balk onderin: volle breedte boven Terug/Volgende */
.lm-ma-foot .lm-ma-stair { flex: 1 0 100%; padding: 12px 16px; }
.lm-ma-stair__label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: var(--ma-gold); }
.lm-ma-stair__value { font-size: 17px; font-weight: 700; }
.lm-ma-stair__note { font-size: 12px; color: #ccc; }

/* Overzicht */
.lm-ma-sum { display: flex; flex-direction: column; border: 1px solid var(--ma-line-lt); border-radius: 6px; }
.lm-ma-sum__row { display: flex; align-items: center; gap: 14px; padding: 14px; border-bottom: 1px solid #f2f2f2; }
.lm-ma-sum__row .lm-ma-icon path { stroke-width: 2.5; }
.lm-ma-sum__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lm-ma-sum__main strong { font-size: 14.5px; }
.lm-ma-sum__main span, .lm-ma-sum__main .lm-ma-link { font-size: 12.5px; color: #666; }
.lm-ma-sum__side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.lm-ma-sum__side strong { font-size: 15px; white-space: nowrap; }
.lm-ma-sum__side span { font-size: 12.5px; color: #666; white-space: nowrap; }
.lm-ma-sum__error { color: var(--ma-warn); }
.lm-ma-sum__line { display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid #f2f2f2; }
.lm-ma-sum__line span { color: var(--ma-grey); }
.lm-ma-sum__line strong { font-weight: 600; text-align: right; }
.lm-ma-sum__total { display: flex; justify-content: space-between; gap: 8px; padding: 14px; font-size: 16px; font-weight: 700; }
.lm-ma-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: #666; }

/* Mobiel: bottom sheet */
@media (max-width: 679px) {
  .lm-ma-overlay { align-items: flex-end; padding: 0; }
  .lm-ma-modal { max-height: 92vh; border-radius: 14px 14px 0 0; }
  .lm-ma-head { padding: 18px 18px 14px; }
  .lm-ma-title { font-size: 19px; }
  .lm-ma-body { padding: 20px 18px; }
  .lm-ma-foot { padding: 14px 18px max(18px, env(safe-area-inset-bottom)); }
  .lm-ma-add { min-width: 0; }
  .lm-ma-sum__row { flex-wrap: wrap; }
  .lm-ma-sum__side { flex: 1 0 100%; flex-direction: row; justify-content: space-between; align-items: baseline; padding-left: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .lm-ma-progress__bar { transition: none; }
}
