/* =========================================================
   ADADP 11.136.0 - Formulario de dirección limpio y alineado
   Objetivos:
   - Un único contenedor visual: elimina el segundo marco del formulario.
   - Alinea País/DNI, Nombre/Apellidos y CP/Teléfono en la misma rejilla.
   - Dirección y Otras indicaciones a ancho completo y con los mismos bordes.
   - Población/Provincia centradas debajo, sin afectar a la lógica postal.
   - Solo presentación: no cambia valores, validaciones ni transportistas.
   ========================================================= */

/* 1) Un solo recuadro grande: conservamos el paso exterior y limpiamos el form interior. */
body#checkout #checkout-addresses-step {
  background: #fff !important;
  border: 1px solid #dbe7f2 !important;
  border-radius: 14px !important;
  box-shadow: 0 5px 20px rgba(11, 79, 138, .055) !important;
}

body#checkout #checkout-addresses-step .js-address-form,
body#checkout #checkout-addresses-step form[class*="address"] {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding: 18px 26px 10px !important;
  margin: 0 !important;
}

/* El texto introductorio queda limpio, sin una tercera caja visual. */
body#checkout #checkout-addresses-step .content > p,
body#checkout #checkout-addresses-step .js-address-form > p:first-child,
body#checkout #checkout-addresses-step .adadp-delivery-address-intro {
  background: transparent !important;
  border: 0 !important;
  border-left: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 26px 16px !important;
  color: #52677a !important;
}

/* 2) Rejilla común: todos los pares comienzan y terminan en los mismos ejes. */
@media (min-width: 768px) {
  body#checkout #checkout-addresses-step .adadp-country-dni-wrap,
  body#checkout #checkout-addresses-step .adadp-name-surname-wrap,
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body#checkout #checkout-addresses-step .adadp-country-dni-wrap,
  body#checkout #checkout-addresses-step .adadp-name-surname-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    column-gap: 22px !important;
    row-gap: 14px !important;
    align-items: start !important;
  }

  /* CP + Teléfono exactamente sobre los mismos dos ejes. */
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    column-gap: 22px !important;
    row-gap: 18px !important;
    align-items: start !important;
  }

  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap > .adadp-v11135-postcode {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap > .adadp-v11135-phone {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap .adadp-v11135-postcode input,
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap .adadp-v11135-postcode .form-control {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* El prefijo +34 y el teléfono nunca desbordan su columna. */
  body#checkout #checkout-addresses-step .adadp-v11135-phone .adadp-phone-input-wrap {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body#checkout #checkout-addresses-step .adadp-v11135-phone .adadp-phone-prefix,
  body#checkout #checkout-addresses-step .adadp-v11135-phone [class*="phone-prefix"] {
    flex: 0 0 auto !important;
  }

  body#checkout #checkout-addresses-step .adadp-v11135-phone input,
  body#checkout #checkout-addresses-step .adadp-v11135-phone .form-control {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Población y provincia juntas, centradas y algo más anchas. */
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap > .adadp-v11135-place-box {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    justify-self: center !important;
    width: min(560px, 82%) !important;
    max-width: 560px !important;
    min-width: 0 !important;
    margin: 2px auto 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }
}

/* 3) Dirección y Otras indicaciones ocupan exactamente el ancho útil del formulario. */
body#checkout #checkout-addresses-step .adadp-address1-row,
body#checkout #checkout-addresses-step .adadp-v11135-address2-row {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

body#checkout #checkout-addresses-step .adadp-address1-row > [class*="col-"],
body#checkout #checkout-addresses-step .adadp-v11135-address2-row > [class*="col-"],
body#checkout #checkout-addresses-step .adadp-v11135-address2-col {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body#checkout #checkout-addresses-step .adadp-address1-row input,
body#checkout #checkout-addresses-step .adadp-address1-row .form-control,
body#checkout #checkout-addresses-step .adadp-v11135-address2-row input,
body#checkout #checkout-addresses-step .adadp-v11135-address2-row textarea,
body#checkout #checkout-addresses-step .adadp-v11135-address2-row .form-control {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* 4) Etiquetas y controles con una geometría coherente. */
body#checkout #checkout-addresses-step .js-address-form label,
body#checkout #checkout-addresses-step form[class*="address"] label {
  margin-bottom: 7px !important;
  line-height: 1.25 !important;
}

body#checkout #checkout-addresses-step .js-address-form input,
body#checkout #checkout-addresses-step .js-address-form select,
body#checkout #checkout-addresses-step .js-address-form textarea,
body#checkout #checkout-addresses-step .js-address-form .form-control {
  box-sizing: border-box !important;
}

/* Compra como empresa alineada con el resto, sin un margen lateral distinto. */
body#checkout #checkout-addresses-step .adadp-company-toggle {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* 5) Móvil: una sola columna limpia, sin el doble marco. */
@media (max-width: 767px) {
  body#checkout #checkout-addresses-step .js-address-form,
  body#checkout #checkout-addresses-step form[class*="address"] {
    padding: 14px 14px 8px !important;
  }

  body#checkout #checkout-addresses-step .content > p,
  body#checkout #checkout-addresses-step .js-address-form > p:first-child,
  body#checkout #checkout-addresses-step .adadp-delivery-address-intro {
    margin: 0 14px 14px !important;
  }

  body#checkout #checkout-addresses-step .adadp-country-dni-wrap,
  body#checkout #checkout-addresses-step .adadp-name-surname-wrap,
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap > .adadp-v11135-postcode,
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap > .adadp-v11135-phone,
  body#checkout #checkout-addresses-step .adadp-postcode-place-wrap > .adadp-v11135-place-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
}
