/**
 * SML Commerce Checkout — Drupal 11 / Commerce 3.x
 * Presentation only. No changes to checkout, shipping, tax or payment logic.
 */

body.path-checkout .commerce-checkout-flow {
  --sml-blue: #005696;
  --sml-blue-dark: #004579;
  --sml-border: #d6e0eb;
  --sml-text: #243247;
  --sml-muted: #64748b;
  --sml-surface: #f8fafc;
  color: var(--sml-text);
  font-size: 14px;
  line-height: 1.5;
}

/* The Commerce Twig layout wraps the form; it is not a descendant of it. */
body.path-checkout .layout-checkout-form {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 24px 32px;
  align-items: start;
}
body.path-checkout .layout-checkout-form > .layout-region-checkout-main,
body.path-checkout .layout-checkout-form > .layout-region-checkout-secondary,
body.path-checkout .layout-checkout-form > .layout-region-checkout-footer {
  float: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
}
body.path-checkout .layout-checkout-form > .layout-region-checkout-main {
  grid-column: 1;
  grid-row: 1;
  padding: 0;
}
body.path-checkout .layout-checkout-form > .layout-region-checkout-secondary {
  grid-column: 2;
  grid-row: 1;
  padding: 20px;
  border: 1px solid #d6e0eb;
  border-radius: 8px;
  background: #f8fafc;
}
body.path-checkout .layout-checkout-form > .layout-region-checkout-footer {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 0;
}

/* Order information and review section cards. */
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information,
body.path-checkout .commerce-checkout-flow .checkout-pane-payment-information,
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] {
  box-sizing: border-box;
  min-width: 0;
  margin: 0 0 20px;
  padding: 20px 22px;
  border: 1px solid var(--sml-border);
  border-radius: 8px;
  background: #fff;
}
body.path-checkout .commerce-checkout-flow .checkout-pane > .fieldset__legend,
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] > .fieldset__legend {
  float: none;
  width: auto;
  margin: 0 0 15px;
  padding: 0;
}
body.path-checkout .commerce-checkout-flow .checkout-pane > .fieldset__legend .fieldset__label,
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] > .fieldset__legend .fieldset__label {
  color: var(--sml-blue);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}
body.path-checkout .commerce-checkout-flow .checkout-pane > .fieldset__wrapper,
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] > .fieldset__wrapper {
  clear: both;
  width: 100%;
  min-width: 0;
  padding: 0;
}

/* Input and label styling. */
body.path-checkout .commerce-checkout-flow label.form-item__label,
body.path-checkout .commerce-checkout-flow .form-item > label {
  display: block;
  margin: 0 0 5px;
  color: var(--sml-text);
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.4;
}
body.path-checkout .commerce-checkout-flow input[type="text"],
body.path-checkout .commerce-checkout-flow input[type="email"],
body.path-checkout .commerce-checkout-flow input[type="tel"],
body.path-checkout .commerce-checkout-flow input[type="password"],
body.path-checkout .commerce-checkout-flow select,
body.path-checkout .commerce-checkout-flow textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--sml-border);
  border-radius: 5px;
  color: var(--sml-text);
  font-family: inherit;
  font-size: 14px;
  font-style: normal;
  line-height: 1.4;
  box-shadow: none;
}
body.path-checkout .commerce-checkout-flow input::placeholder,
body.path-checkout .commerce-checkout-flow textarea::placeholder {
  color: var(--sml-muted);
  font-style: normal;
  opacity: 1;
}
body.path-checkout .commerce-checkout-flow input:focus,
body.path-checkout .commerce-checkout-flow select:focus,
body.path-checkout .commerce-checkout-flow textarea:focus {
  border-color: var(--sml-blue);
  outline: 2px solid rgba(0, 86, 150, .18);
  outline-offset: 1px;
}
body.path-checkout .commerce-checkout-flow .form-item {
  min-width: 0;
  margin-top: 0;
  margin-bottom: 13px;
}
body.path-checkout .commerce-checkout-flow fieldset { min-width: 0; }
body.path-checkout .commerce-checkout-flow .form-item-shipping-information-shipping-profile-select-address {
  margin-bottom: 18px;
}

