/* ==========================================================================
   WP Careplan bestillingsside — implementering af Dittes designoplæg
   BEM-blok "wpo". Brandfarver via sitets ACSS-tokens (--primary/--accent/
   --base/--neutral/--body-bg-color); kun reelt lokale værdier som --_*.
   ========================================================================== */

.wpo {
  --_card: #FFFDF8;
  --_paper-deep: #F0EBE0;
  --_sage: #E3EADF;
  --_line: rgba(24, 42, 34, 0.14);
  --_panel-text: #F4F1E8;
  --_error: #B0492F;
  --_error-soft: #F9E9E4;
  --_shadow-sm: 0 2px 6px rgba(17, 38, 30, 0.05), 0 14px 30px -16px rgba(17, 38, 30, 0.16);
  --_font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

.wpo__grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: start;
  padding: clamp(2.2rem, 4.5vh, 3.2rem) 0 clamp(3rem, 6vh, 4.5rem);
}

.wpo-aside { position: sticky; top: 5.5rem; }

/* ---------- Formular-kort ---------- */

.wpo-form {
  background: var(--_card);
  border: 1px solid var(--_line);
  border-radius: 24px;
  box-shadow: var(--_shadow-sm);
  padding: clamp(1.6rem, 3.5vw, 2.6rem);
  min-width: 0;
}

/* Honeypot: !important så feltspecifikke input-regler (width:100%) ikke kan
   give feltet bredde og dermed horisontal scroll på små viewports. */
.wpo-alt {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wpo-formerror {
  margin: 0 0 1.4rem;
  padding: 0.9rem 1.1rem;
  background: var(--_error-soft);
  border: 1px solid var(--_error);
  border-radius: 12px;
  color: var(--_error);
  font-size: 0.92rem;
  font-weight: 600;
}

.wpo-fgroup { border: none; margin: 0; padding: 0; min-width: 0; min-inline-size: 0; }
.wpo-fgroup + .wpo-fgroup { margin-top: 2.2rem; padding-top: 2.2rem; border-top: 1px solid var(--_line); }

.wpo-fgroup legend {
  font-family: var(--_font-display);
  font-weight: 520;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  padding: 0;
  margin-bottom: 0.35rem;
  color: var(--base);
}

.wpo-fhint { margin: 0 0 1.3rem; font-size: 0.92rem; color: var(--neutral); }

/* ---------- Produktvalg (radio-kort) ---------- */

.wpo-choice { display: grid; gap: 0.8rem; }

.wpo-choice label {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--body-bg-color);
  border: 1.5px solid var(--_line);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.wpo-choice label:hover { border-color: color-mix(in srgb, var(--primary) 45%, transparent); }

.wpo-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.wpo-radio {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(24, 42, 34, 0.35);
  background: var(--_card);
  display: grid;
  place-items: center;
  transition: border-color 160ms ease;
}

.wpo-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  transform: scale(0);
  transition: transform 160ms ease;
}

.wpo-choice label:has(> input:checked) {
  border-color: var(--primary);
  background: var(--_sage);
  box-shadow: 0 0 0 1px var(--primary);
}

.wpo-choice label:has(> input:checked) .wpo-radio { border-color: var(--primary); }
.wpo-choice label:has(> input:checked) .wpo-radio::after { transform: scale(1); }
.wpo-choice label:has(> input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 3px; }

.wpo-cbody { flex: 1; min-width: 0; }
.wpo-cname { display: block; font-weight: 600; font-size: 1.02rem; color: var(--base); }
.wpo-cdesc { display: block; font-size: 0.88rem; color: var(--neutral); margin-top: 2px; }
.wpo-cprice { flex: none; text-align: right; }
.wpo-cprice strong { display: block; font-family: var(--_font-display); font-weight: 560; font-size: 1.25rem; color: var(--base); }
.wpo-cprice span { display: block; font-size: 0.78rem; color: var(--neutral); margin-top: 1px; }

.wpo-badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.wpo-servicenote {
  display: none;
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--_paper-deep);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--base);
}

.wpo-fgroup:has(#wpo-prod-servicekort:checked) .wpo-servicenote { display: block; }

/* ---------- Betalingsperiode (segmentkontrol) ---------- */

.wpo-segment { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.wpo-segment label { position: relative; }
.wpo-segment input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.wpo-seg {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.55rem 1.2rem;
  border: 1.5px solid var(--_line);
  border-radius: 999px;
  background: var(--body-bg-color);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--base);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.wpo-segment label:hover .wpo-seg { border-color: color-mix(in srgb, var(--primary) 45%, transparent); }

.wpo-segment label:has(> input:checked) .wpo-seg {
  border-color: var(--primary);
  background: var(--_sage);
  box-shadow: 0 0 0 1px var(--primary);
}

.wpo-segment label:has(> input:focus-visible) .wpo-seg { outline: 3px solid var(--primary); outline-offset: 3px; }

.wpo-save {
  font-size: 0.72rem;
  font-weight: 700;
  color: #241A08;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}

/* ---------- Felter ---------- */

.wpo-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.2rem; }
.wpo-field--full { grid-column: 1 / -1; }
.wpo-field { min-width: 0; }

.wpo-flabel { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.4rem; color: var(--base); }
.wpo-req { color: var(--primary); }
.wpo-opt { font-weight: 500; font-size: 0.82rem; color: var(--neutral); }

.wpo-form input[type="text"],
.wpo-form input[type="email"],
.wpo-form input[type="url"],
.wpo-form input[type="tel"],
.wpo-form select,
.wpo-form textarea {
  width: 100%;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  color: var(--base);
  background: var(--body-bg-color);
  border: 1.5px solid var(--_line);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  min-height: 50px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.wpo-form textarea { resize: vertical; min-height: 110px; line-height: 1.55; }

.wpo-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B4A3E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
  padding-right: 2.8rem;
}

.wpo-form input::placeholder,
.wpo-form textarea::placeholder { color: color-mix(in srgb, var(--neutral) 55%, transparent); }

.wpo-form input:hover,
.wpo-form select:hover,
.wpo-form textarea:hover { border-color: color-mix(in srgb, var(--primary) 40%, transparent); }

.wpo-form input:focus,
.wpo-form select:focus,
.wpo-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--_card);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--primary) 14%, transparent);
}

