/* Total Clean - Checkout unified style (safe version)
   Keep WooCommerce Blocks layout intact; only enhance visual language. */

body.woocommerce-checkout {
  --ex-checkout-brand: #2157e1;
  --ex-checkout-text: #0f172a;
  --ex-checkout-muted: #475569;
  --ex-checkout-bg: #f2f5fb;
  --ex-checkout-card: #ffffff;
  --ex-checkout-border: rgba(15, 23, 42, 0.1);
  --ex-checkout-shadow: 0 6px 22px rgba(0, 0, 0, 0.05);
  background: var(--ex-checkout-bg);
  color: var(--ex-checkout-text);
}

body.woocommerce-checkout .wp-block-woocommerce-checkout,
body.woocommerce-checkout .woocommerce {
  max-width: 1240px;
  margin: 22px auto;
  padding: 0 12px;
  background: transparent;
}

/* Preserve native blocks layout; only tune spacing */
body.woocommerce-checkout .wc-block-components-sidebar-layout {
  gap: 22px;
}

body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block {
  border: none !important;
}

/* Desktop force: keep order summary at right even if Blocks marks container as small */
@media (min-width: 1024px) {
  body.woocommerce-checkout .wc-block-components-sidebar-layout,
  body.woocommerce-checkout .wp-block-woocommerce-checkout.is-small .wc-block-components-sidebar-layout,
  body.woocommerce-checkout .wp-block-woocommerce-checkout.is-mobile .wc-block-components-sidebar-layout {
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row !important;
  }

  body.woocommerce-checkout .wc-block-components-sidebar-layout:has(>:last-child.wp-block-woocommerce-checkout-fields-block) {
    flex-direction: row-reverse !important;
  }

  body.woocommerce-checkout .wc-block-components-sidebar-layout .wc-block-components-main {
    width: 65% !important;
    padding-right: 4.5283018868% !important;
    order: 0;
  }

  body.woocommerce-checkout .wc-block-components-sidebar-layout .wc-block-components-sidebar {
    width: 35% !important;
    padding-left: 2.2641509434% !important;
    order: 1;
  }
}

/* Main cards / sections */
body.woocommerce-checkout .wc-block-components-checkout-step,
body.woocommerce-checkout .wc-block-components-sidebar,
body.woocommerce-checkout .wc-block-checkout__actions_row,
body.woocommerce-checkout .wc-block-components-checkout-place-order,
body.woocommerce-checkout .woocommerce form.checkout .col2-set,
body.woocommerce-checkout .woocommerce form.checkout #order_review,
body.woocommerce-checkout .woocommerce form.checkout .woocommerce-checkout-payment {
  background: var(--ex-checkout-card);
  border: 1px solid var(--ex-checkout-border);
  border-radius: 18px;
  box-shadow: var(--ex-checkout-shadow);
}

body.woocommerce-checkout .wc-block-components-checkout-step,
body.woocommerce-checkout .wc-block-components-checkout-place-order {
  padding: 16px;
  margin-bottom: 14px;
}

body.woocommerce-checkout .wc-block-components-sidebar {
  padding: 16px;
}

@media (min-width: 960px) {
  body.woocommerce-checkout .wc-block-components-sidebar {
    position: sticky;
    top: 18px;
    align-self: start;
  }
}

/* Titles and body text */
body.woocommerce-checkout .wc-block-components-title,
body.woocommerce-checkout .wc-block-components-checkout-step__heading,
body.woocommerce-checkout .woocommerce-checkout h3 {
  color: var(--ex-checkout-text);
  font-weight: 700;
}

body.woocommerce-checkout .wc-block-components-checkout-step__description,
body.woocommerce-checkout .wc-block-components-checkout-step p,
body.woocommerce-checkout .wc-block-components-order-summary-item__description,
body.woocommerce-checkout .woocommerce-checkout label,
body.woocommerce-checkout .woocommerce-checkout .optional {
  color: var(--ex-checkout-muted);
}