/* Address entry. First/last and locality/state/ZIP share Drupal inline containers. */
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .address-container-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  width: 100%;
  margin: 0;
}
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .address-container-inline > .form-item {
  float: none;
  width: auto;
  min-width: 0;
  margin-right: 0;
}
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .address-container-inline:has(.locality) {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .85fr);
}
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .address-container-inline:has(.locality) > .form-item {
  max-width: none;
}
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .form-item-shipping-information-shipping-profile-address-0-address-organization,
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .form-item-shipping-information-shipping-profile-address-0-address-address-line1,
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .form-item-shipping-information-shipping-profile-address-0-address-address-line2 {
  width: 100%;
  max-width: 100%;
}

/* Radios, checkboxes and shipping method. */
body.path-checkout .commerce-checkout-flow input[type="radio"],
body.path-checkout .commerce-checkout-flow input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  accent-color: var(--sml-blue);
}
body.path-checkout .commerce-checkout-flow .form-type-radio,
body.path-checkout .commerce-checkout-flow .form-type-checkbox,
body.path-checkout .commerce-checkout-flow .js-form-type-radio,
body.path-checkout .commerce-checkout-flow .js-form-type-checkbox {
  margin: 8px 0;
}
body.path-checkout .commerce-checkout-flow .form-type-radio label,
body.path-checkout .commerce-checkout-flow .form-type-checkbox label,
body.path-checkout .commerce-checkout-flow .js-form-type-radio label,
body.path-checkout .commerce-checkout-flow .js-form-type-checkbox label {
  display: inline;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  vertical-align: middle;
}
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .field--name-shipping-method {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--sml-surface);
  border: 1px solid var(--sml-border);
  border-radius: 6px;
}
body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .field--name-shipping-method .fieldset__label {
  font-size: 14px;
  font-weight: 700;
}

/* Sidebar summary. */
body.path-checkout .layout-region-checkout-secondary > h3 {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d6e0eb;
  color: #005696;
  font-size: 19px;
  font-weight: 700;
}
body.path-checkout .layout-region-checkout-secondary .views-table {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  table-layout: auto;
}
body.path-checkout .layout-region-checkout-secondary .views-table td {
  padding: 9px 5px;
  border-bottom: 1px solid #d6e0eb;
  font-size: 13px;
  vertical-align: top;
}
body.path-checkout .layout-region-checkout-secondary .views-field-quantity,
body.path-checkout .layout-region-checkout-secondary .views-field-total-price__number {
  white-space: nowrap;
}
body.path-checkout .layout-region-checkout-secondary .views-field-total-price__number {
  text-align: right;
}
body.path-checkout .layout-region-checkout-secondary .order-total-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 7px 0;
  font-size: 14px;
  line-height: 1.45;
}
body.path-checkout .layout-region-checkout-secondary .order-total-line-label {
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
  overflow-wrap: anywhere;
}
body.path-checkout .layout-region-checkout-secondary .order-total-line-value {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
body.path-checkout .layout-region-checkout-secondary .order-total-line__adjustment--tax {
  align-items: flex-start;
}
body.path-checkout .layout-region-checkout-secondary .order-total-line__total {
  margin-top: 12px;
  padding-top: 15px;
  border-top: 2px solid #d6e0eb;
  color: #005696;
  font-size: 19px;
  font-weight: 700;
}

/* Review details: preserve native text and edit actions. */
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] {
  line-height: 1.6;
}
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] a,
body.path-checkout .commerce-checkout-flow .checkout-review-edit-link {
  color: var(--sml-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] a:hover,
body.path-checkout .commerce-checkout-flow .checkout-review-edit-link:hover {
  color: var(--sml-blue-dark);
}
body.path-checkout .commerce-checkout-flow .checkout-pane-review {
  line-height: 1.6;
}

/* PayPal SDK owns the button rendering; only its surrounding spacing changes. */
body.path-checkout #paypal-buttons-container {
  max-width: 100%;
  margin: 20px 0 14px;
}
body.path-checkout #paypal-buttons-container iframe {
  max-width: 100%;
}

