.woocommerce-checkout .psgc-checkout-field label {
    font-weight: 600;
}

.woocommerce-checkout .psgc-input {
    min-height: 44px;
}

/* Layout estable para shortcode clásico dentro de Elementor */
body.psgc-checkout-ready #customer_details.psgc-reordered {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Ocultamos el checkbox nativo de WooCommerce, pero forzamos envío por JS/PHP */
body.psgc-checkout-ready #ship-to-different-address {
    display: none !important;
}

/* Evita duplicar nombre/apellidos/teléfono en envío; se sincronizan desde contacto. */
.woocommerce-checkout .psgc-shipping-recipient-field {
    display: none !important;
}

/* Detalles de venta va fuera de facturación, después de dirección de envío. */
.psgc-order-details-section {
    margin-top: 24px;
}

/* Facturación va después de detalles de venta. */
.psgc-invoice-section {
    margin-top: 24px;
    padding-top: 8px;
}

.psgc-invoice-section__title {
    margin: 0 0 16px;
}

#billing_requires_invoice_field,
#billing_fiscal_address_different_field {
    padding: 14px 16px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fafafa;
    margin-top: 14px;
}

/* Por defecto, todo lo fiscal queda oculto. */
.woocommerce-checkout .psgc-fiscal-field,
.woocommerce-checkout .psgc-billing-address-field {
    display: none !important;
}

/* Al pedir factura, se muestran fiscales y el checkbox de dirección fiscal distinta. */
body.psgc-invoice-required .psgc-fiscal-field {
    display: block !important;
}

/* La dirección fiscal solo se muestra cuando explícitamente es diferente. */
body.psgc-invoice-required.psgc-fiscal-address-different .psgc-billing-address-field {
    display: block !important;
}

/* El checkbox Requiero factura siempre debe verse en la sección final. */
#billing_requires_invoice_field {
    display: block !important;
}

/* Limpieza de columnas WooCommerce. */
.woocommerce-checkout .col2-set .col-1,
.woocommerce-checkout .col2-set .col-2 {
    float: none;
    width: 100%;
}

.woocommerce-checkout .form-row-first,
.woocommerce-checkout .form-row-last {
    max-width: 100%;
}

@media (max-width: 768px) {
    .woocommerce-checkout .form-row-first,
    .woocommerce-checkout .form-row-last {
        width: 100% !important;
        float: none !important;
    }
}


/* Detalles de venta: fuera de facturación y limitado por JS/PHP. */
.psgc-order-details-section #order_comments_field {
    display: block !important;
    margin-bottom: 14px;
}

.psgc-order-details-section #order_comments {
    min-height: 44px;
    resize: none;
    overflow: hidden;
}

body:not(.psgc-invoice-required) .psgc-fiscal-field,
body:not(.psgc-invoice-required) .psgc-billing-address-field {
    display: none !important;
}

/* Dirección fiscal diferente es subopción de Requiero factura. */
body:not(.psgc-invoice-required) #billing_fiscal_address_different_field {
    display: none !important;
}

body.psgc-invoice-required #billing_fiscal_address_different_field {
    display: block !important;
    margin-left: 18px;
    border-style: dashed;
}

body.psgc-invoice-required #billing_fiscal_address_different_field::before {
    content: "Subopción de facturación";
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .65;
}


/* Refuerzo fuerte para controlar visibilidad desde JS aunque queden clases antiguas o cacheadas. */
.woocommerce-checkout .psgc-force-hidden {
    display: none !important;
}

/* Los checkboxes de facturación no deben mostrar texto (opcional). */
#billing_requires_invoice_field .optional,
#billing_fiscal_address_different_field .optional {
    display: none !important;
}


/* CUDIBA 1.4.1 - refuerzo visual fuerte para facturación. */
.woocommerce-checkout #billing_fiscal_address_different_field.psgc-force-hidden,
.woocommerce-checkout .psgc-force-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

body.woocommerce-checkout:not(.psgc-invoice-required) #billing_fiscal_address_different_field,
body.woocommerce-checkout:not(.psgc-invoice-required) .psgc-billing-address-field,
body.woocommerce-checkout:not(.psgc-invoice-required) .psgc-fiscal-field:not(.psgc-invoice-toggle-field) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.woocommerce-checkout #billing_requires_invoice_field .optional,
.woocommerce-checkout #billing_fiscal_address_different_field .optional {
    display: none !important;
    visibility: hidden !important;
}


/* CUDIBA 1.4.2 - bloqueo visual definitivo para facturación. */
.woocommerce-checkout .psgc-142-hidden,
.woocommerce-checkout .psgc-force-hidden,
body.woocommerce-checkout:not(.psgc-invoice-required) #billing_fiscal_address_different_field,
body.woocommerce-checkout:not(.psgc-invoice-required) .psgc-fiscal-field:not(.psgc-invoice-toggle-field),
body.woocommerce-checkout:not(.psgc-invoice-required) .psgc-billing-address-field {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

body.woocommerce-checkout.psgc-invoice-required #billing_fiscal_address_different_field {
    display: block !important;
}

.woocommerce-checkout #billing_requires_invoice_field .optional,
.woocommerce-checkout #billing_fiscal_address_different_field .optional {
    display: none !important;
    visibility: hidden !important;
}
