/*
 * XPort shared form contract.
 *
 * This adapter owns only the common geometry, type and interaction states of
 * active customer forms. Page plugins remain responsible for their grids,
 * content and business behaviour.
 */

body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) {
  --xui-local-control-height:var(--xui-form-control-height,44px);
  --xui-local-field-gap:var(--xui-form-field-gap,12px);
  font-family:var(--xui-font-family,"Rubik",system-ui,sans-serif);
}

/* Text controls */
body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) :is(input[type="text"],input[type="email"],input[type="tel"],input[type="password"],input[type="number"],select,textarea):not([type="hidden"]):not(.xpromo-form input) {
  box-sizing:border-box!important;
  width:100%;
  min-height:var(--xui-local-control-height)!important;
  margin:0!important;
  padding-inline:var(--xui-form-control-padding,14px)!important;
  border:1px solid var(--xui-color-border,#dbe4ee)!important;
  border-radius:var(--xui-form-control-radius,12px)!important;
  outline:0!important;
  background:#fff!important;
  box-shadow:var(--xui-shadow-control,0 1px 2px rgba(15,23,42,.055))!important;
  color:var(--xui-color-text,#111827)!important;
  font-family:inherit!important;
  font-size:14px!important;
  font-weight:400!important;
  line-height:1.35!important;
  transition:border-color .16s ease,box-shadow .16s ease,background-color .16s ease!important;
}

body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) :is(input[type="text"],input[type="email"],input[type="tel"],input[type="password"],input[type="number"],select):not([type="hidden"]):not(.xpromo-form input) {
  height:var(--xui-local-control-height)!important;
}

body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) textarea {
  min-height:92px!important;
  padding-block:11px!important;
  resize:vertical;
}

