/* Order form — chrome only. The controls themselves come from the theme design
   system in assets/css/components.css (.lm-btn, .lm-field, .lm-select,
   .lm-stepper, .lm-order-summary). The card around the form is provided by the
   shared .lm-order-block__form wrapper, so .lm-order-form stays transparent. */

.lm-order-form {
  /* The card may sit on a dark band (product page): keep the form text legible. */
  color: var(--lm-ink);
}

.lm-order-form-inner {
  display: flex;
  flex-direction: column;
  gap: var(--lm-space-6);
}

/* The shared stepper is an inline control: keep it at its natural width inside
   the field grid instead of stretching across the column. */
.lm-order-form .lm-stepper {
  justify-self: start;
}

/* Delivery modes: no fieldset component, so the plugin frames it locally. */
.lm-order-modes {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
}

.lm-order-modes > legend {
  color: var(--lm-ink);
  font-weight: 600;
}

.lm-order-modes > * + * {
  margin-top: var(--lm-space-2);
}

.lm-order-help,
.lm-order-contact,
.lm-order-note {
  margin: 0;
  color: var(--lm-muted);
  font-size: .9375rem;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Link inside a muted hint: the site's inline-link pattern. */
.lm-order-contact a,
.lm-order-help a {
  color: var(--lm-accent-hover);
  font-weight: 600;
}

.lm-order-contact a:hover,
.lm-order-help a:hover {
  text-decoration-line: underline;
  text-underline-offset: .18em;
}

.lm-order-help[hidden],
.lm-order-contact[hidden],
.lm-order-relay[hidden],
.lm-order-status:empty {
  display: none;
}

/* Delivery options as a hairline list, the same rhythm as the order summary. */
.lm-order-services {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--lm-line);
}

/* Emptied while no country is chosen: no stray rule under the legend. */
.lm-order-services:empty {
  display: none;
}

.lm-order-service {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--lm-space-4);
  padding-block: var(--lm-space-4);
  border-bottom: 1px solid var(--lm-line);
  cursor: pointer;
}

/* Selected row carries three cues that survive without colour: the filled
   radio, the tint and the bar; the name also gains weight. */
.lm-order-service:has(input:checked) {
  background: rgba(15, 111, 181, .06);
  box-shadow: inset 2px 0 0 var(--lm-accent);
}

.lm-order-service:has(input:checked) .lm-order-service-name {
  font-weight: 600;
}

.lm-order-service input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--lm-accent);
}

.lm-order-service input[type="radio"]:focus-visible {
  outline: 2px solid var(--lm-accent);
  outline-offset: 2px;
}

.lm-order-service-name {
  color: var(--lm-ink);
}

.lm-order-service-price {
  color: var(--lm-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Relay picker. */
.lm-order-relay {
  display: flex;
  flex-direction: column;
  gap: var(--lm-space-2);
  padding: var(--lm-space-4);
  border: 1px solid var(--lm-line);
  border-radius: var(--lm-radius);
  background: var(--lm-bg);
}

.lm-order-relay-label {
  margin: 0;
  color: var(--lm-ink);
  font-weight: 600;
}

.lm-order-relay-summary {
  margin: 0;
  color: var(--lm-muted);
}

.lm-order-relay .lm-btn {
  align-self: flex-start;
}

/* Postal-code row: label on its own line, input and search button side by side.
   The input repeats .lm-field input because this field is not wrapped in one. */
.lm-order-relay-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--lm-space-2) var(--lm-space-4);
  align-items: stretch;
}

.lm-order-relay-search > label {
  grid-column: 1 / -1;
  color: var(--lm-ink);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.4;
}

.lm-order-relay-search input {
  width: 100%;
  height: 48px;
  padding: 12px 14px;
  color: var(--lm-ink);
  background: var(--lm-surface);
  border: 1px solid var(--lm-line);
  border-radius: var(--lm-radius);
  font-family: var(--lm-font-sans);
  font-size: 1.0625rem;
  font-weight: 300;
  line-height: 1.4;
  transition: border-color 120ms ease-out;
}

.lm-order-relay-search input::placeholder {
  color: var(--lm-muted);
}

.lm-order-relay-search input:focus-visible {
  border-color: var(--lm-accent);
  outline: 2px solid var(--lm-accent);
  outline-offset: 1px;
}