.wpo-fhelp { margin: 0.4rem 0 0; font-size: 0.85rem; line-height: 1.5; color: var(--neutral); }

/* Fejltilstand */

.wpo-field--error input,
.wpo-field--error select,
.wpo-field--error textarea { border-color: var(--_error); background: var(--_error-soft); }

.wpo-field--error input:focus { box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--_error) 16%, transparent); }

.wpo-ferror {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--_error);
}

.wpo-ferror svg { width: 15px; height: 15px; flex: none; }

/* ---------- Afsendelse ---------- */

.wpo-submit { margin-top: 2.2rem; padding-top: 2.2rem; border-top: 1px solid var(--_line); }

.wpo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 2.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1.05rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #241A08;
  box-shadow: 0 10px 24px -12px rgba(217, 143, 40, 0.55);
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.wpo-btn:hover {
  background: color-mix(in srgb, var(--accent) 88%, black);
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -14px rgba(217, 143, 40, 0.6);
}

.wpo-btn:active { transform: translateY(0); }

.wpo-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

.wpo-submitnote {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 1rem 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--neutral);
}

.wpo-submitnote svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--primary); }

/* ---------- Sidebar ---------- */

.wpo-card {
  background: var(--_card);
  border: 1px solid var(--_line);
  border-radius: 20px;
  padding: 1.6rem 1.7rem;
}

.wpo-card + .wpo-card { margin-top: 1.2rem; }

.wpo-card h2 {
  font-family: var(--_font-display);
  font-weight: 520;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
  color: var(--base);
}

.wpo-steps { list-style: none; margin: 0; padding: 0; }
.wpo-steps li { display: flex; gap: 0.9rem; padding: 0.55rem 0; }
.wpo-steps li + li { border-top: 1px solid var(--_line); }

.wpo-stepnr {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--_panel-text);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  margin-top: 2px;
}

.wpo-steps strong { display: block; font-size: 0.97rem; font-weight: 600; color: var(--base); }
.wpo-steps li > div > span { display: block; font-size: 0.88rem; line-height: 1.5; color: var(--neutral); margin-top: 1px; }

.wpo-prices { list-style: none; margin: 0; padding: 0; font-size: 0.94rem; }
.wpo-prices li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; }
.wpo-prices li + li { border-top: 1px solid var(--_line); }
.wpo-pname { font-weight: 600; color: var(--base); }
.wpo-psub { display: block; font-size: 0.8rem; font-weight: 400; color: var(--neutral); }
.wpo-pprice { text-align: right; font-weight: 600; white-space: nowrap; color: var(--base); }
.wpo-pprice span { display: block; font-size: 0.78rem; font-weight: 400; color: var(--neutral); }
.wpo-pricenote { margin: 0.8rem 0 0; font-size: 0.82rem; color: var(--neutral); }

.wpo-card--sage { background: var(--_sage); border-color: color-mix(in srgb, var(--primary) 18%, transparent); }
.wpo-card--sage p { margin: 0; font-size: 0.9rem; line-height: 1.6; color: var(--base); }
.wpo-card--sage p + p { margin-top: 0.7rem; }

/* ---------- Succes ---------- */

.wpo-success {
  max-width: 640px;
  margin: clamp(2.5rem, 6vh, 4rem) auto clamp(3rem, 7vh, 5rem);
  background: var(--_sage);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 24px;
  padding: clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.wpo-success__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 1.2rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--_panel-text);
}

.wpo-success__icon svg { width: 26px; height: 26px; }

.wpo-success h2 {
  font-family: var(--_font-display);
  font-weight: 520;
  font-size: 1.7rem;
  margin: 0;
  color: var(--base);
}

.wpo-success p { margin: 1rem 0 0; color: var(--base); }
.wpo-success__sub { font-size: 0.9rem; color: var(--neutral); }
.wpo-success a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsiv ---------- */

@media (max-width: 960px) {
  .wpo__grid { grid-template-columns: 1fr; }
  .wpo-aside { position: static; }
}

@media (max-width: 560px) {
  .wpo-fields { grid-template-columns: 1fr; }

  .wpo-choice label { flex-wrap: wrap; }
  .wpo-cprice {
    flex-basis: 100%;
    text-align: left;
    padding-left: calc(22px + 1rem);
    margin-top: 0.3rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
  }
  .wpo-cprice strong { font-size: 1.15rem; }
  .wpo-cprice span { margin-top: 0; }

  .wpo-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .wpo *, .wpo *::before, .wpo *::after { animation: none !important; transition: none !important; }
}
