/* Checkout: keep payment instructions available without expanding the form. */
body.page-order #checkout-payment-step .js-additional-information,
body#checkout #checkout-payment-step .js-additional-information {
  display: none !important;
}

/* Keep every payment card stable while PrestaShop finishes its first render. */
body.page-order #checkout-payment-step .payment-option,
body#checkout #checkout-payment-step .payment-option {
  grid-template-rows: auto auto !important;
  align-items: start !important;
  min-height: 92px !important;
}

body.page-order #checkout-payment-step .payment-option input[type="radio"],
body#checkout #checkout-payment-step .payment-option input[type="radio"] {
  grid-row: 1 !important;
  align-self: center !important;
}

body.page-order #checkout-payment-step .payment-option label,
body#checkout #checkout-payment-step .payment-option label {
  grid-row: 1 !important;
  width: 100% !important;
  min-height: 34px;
}

body.page-order #checkout-payment-step .fa-payment-info-trigger,
body#checkout #checkout-payment-step .fa-payment-info-trigger {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
}

body.page-order #checkout-payment-step .fa-payment-info-trigger::before,
body#checkout #checkout-payment-step .fa-payment-info-trigger::before {
  content: "i";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  font-style: italic;
}

.fa-payment-info-modal[hidden] {
  display: none !important;
}

.fa-payment-info-modal {
  position: fixed;
  z-index: 10050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 31, 58, .48);
}

.fa-payment-info-modal__card {
  position: relative;
  width: min(100%, 480px);
  max-height: min(680px, calc(100vh - 40px));
  overflow: auto;
  padding: 26px 24px 24px;
  border: 1px solid #c9d7e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(18, 31, 58, .24);
}

.fa-payment-info-modal__title {
  margin: 0 34px 18px 0;
  color: var(--dark);
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.fa-payment-info-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #edf4fb;
  color: var(--dark);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.fa-payment-info-modal .js-additional-information {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body.fa-payment-info-open {
  overflow: hidden;
}

/* A clear, anchored explanation when the mandatory checkout consent is missing. */
body.page-order #checkout-payment-step #conditions-to-approve .form-check,
body#checkout #checkout-payment-step #conditions-to-approve .form-check {
  position: relative;
}

body.page-order #checkout-payment-step .fa-terms-consent-notice,
body#checkout #checkout-payment-step .fa-terms-consent-notice {
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(310px, calc(100vw - 42px));
  padding: 10px 12px;
  border: 1px solid #c94b4b;
  border-radius: 9px;
  background: #fff7f7;
  box-shadow: 0 8px 20px rgba(67, 25, 25, .16);
  color: #842d2d;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

body.page-order #checkout-payment-step .fa-terms-consent-notice::after,
body#checkout #checkout-payment-step .fa-terms-consent-notice::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 100%;
  width: 10px;
  height: 10px;
  border-right: 1px solid #c94b4b;
  border-bottom: 1px solid #c94b4b;
  background: #fff7f7;
  transform: translateY(-6px) rotate(45deg);
}

body.page-order #checkout-payment-step .fa-terms-consent-invalid input[type="checkbox"],
body#checkout #checkout-payment-step .fa-terms-consent-invalid input[type="checkbox"] {
  outline: 2px solid #c94b4b;
  outline-offset: 2px;
}

/* The checkout primary-button chevron is already supplied as text below. */
body.page-order #checkout-payment-step #payment-confirmation button::after,
body#checkout #checkout-payment-step #payment-confirmation button::after {
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  transform: none !important;
}

/* Compact native choices and keep each control aligned with its label. */
body.page-order .form-check,
body#checkout .form-check {
  align-items: flex-start !important;
}

body.page-order .form-check-input,
body#checkout .form-check-input,
body.page-order .custom-radio input[type="radio"],
body#checkout .custom-radio input[type="radio"] {
  box-sizing: border-box !important;
  width: 14px !important;
  min-width: 14px !important;
  height: 14px !important;
  min-height: 14px !important;
  margin: 3px 0 0 !important;
  padding: 0 !important;
  flex: 0 0 14px !important;
}

body.page-order #checkout-addresses-step .address-card__header,
body#checkout #checkout-addresses-step .address-card__header {
  grid-template-columns: none !important;
  align-items: center !important;
}

body.page-order #checkout-addresses-step .address-card input[type="radio"],
body#checkout #checkout-addresses-step .address-card input[type="radio"],
body.page-order #checkout-payment-step .payment-option input[type="radio"],
body#checkout #checkout-payment-step .payment-option input[type="radio"] {
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  margin: 0 !important;
  flex-basis: 16px !important;
}

body.page-order #checkout-payment-step .payment-option,
body#checkout #checkout-payment-step .payment-option {
  grid-template-columns: 16px minmax(0, 1fr) !important;
}

/* Navegación de Pago: el mismo patrón visual que Direcciones y Envío. El
   botón de volver es un <button> nativo, no un enlace, y por eso necesita
   reglas explícitas para no recuperar el aspecto predeterminado del navegador. */
body.page-order #checkout-payment-step .buttons-wrapper,
body#checkout #checkout-payment-step .buttons-wrapper {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  margin-top: 8px !important;
}

body.page-order #checkout-payment-step .buttons-wrapper > a,
body.page-order #checkout-payment-step .buttons-wrapper > button,
body.page-order #checkout-payment-step #payment-confirmation button,
body#checkout #checkout-payment-step .buttons-wrapper > a,
body#checkout #checkout-payment-step .buttons-wrapper > button,
body#checkout #checkout-payment-step #payment-confirmation button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 42px !important;
  padding: 0 16px !important;
  border-radius: 9px !important;
  font-family: var(--sans) !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

body.page-order #checkout-payment-step .buttons-wrapper .js-back,
body#checkout #checkout-payment-step .buttons-wrapper .js-back {
  border: 1px solid var(--rule) !important;
  background: #fff !important;
  color: var(--dark) !important;
}

body.page-order #checkout-payment-step #payment-confirmation button,
body#checkout #checkout-payment-step #payment-confirmation button {
  min-height: 42px !important;
  padding: 0 24px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: var(--accent) !important;
  color: #fff !important;
  gap: 10px !important;
}

body.page-order #checkout-payment-step .buttons-wrapper .material-icons,
body.page-order #checkout-payment-step #payment-confirmation button .material-icons,
body#checkout #checkout-payment-step .buttons-wrapper .material-icons,
body#checkout #checkout-payment-step #payment-confirmation button .material-icons {
  display: inline !important;
}

body.page-order #checkout-payment-step #payment-confirmation button::after,
body#checkout #checkout-payment-step #payment-confirmation button::after {
  content: none !important;
  display: none !important;
}

/* En pantallas estrechas conserva el orden del primer paso: la acción
   principal queda arriba y la vuelta al paso anterior debajo, a ancho total. */
@media (max-width: 680px) {
  body.page-order #checkout-payment-step .buttons-wrapper,
  body#checkout #checkout-payment-step .buttons-wrapper {
    align-items: stretch !important;
    flex-direction: column-reverse !important;
  }

  body.page-order #checkout-payment-step .buttons-wrapper > a,
  body.page-order #checkout-payment-step .buttons-wrapper > button,
  body.page-order #checkout-payment-step #payment-confirmation button,
  body#checkout #checkout-payment-step .buttons-wrapper > a,
  body#checkout #checkout-payment-step .buttons-wrapper > button,
  body#checkout #checkout-payment-step #payment-confirmation button {
    width: 100% !important;
  }
}