/* Order summary row stability */
body.woocommerce-checkout .wc-block-components-order-summary-item {
  align-items: flex-start;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__image {
  flex: 0 0 auto;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__description {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__total-price {
  white-space: nowrap;
  font-weight: 700;
  color: var(--ex-checkout-text);
}

/* Inputs */
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input,
body.woocommerce-checkout .wc-block-components-textarea,
body.woocommerce-checkout .wc-block-components-country-input,
body.woocommerce-checkout .wc-block-components-select .wc-block-components-select__select,
body.woocommerce-checkout .wc-block-components-address-form input,
body.woocommerce-checkout .wc-block-components-address-form select,
body.woocommerce-checkout .woocommerce form .form-row input.input-text,
body.woocommerce-checkout .woocommerce form .form-row select,
body.woocommerce-checkout .woocommerce form .form-row textarea {
  background-color: #fff;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.42);
  min-height: 64px;
  box-shadow: none;
}

body.woocommerce-checkout .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input:focus,
body.woocommerce-checkout .wc-block-components-select .wc-block-components-select__select:focus,
body.woocommerce-checkout .woocommerce form .form-row input.input-text:focus,
body.woocommerce-checkout .woocommerce form .form-row select:focus,
body.woocommerce-checkout .woocommerce form .form-row textarea:focus {
  border-color: var(--ex-checkout-brand);
  box-shadow: 0 0 0 4px rgba(33, 87, 225, 0.12);
  outline: none;
}

body.woocommerce-checkout .wc-block-components-select .wc-block-components-select__container,
body.woocommerce-checkout .wc-block-components-text-input,
body.woocommerce-checkout .wc-block-components-combobox {
  margin-bottom: 14px;
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-customer-type-field {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 16px;
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-customer-type-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-customer-type-option {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.28);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 56px;
  padding: 12px 13px;
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-customer-type-option input[type="checkbox"] {
  accent-color: var(--ex-checkout-brand);
  height: 20px;
  margin: 0;
  width: 20px;
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-customer-type-option:has(input:checked) {
  background: #eef6ff;
  border-color: var(--ex-checkout-brand);
  box-shadow: 0 0 0 3px rgba(33, 87, 225, 0.11);
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-tax-id-field {
  margin: 0 0 18px;
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-tax-id-field label {
  color: var(--ex-checkout-text);
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
}

body.woocommerce-checkout .ex-checkout-customer-type .ex-tax-id-help {
  color: var(--ex-checkout-muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  margin-top: 8px;
}

body.woocommerce-checkout .ex-block-customer-type__native {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

body.woocommerce-checkout .ex-block-customer-type {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 16px;
}

body.woocommerce-checkout .ex-block-customer-type legend {
  color: var(--ex-checkout-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
  padding: 0;
}

body.woocommerce-checkout .ex-block-customer-type__grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.woocommerce-checkout .ex-block-customer-type__option {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.42);
  border-radius: 8px;
  color: var(--ex-checkout-ink);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  gap: 10px;
  line-height: 1.25;
  min-height: 56px;
  padding: 12px 13px;
}

body.woocommerce-checkout .ex-block-customer-type__option input[type="checkbox"] {
  accent-color: var(--ex-checkout-brand);
  height: 20px;
  margin: 0;
  min-height: 20px;
  min-width: 20px;
  pointer-events: none;
  width: 20px;
}

body.woocommerce-checkout .ex-block-customer-type__option.is-selected {
  background: #eef6ff;
  border-color: var(--ex-checkout-brand);
  box-shadow: 0 0 0 3px rgba(33, 87, 225, 0.11);
}

body.woocommerce-checkout .ex-block-customer-type__option:focus-within {
  border-color: var(--ex-checkout-brand);
  box-shadow: 0 0 0 4px rgba(33, 87, 225, 0.12);
}

body.woocommerce-checkout .ex-tax-id-block-field input::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

body.woocommerce-checkout .ex-tax-id-block-field label {
  background: #fff;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Payment choices */
body.woocommerce-checkout .wc-block-components-payment-method,
body.woocommerce-checkout .woocommerce-checkout-payment .payment_methods > li {
  padding: 12px;
}

/* Payment radios (solo Checkout Blocks): keep marker at left and shift labels to the right */
body.woocommerce-checkout .wp-block-woocommerce-checkout .wc-block-components-radio-control__option {
  padding: 12px 12px 12px 52px !important;
}

body.woocommerce-checkout .wp-block-woocommerce-checkout .wc-block-components-radio-control .wc-block-components-radio-control__input {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

/* Classic checkout fallback */
body.woocommerce-checkout .woocommerce-checkout-payment .payment_methods > li > label {
  display: block;
  padding-left: 30px;
  position: relative;
}

/* Classic checkout polish: checkboxes + Stripe box */
body.woocommerce-checkout .woocommerce form .form-row .input-checkbox,
body.woocommerce-checkout .woocommerce .woocommerce-form__input-checkbox,
body.woocommerce-checkout .woocommerce-checkout-payment input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0 10px 0 0;
  vertical-align: middle;
  accent-color: var(--ex-checkout-brand);
}

body.woocommerce-checkout .woocommerce form .create-account label,
body.woocommerce-checkout .woocommerce-checkout-payment .woocommerce-SavedPaymentMethods-saveNew {
  display: flex;
  align-items: center;
  gap: 0;
}

body.woocommerce-checkout .woocommerce-checkout-payment .payment_methods {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.woocommerce-checkout .woocommerce-checkout-payment .payment_methods > li > label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 8px 0;
}

body.woocommerce-checkout .woocommerce-checkout-payment .payment_box {
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: #f8fbff;
}

body.woocommerce-checkout .woocommerce-checkout-payment .payment_box fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

body.woocommerce-checkout .woocommerce-checkout-payment .payment_box .form-row {
  margin-bottom: 10px;
}

/* Primary action */
body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout button#place_order,
body.woocommerce-checkout .woocommerce button.button.alt {
  border-radius: 14px;
  background: var(--ex-checkout-brand);
  border-color: var(--ex-checkout-brand);
  color: #fff;
  font-weight: 700;
  min-height: 48px;
}

body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover,
body.woocommerce-checkout button#place_order:hover,
body.woocommerce-checkout .woocommerce button.button.alt:hover {
  background: #1b48bf;
  border-color: #1b48bf;
}

/* Mobile tweaks */
@media (max-width: 959px) {
  body.woocommerce-checkout .wp-block-woocommerce-checkout,
  body.woocommerce-checkout .woocommerce {
    margin: 14px auto;
    padding: 0 10px;
  }

  body.woocommerce-checkout .wc-block-components-sidebar-layout {
    gap: 14px;
  }
}

/* Guest checkout (sin suscripcion/sin sesion): Stripe sin caja, estilo titulo */
body.woocommerce-checkout:not(.logged-in) .woocommerce-checkout-payment,
body.woocommerce-checkout:not(.logged-in) .woocommerce-checkout-payment .payment_methods,
body.woocommerce-checkout:not(.logged-in) .woocommerce-checkout-payment .payment_methods > li {
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.woocommerce-checkout:not(.logged-in) .woocommerce-checkout-payment .payment_methods > li {
  padding: 0;
}

body.woocommerce-checkout:not(.logged-in) .woocommerce-checkout-payment .payment_methods > li > label {
  padding: 0 0 10px 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--ex-checkout-text);
  background: transparent;
  border: 0;
}

body.woocommerce-checkout:not(.logged-in) .woocommerce-checkout-payment .payment_box {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-top: 6px;
}
