/* Cykelbutikken – mersalgsvælger (cb-mersalg) v1.0.0
   Farver fra cb-produktside (--cb-cream/--cb-sand/--cb-sand-2/--cb-ink/--cb-orange/--cb-yellow). Fallbacks hvis variablerne mangler. */
body.single-product .cb-mersalg {
  --m-cream: var(--cb-cream, #F6EFE4); --m-sand: var(--cb-sand, #EBDDC7); --m-sand-2: var(--cb-sand-2, #E2D0B4);
  --m-ink: var(--cb-ink, #1E1B19); --m-ink-2: var(--cb-ink-2, #4A403B); --m-orange-d: var(--cb-orange-d, #C2380F);
  flex: 0 0 100%; width: 100%; box-sizing: border-box;
  background: var(--m-sand); border-radius: 18px; padding: 18px 18px 14px; margin: 4px 0 16px;
  color: var(--m-ink-2); font-size: 15px; line-height: 1.35;
  container-type: inline-size; container-name: cbmersalg;
}
body.single-product .cb-mersalg *, body.single-product .cb-mersalg *::before, body.single-product .cb-mersalg *::after { box-sizing: border-box; }

/* overskrift */
body.single-product .cb-mersalg__hoved { margin: 0 0 12px; }
body.single-product .cb-mersalg__titel {
  margin: 0 !important; padding: 0; font-family: var(--cb-display, inherit); font-weight: 800; font-size: 18px; line-height: 1.2;
  color: var(--m-ink); letter-spacing: 0; text-transform: none;
}
body.single-product .cb-mersalg__undertekst { margin: 3px 0 0 !important; font-size: 13px; color: var(--m-ink-2); opacity: .85; }

/* liste */
body.single-product .cb-mersalg__liste { list-style: none !important; margin: 0 !important; padding: 0 !important; display: grid; gap: 8px; }
body.single-product .cb-mersalg__raekke {
  margin: 0 !important; display: grid; align-items: center; gap: 4px 12px;
  grid-template-columns: 24px 84px minmax(0, 1fr) auto;
  grid-template-areas: "cb img info pris";
  background: var(--m-cream); border: 2px solid transparent; border-radius: 14px; padding: 8px 12px 8px 10px;
  cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
body.single-product .cb-mersalg__raekke:hover { border-color: var(--m-ink); }
body.single-product .cb-mersalg__raekke.er-valgt { border-color: var(--m-ink); background: #fff; }
body.single-product .cb-mersalg__raekke.er-udsolgt { cursor: default; opacity: .55; }
body.single-product .cb-mersalg__raekke.er-udsolgt:hover { border-color: transparent; }
body.single-product .cb-mersalg__raekke.er-skjult { display: none !important; }

/* flueben */
body.single-product .cb-mersalg__vaelg { grid-area: cb; display: flex; align-items: center; justify-content: center; }
body.single-product .cb-mersalg__cb {
  -webkit-appearance: none; appearance: none; margin: 0 !important; flex: 0 0 auto;
  width: 22px; height: 22px; border: 2px solid var(--m-ink-2); border-radius: 6px; background: #fff; cursor: pointer;
  display: grid; place-content: center; transition: background-color .15s ease, border-color .15s ease;
}
body.single-product .cb-mersalg__cb::after {
  content: ""; width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px;
  transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .12s ease;
}
body.single-product .cb-mersalg__cb:checked { background: var(--m-ink); border-color: var(--m-ink); }
body.single-product .cb-mersalg__cb:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
body.single-product .cb-mersalg__cb:focus-visible { outline: 3px solid rgba(30,27,25,.25); outline-offset: 2px; }
body.single-product .cb-mersalg__cb:disabled { cursor: not-allowed; background: var(--m-sand-2); }

/* billede */
body.single-product .cb-mersalg__billede {
  grid-area: img; display: block; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: #fff; border: 0 !important;
}
body.single-product .cb-mersalg__billede img { width: 84px !important; height: 84px !important; object-fit: contain; display: block; margin: 0 !important; border-radius: 0; }

/* tekst */
body.single-product .cb-mersalg__info { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
body.single-product .cb-mersalg__navn {
  display: block; margin: 0 !important; font-weight: 600; font-size: 14px; line-height: 1.25; color: var(--m-ink);
  cursor: pointer; word-break: break-word;
}
body.single-product .cb-mersalg__lager { font-size: 12px; color: var(--m-ink-2); opacity: .8; }
body.single-product .cb-mersalg__variant {
  margin-top: 4px; max-width: 100%; height: 34px; padding: 4px 28px 4px 10px !important; font-size: 13px;
  border: 1px solid var(--m-sand-2) !important; border-radius: 8px !important; background-color: #fff; color: var(--m-ink); box-shadow: none !important;
}

/* pris + antal */
body.single-product .cb-mersalg__pris { grid-area: pris; display: flex; align-items: center; gap: 8px; justify-content: flex-end; white-space: nowrap; }
body.single-product .cb-mersalg__belob { font-size: 14px; font-weight: 700; color: var(--m-ink); }
body.single-product .cb-mersalg__belob del { font-weight: 500; opacity: .6; margin-right: 4px; font-size: 12px; }
body.single-product .cb-mersalg__belob ins { text-decoration: none; background: none; }
body.single-product .cb-mersalg__belob .woocommerce-Price-amount { font-weight: 700 !important; }
body.single-product .cb-mersalg__antal {
  width: 48px !important; min-width: 0 !important; height: 34px; padding: 4px 4px 4px 8px !important; margin: 0 !important;
  border: 1px solid var(--m-sand-2) !important; border-radius: 8px !important; background: #fff !important; color: var(--m-ink);
  font-size: 14px; text-align: center; box-shadow: none !important;
}
body.single-product .cb-mersalg__raekke:not(.er-valgt) .cb-mersalg__antal { opacity: .45; }

/* se flere: fuld bredde under listen, så den ikke overses */
body.single-product .cb-mersalg__flere {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 10px 0 0; padding: 12px 16px !important; line-height: 1.2;
  background: #fff !important; color: var(--m-ink) !important; border: 2px dashed var(--m-sand-2) !important; border-radius: 14px !important;
  font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: none !important;
  text-transform: none !important; letter-spacing: 0 !important; font-family: inherit; transition: border-color .15s ease;
}
body.single-product .cb-mersalg__flere:hover, body.single-product .cb-mersalg__flere:focus-visible { border-color: var(--m-ink) !important; border-style: solid !important; }
body.single-product .cb-mersalg__flere::after { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
body.single-product .cb-mersalg__flere.er-aaben::after { transform: translateY(2px) rotate(-135deg); }
/* sidste synlige række tones let ud, når listen er foldet sammen */
body.single-product .cb-mersalg__liste.er-foldet .cb-mersalg__raekke.er-sidste-synlige { -webkit-mask-image: linear-gradient(#000 45%, rgba(0,0,0,.35)); mask-image: linear-gradient(#000 45%, rgba(0,0,0,.35)); }

/* i alt */
body.single-product .cb-mersalg__ialt {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 12px; padding: 12px 2px 0; border-top: 1px solid var(--m-sand-2);
}
body.single-product .cb-mersalg__ialt-tekst { font-weight: 600; color: var(--m-ink); }
body.single-product .cb-mersalg__ialt-belob { font-family: var(--cb-display, inherit); font-weight: 800; font-size: 22px; color: var(--m-ink); }
body.single-product .cb-mersalg__fejl { margin: 8px 0 0 !important; font-size: 13px; font-weight: 600; color: var(--m-orange-d); }

/* variabel cykel: Woo lægger boksen inde i .woocommerce-variation-add-to-cart (flex) -> fuld række */
body.single-product form.cart .woocommerce-variation-add-to-cart { flex-wrap: wrap; }

/* smal boks (fx produktsidens højre kolonne på mindre skærme): pris + antal under navnet */
@container cbmersalg (max-width: 480px) {
  .cb-mersalg__raekke {
    grid-template-columns: 22px 72px minmax(0, 1fr) !important;
    grid-template-areas: "cb img info" "cb img pris" !important;
    gap: 2px 10px !important; padding: 8px 10px !important;
  }
  .cb-mersalg__billede, .cb-mersalg__billede img { width: 72px !important; height: 72px !important; }
  .cb-mersalg__pris { justify-content: space-between !important; }
}

/* mobil */
@media (max-width: 600px) {
  body.single-product .cb-mersalg { padding: 14px 12px 12px; border-radius: 16px; }
  body.single-product .cb-mersalg__titel { font-size: 17px; }
  body.single-product .cb-mersalg__raekke {
    grid-template-columns: 22px 72px minmax(0, 1fr);
    grid-template-areas: "cb img info" "cb img pris";
    gap: 2px 10px; padding: 8px 10px;
  }
  body.single-product .cb-mersalg__billede, body.single-product .cb-mersalg__billede img { width: 72px !important; height: 72px !important; }
  body.single-product .cb-mersalg__pris { justify-content: space-between; }
  body.single-product .cb-mersalg__ialt-belob { font-size: 20px; }
}

/* skjult antal (lager 1 / sælges enkeltvis): Woo-wrapperen tegnede en 2 px streg foran knappen */
body.single-product form.cart .quantity:has(> input[type="hidden"]) { display: none !important; }