/* Point list: sibling of the service list — hairline rows, radio kept visible. */
.lm-order-relay-points {
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--lm-line);
}

/* Emptied before a search: no stray rule under the status line. */
.lm-order-relay-points:empty {
  display: none;
}

.lm-order-relay-point {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  column-gap: var(--lm-space-4);
  row-gap: var(--lm-space-1);
  padding: var(--lm-space-4) var(--lm-space-2);
  border-bottom: 1px solid var(--lm-line);
  cursor: pointer;
  transition: background-color 120ms ease-out;
}

.lm-order-relay-point:hover {
  background: rgba(15, 111, 181, .04);
}

/* Selected row carries three cues that survive without colour: the filled
   radio, the tint and the bar; the name also gains weight. */
.lm-order-relay-point:has(input:checked) {
  background: rgba(15, 111, 181, .06);
  box-shadow: inset 2px 0 0 var(--lm-accent);
}

.lm-order-relay-point:has(input:checked) .lm-order-relay-point-name {
  font-weight: 600;
}

.lm-order-relay-point input[type="radio"] {
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--lm-accent);
}

.lm-order-relay-point input[type="radio"]:focus-visible {
  outline: 2px solid var(--lm-accent);
  outline-offset: 2px;
}

/* Keyboard focus on the radio must outline the whole row, not only the dot. */
.lm-order-relay-point:has(input:focus-visible) {
  outline: 2px solid var(--lm-accent);
  outline-offset: -2px;
}

.lm-order-relay-point-name {
  color: var(--lm-ink);
  line-height: 1.35;
}

.lm-order-relay-point-address {
  color: var(--lm-muted);
  font-size: .9375rem;
  line-height: 1.4;
}

/* Status / error line under the button. */
.lm-order-status {
  margin: 0;
  color: var(--lm-ink);
}

.lm-order-status[data-state="loading"],
.lm-order-status[data-state="error"] {
  padding: var(--lm-space-4);
  border-radius: var(--lm-radius);
  border-inline-start: 3px solid var(--lm-accent);
  background: rgba(15, 111, 181, .06);
}

.lm-order-status[data-state="error"] {
  border-inline-start-color: var(--lm-error);
  background: rgba(179, 38, 30, .07);
  color: var(--lm-error);
}

/* Single reassurance message, under the button. */
.lm-order-note {
  max-width: 40ch;
  margin-inline: auto;
  text-align: center;
}

.lm-order-submit {
  width: 100%;
  justify-content: center;
}

/* Relay dialog: same surface language as the site modal, scoped to the form. */
.lm-order-dialog {
  width: min(560px, calc(100vw - 2 * var(--lm-space-4)));
  max-width: none;
  max-height: min(90vh, 880px);
  margin: auto;
  padding: var(--lm-space-6);
  border: 0;
  border-radius: var(--lm-radius-card);
  background: var(--lm-surface);
  color: var(--lm-ink);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .08), 0 32px 64px rgba(0, 0, 0, .12);
}

.lm-order-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: var(--lm-space-4);
}

.lm-order-dialog::backdrop {
  background: rgba(12, 12, 14, .55);
  backdrop-filter: blur(2px);
}

.lm-order-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--lm-space-4);
}

.lm-order-dialog-head h2 {
  margin: 0;
}

.lm-order-dialog-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--lm-radius);
  background: transparent;
  color: var(--lm-muted);
  cursor: pointer;
}

.lm-order-dialog-close:hover {
  background: var(--lm-bg);
  color: var(--lm-ink);
}

.lm-order-dialog-close:focus-visible {
  outline: 2px solid var(--lm-accent);
  outline-offset: 2px;
}

.lm-order-dialog-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.lm-order-relay-error {
  margin: 0;
  padding: var(--lm-space-4);
  border-radius: var(--lm-radius);
  background: var(--lm-bg);
  color: var(--lm-ink);
}

.lm-order-relay-error[hidden] {
  display: none;
}

@media (max-width: 480px) {
  .lm-order-relay-search {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .lm-order-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lm-order-service,
  .lm-order-relay-point,
  .lm-order-dialog-close,
  .lm-order-submit {
    transition-duration: 1ms;
  }
}