/* Form navigation. */
body.path-checkout .commerce-checkout-flow .form-actions {
  margin: 0 0 20px;
}
body.path-checkout .commerce-checkout-flow .form-actions .button {
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid var(--sml-blue);
  border-radius: 5px;
  background: var(--sml-blue);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
body.path-checkout .commerce-checkout-flow .form-actions .button:hover {
  background: var(--sml-blue-dark);
  border-color: var(--sml-blue-dark);
}
body.path-checkout .commerce-checkout-flow .form-actions .button:focus-visible {
  outline: 3px solid rgba(0, 86, 150, .3);
  outline-offset: 3px;
}

@media (max-width: 980px) {
  body.path-checkout .layout-checkout-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  body.path-checkout .layout-checkout-form > .layout-region-checkout-main {
    grid-column: 1;
    grid-row: 1;
  }
  body.path-checkout .layout-checkout-form > .layout-region-checkout-secondary {
    grid-column: 1;
    grid-row: 2;
  }
  body.path-checkout .layout-checkout-form > .layout-region-checkout-footer {
    grid-column: 1;
    grid-row: 3;
  }
}
@media (max-width: 600px) {
  body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information,
  body.path-checkout .commerce-checkout-flow .checkout-pane-payment-information,
  body.path-checkout .commerce-checkout-flow fieldset[id^="edit-review-"] {
    padding: 16px;
  }
  body.path-checkout .layout-checkout-form > .layout-region-checkout-secondary {
    padding: 16px;
  }
  body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .address-container-inline,
  body.path-checkout .commerce-checkout-flow .checkout-pane-shipping-information .address-container-inline:has(.locality) {
    grid-template-columns: minmax(0, 1fr);
  }
  body.path-checkout .commerce-checkout-flow .form-actions .button {
    width: 100%;
    max-width: 100%;
  }
}

/* SML guest checkout: login-only layout correction. */
body.path-checkout .layout-checkout-form:has(> .checkout-pane-login) {
  display: block;
  width: 100%;
  max-width: 100%;
}

body.path-checkout .layout-checkout-form > .checkout-pane-login {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.path-checkout #edit-login-returning-customer,
body.path-checkout #edit-login-guest {
  float: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  border: 1px solid #d6e0eb;
  border-radius: 8px;
  background: #fff;
}

body.path-checkout #edit-login-returning-customer .fieldset__wrapper,
body.path-checkout #edit-login-guest .fieldset__wrapper {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.path-checkout #edit-login-guest-continue {
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  box-sizing: border-box;
  white-space: normal;
  border-radius: 5px;
}

@media (max-width: 700px) {
  body.path-checkout .layout-checkout-form > .checkout-pane-login {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* SML CUSTOMER ACCOUNT ACTIONS - 20261116 */
.sml-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 18px 0 28px;
}

.sml-account-actions .sml-account-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  min-height: 44px;
  padding: 10px 22px;
  box-sizing: border-box;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 480px) {
  .sml-account-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sml-account-actions .sml-account-action {
    width: 100%;
  }
}


/* SML CHECKOUT SINGLE PAYMENT GATEWAY - 20261116 */

/*
 * Hide the redundant PayPal selection on the Order Information step.
 * The checked radio remains in the form for Commerce processing.
 * Billing-address controls remain visible.
 */
form.commerce-checkout-flow .checkout-pane-payment-information
  input[name="payment_information[payment_method]"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

form.commerce-checkout-flow .checkout-pane-payment-information
  label[for="edit-payment-information-payment-method-7"] {
  display: none !important;
}

/* Hide the redundant Payment method heading, retaining billing controls. */
form.commerce-checkout-flow .checkout-pane-payment-information
  .form-item--payment-information-payment-method {
  position: relative;
}


/* SML CHECKOUT PAYMENT PRESENTATION V2 - 20261116 */

/*
 * The sole payment gateway remains selected and submitted normally.
 * Hide only its redundant heading and visual selection controls.
 */
.layout-checkout-form .checkout-pane-payment-information
  fieldset:has(input[name="payment_information[payment_method]"]) > legend,
.layout-checkout-form .checkout-pane-payment-information
  .form-item--payment-information-payment-method > label,
.layout-checkout-form .checkout-pane-payment-information
  .form-item:has(> input[name="payment_information[payment_method]"]),
.layout-checkout-form .checkout-pane-payment-information
  label[for^="edit-payment-information-payment-method-"] {
  display: none !important;
}

/*
 * Prominent checkout messages, including PayPal cancellation notices.
 * Preserve Drupal's original message content and behavior.
 */
.layout-checkout-form .messages,
body:has(.layout-checkout-form) .messages {
  color: #b42318 !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.5 !important;
  padding: 15px 18px !important;
  margin: 16px 0 22px !important;
  border: 1px solid #d92d20 !important;
  border-left: 5px solid #d92d20 !important;
  border-radius: 5px !important;
  background: #fff4f2 !important;
}

body:has(.layout-checkout-form) .messages *,
.layout-checkout-form .messages * {
  color: inherit !important;
}

@media (max-width: 600px) {
  body:has(.layout-checkout-form) .messages,
  .layout-checkout-form .messages {
    font-size: 16px !important;
    padding: 12px 14px !important;
  }
}