body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) :is(input,select,textarea):not(.xpromo-form input):focus {
  border-color:var(--xui-color-primary,#26b24a)!important;
  box-shadow:0 0 0 3px rgba(38,178,74,.11)!important;
}

body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) :is(input,select,textarea):not(.xpromo-form input):disabled {
  border-color:var(--xui-selection-disabled-edge,#dfe4e9)!important;
  background:var(--xui-selection-disabled-bg,#f7f8fa)!important;
  box-shadow:none!important;
  color:var(--xui-selection-disabled-fg,#8e98a5)!important;
  cursor:not-allowed;
}

/* Labels and vertical rhythm */
body.xport-ui-system-active :is(
  .xp-auth-form,
  .xp-edit-account-form,
  .woocommerce-ResetPassword,
  .xif-credit-account-form,
  .xpc-owned-checkout,
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form,
  .xss-form
) :is(.xp-auth-field>label,.woocommerce-form-row>label,.breakdance-form-field__label,.xpc-field__label,.xpc-delivery-field>label,.xss-field>span:first-child) {
  display:block;
  margin:0 0 var(--xui-form-label-gap,6px)!important;
  color:#344054!important;
  font-size:13px!important;
  font-weight:600!important;
  line-height:1.3!important;
}

body.xport-ui-system-active :is(.xp-form-grid,.xp-password-grid,.xif-credit-account-form .xp-form-grid) {
  gap:var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active :is(
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form
) {
  row-gap:var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active :is(
  .bde-form-builder-395-103 .breakdance-form,
  .bde-form-builder-7481-100 .breakdance-form
) .breakdance-form-field {
  margin-bottom:0!important;
}

body.xport-ui-system-active .xp-auth-field {
  margin:0 0 var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active .xp-auth-row {
  min-height:20px!important;
  margin:0 0 var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active .xp-auth-form .aiowps-captcha-equation {
  min-height:var(--xui-local-control-height)!important;
  margin:0 0 var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active .xp-auth-form .aiowps-captcha-equation strong {
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  min-height:var(--xui-local-control-height)!important;
  line-height:1.3!important;
}

body.xport-ui-system-active .xp-auth-form .aiowps-captcha-equation .aiowps-captcha-answer {
  width:88px!important;
  min-width:88px!important;
  flex:0 0 88px!important;
}

body.xport-ui-system-active .woocommerce-ResetPassword .form-row {
  margin:0 0 var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active .xif-credit-account-form.xp-edit-account-form {
  gap:14px 16px!important;
}

body.xport-ui-system-active .xif-credit-account-form .xp-account-actions {
  gap:10px!important;
}

body.xport-ui-system-active :is(.xif-select-ui__trigger,.xif-money-input) {
  min-height:var(--xui-form-control-height,44px)!important;
  border-radius:var(--xui-form-control-radius,12px)!important;
}

body.xport-ui-system-active .xif-select-ui__trigger {
  height:var(--xui-form-control-height,44px)!important;
  padding-inline:var(--xui-form-control-padding,14px)!important;
}

/* Form surfaces are intentionally denser than content cards. */
body.xport-ui-system-active :is(.xp-account-section,.xp-auth-panel,.xif-application.xp-account-section) {
  padding:var(--xui-form-section-padding,24px)!important;
}

body.xport-ui-system-active :is(.xp-section-head,.xp-auth-head,.xif-application .xp-section-head) {
  margin-bottom:var(--xui-form-section-gap,18px)!important;
}

/* Checkout input fields and selection cards share the same compact rhythm. */
body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-contact-fields {
  gap:var(--xui-local-field-gap,12px)!important;
  margin-top:14px!important;
}

body.xport-ui-system-active.xport-checkout-preview-v2-active :is(.xpc-field__control,.xpc-delivery-field input) {
  height:var(--xui-local-control-height)!important;
}

body.xport-ui-system-active.xport-checkout-preview-v2-active :is(.xpc-choice,.xpc-payment-option) {
  min-height:54px!important;
  padding:7px 11px!important;
}

body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-pickup-option {
  min-height:52px!important;
  padding:7px 10px!important;
}

body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-panel-title {
  margin-top:20px!important;
  margin-bottom:11px!important;
}

body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-submit {
  gap:14px!important;
}

/*
 * Supporting form content.
 * Legal consent, passive notes and preference controls share one visual
 * language while their page owners keep the context-specific wording.
 */
body.xport-ui-system-active :is(
  .xpc-submit__consent,
  .xpn-consent
) {
  display:flex!important;
  align-items:flex-start!important;
  gap:9px!important;
  margin:0!important;
  color:#667085!important;
  font-family:var(--xui-font-family,"Rubik",system-ui,sans-serif)!important;
  font-size:12px!important;
  font-weight:400!important;
  line-height:1.45!important;
  text-align:left!important;
}

body.xport-ui-system-active :is(
  .xpc-submit__consent,
  .xpn-consent
) a {
  color:var(--xui-color-primary,#26b24a)!important;
  font-weight:500!important;
  text-decoration:none!important;
}

body.xport-ui-system-active :is(.xpn-close,.xpn-submit,.xpn-consent a) {
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

body.xport-ui-system-active .xpn-close {
  transition:background-color var(--xui-transition),color var(--xui-transition),box-shadow var(--xui-transition),transform var(--xui-transition)!important;
}

body.xport-ui-system-active .xpn-close:active {
  background:transparent!important;
  box-shadow:none!important;
  transform:none;
}

body.xport-ui-system-active .xpn-submit {
  transition:background-color var(--xui-transition),box-shadow var(--xui-transition),transform var(--xui-transition)!important;
}

body.xport-ui-system-active .xpn-submit:active:not(:disabled) {
  background:var(--xui-material-primary-active-bg,#259f4a)!important;
  box-shadow:var(--xui-material-primary-active,inset 0 1px 2px rgba(15,94,42,.22))!important;
  transform:translateY(1px);
}

body.xport-ui-system-active .xpn-consent a:active {
  color:var(--xui-color-primary-hover,#1f9d45)!important;
}

body.xport-ui-system-active .xpc-submit__checkbox,
body.xport-ui-system-active .xpn-consent input[type="checkbox"] {
  box-sizing:border-box!important;
  flex:0 0 19px!important;
  width:19px!important;
  height:19px!important;
  margin:0!important;
  border-radius:5px!important;
}

body.xport-ui-system-active .xpn-submit-note {
  margin:0!important;
  color:#7b8794!important;
  font-family:var(--xui-font-family,"Rubik",system-ui,sans-serif)!important;
  font-size:12px!important;
  font-weight:400!important;
  line-height:1.35!important;
  text-align:center!important;
}

body.xport-ui-system-active .xp-auth-remember {
  align-items:center!important;
  gap:9px!important;
  color:#475467!important;
  font-size:13px!important;
  font-weight:500!important;
  line-height:1.35!important;
}

body.xport-ui-system-active .xp-auth-remember input[type="checkbox"] {
  appearance:none!important;
  box-sizing:border-box!important;
  flex:0 0 18px!important;
  width:18px!important;
  height:18px!important;
  margin:0!important;
  border:1.5px solid #aeb8c1!important;
  border-radius:5px!important;
  background:#fff!important;
  box-shadow:none!important;
}

body.xport-ui-system-active .xp-auth-remember input[type="checkbox"]:checked {
  border-color:var(--xui-color-primary,#26b24a)!important;
  background-color:var(--xui-color-primary,#26b24a)!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.2 2.7 2.7 6.3-6.2' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important;
  background-position:center!important;
  background-repeat:no-repeat!important;
  background-size:14px!important;
}

body.xport-ui-system-active .xp-auth-remember input[type="checkbox"]:focus-visible {
  outline:2px solid rgba(38,178,74,.22)!important;
  outline-offset:2px!important;
}

body.xport-ui-system-active .xp-auth-panel .woocommerce-privacy-policy-text,
body.xport-ui-system-active .xp-auth-panel .woocommerce-privacy-policy-text p {
  color:#7b8794!important;
  font-size:12px!important;
  font-weight:400!important;
  line-height:1.45!important;
}

body.xport-ui-system-active .xp-auth-panel .woocommerce-privacy-policy-text a {
  color:var(--xui-color-primary,#26b24a)!important;
  font-weight:500!important;
  text-decoration:none!important;
}

/* Primary form actions use one stable control height. */
body.xport-ui-system-active :is(
  .xp-auth-submit button,
  .xp-account-actions button.button,
  .woocommerce-ResetPassword button[type="submit"],
  .xif-credit-account-form .breakdance-form-button.xui-button,
  #place_order.xpc-submit__button,
  .bde-form-builder-395-103 .breakdance-form button[type="submit"],
  .bde-form-builder-7481-100 .breakdance-form button[type="submit"],
  .xss-form button[type="submit"]
) {
  min-height:46px!important;
  border-radius:var(--xui-radius-control,12px)!important;
  font-size:14px!important;
  line-height:1!important;
}

/* Modal forms: content-sized dialog and calm spacing. */
body.xport-ui-system-active .xss-form {
  gap:var(--xui-local-field-gap)!important;
}

body.xport-ui-system-active .xss-modal__dialog {
  padding:24px!important;
}

body.xport-ui-system-active .xss-modal h2 {
  margin-bottom:16px!important;
}

body.xport-ui-system-active .xss-modal__intro {
  margin-bottom:16px!important;
}

@media (max-width:767px) {
  :root {
    --xui-form-control-height:42px;
    --xui-form-control-padding:13px;
    --xui-form-field-gap:10px;
    --xui-form-section-padding:18px;
    --xui-form-section-gap:15px;
  }

  body.xport-ui-system-active :is(
    .xp-auth-form,
    .xp-edit-account-form,
    .woocommerce-ResetPassword,
    .xif-credit-account-form,
    .xpc-owned-checkout,
    .bde-form-builder-395-103 .breakdance-form,
    .bde-form-builder-7481-100 .breakdance-form,
    .xss-form
  ) :is(input[type="text"],input[type="email"],input[type="tel"],input[type="password"],input[type="number"],select,textarea):not([type="hidden"]):not(.xpromo-form input) {
    font-size:14px!important;
  }

  body.xport-ui-system-active :is(.xp-account-section,.xp-auth-panel,.xif-application.xp-account-section) {
    border-radius:20px!important;
  }

  body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-contact-fields {
    gap:10px!important;
    margin-top:13px!important;
  }

  body.xport-ui-system-active .xif-credit-account-form.xp-edit-account-form {
    gap:10px!important;
  }

  body.xport-ui-system-active.xport-checkout-preview-v2-active :is(.xpc-choice,.xpc-payment-option,.xpc-pickup-option) {
    min-height:50px!important;
    padding-block:6px!important;
  }

  body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-panel-title {
    margin-top:17px!important;
    margin-bottom:9px!important;
  }

  /* Required consent must be read before the action it unlocks. */
  body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-submit__consent {
    order:1!important;
  }

  body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-submit__button,
  body.xport-ui-system-active.xport-checkout-preview-v2-active #place_order.xpc-submit__button {
    order:2!important;
  }

  body.xport-ui-system-active .xif-service-form > .breakdance-form-field:has(.xpc-submit__consent) {
    order:1!important;
  }

  body.xport-ui-system-active .xif-service-form > .xp-account-actions {
    order:2!important;
  }

  body.xport-ui-system-active :is(
    .xp-auth-submit button,
    .xp-account-actions button.button,
    .woocommerce-ResetPassword button[type="submit"],
    .xif-credit-account-form .breakdance-form-button.xui-button,
    #place_order.xpc-submit__button,
    .bde-form-builder-395-103 .breakdance-form button[type="submit"],
    .bde-form-builder-7481-100 .breakdance-form button[type="submit"],
    .xss-form button[type="submit"]
  ) {
    min-height:44px!important;
  }

  html body.xport-ui-system-active.xport-checkout-preview-v2-active .xpc-owned-checkout #place_order.xpc-submit__button {
    height:44px!important;
    min-height:44px!important;
  }

  body.xport-ui-system-active .xss-modal__dialog {
    padding:20px 16px 18px!important;
  }
}

@media (prefers-reduced-motion:reduce) {
  body.xport-ui-system-active :is(
    .xp-auth-form,
    .xp-edit-account-form,
    .woocommerce-ResetPassword,
    .xif-credit-account-form,
    .xpc-owned-checkout,
    .bde-form-builder-395-103 .breakdance-form,
    .bde-form-builder-7481-100 .breakdance-form,
    .xss-form
  ) :is(input,select,textarea):not(.xpromo-form input) {
    transition:none!important;
  }
}
