
/* ===== ORIGEM: SNIPPET 52 ===== */
/* ============================================
           1. TIPO DE PESSOA
           ============================================ */

        #billing_persontype_field.footure-v27-ready
        > .select2-container {
            display: none !important;
        }

        #billing_persontype_field.footure-v27-ready
        > select#billing_persontype {
            position: absolute !important;
            width: 1px !important;
            height: 1px !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }

        #billing_persontype_field.footure-v27-ready {
            width: 100% !important;
            max-width: 100% !important;
            float: none !important;
            clear: both !important;
            margin: 0 !important;
        }

        #billing_persontype_field .footure-v27-options {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
            width: 100%;
            margin-top: 8px;
        }

        #billing_persontype_field .footure-v27-option {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 7px;
            min-width: 0;
            min-height: 76px;
            padding: 12px 8px;
            border: 1px solid #d5e0e8;
            border-radius: 9px;
            background: #fff;
            color: #203247;
            font: inherit;
            font-size: 12px;
            font-weight: 600;
            line-height: 1.35;
            text-align: center;
            cursor: pointer;
            transition:
                border-color .15s ease,
                background-color .15s ease;
        }

        #billing_persontype_field .footure-v27-option:hover {
            border-color: #20b7a5;
        }

        #billing_persontype_field .footure-v27-option.is-selected {
            border-color: #16a58f;
            background: #f0faf7;
            color: #143c37;
        }

        #billing_persontype_field .footure-v27-option:focus-visible {
            outline: 2px solid #20b7a5;
            outline-offset: 2px;
        }

        #billing_persontype_field .footure-v27-option svg {
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 1.8;
            stroke-linecap: round;
            stroke-linejoin: round;
            flex-shrink: 0;
        }

        /* ============================================
           2. ESPAÇAMENTO GERAL DOS CAMPOS
           ============================================ */

        .woocommerce-billing-fields__field-wrapper {
            display: flex !important;
            flex-wrap: wrap !important;
            row-gap: 12px !important;
            column-gap: 12px !important;
            align-items: flex-start !important;
        }

        .woocommerce-billing-fields__field-wrapper
        > .form-group {
            box-sizing: border-box !important;
            min-width: 0 !important;
            margin-top: 0 !important;
            margin-bottom: 0 !important;
            float: none !important;
        }

        .woocommerce-billing-fields__field-wrapper
        > .footure-phone-row {
            box-sizing: border-box !important;
            min-width: 0 !important;
            margin-top: 0 !important;
            margin-bottom: 0 !important;
        }

        /* ============================================
           3. DESKTOP – DISTRIBUIÇÃO DAS COLUNAS
           ============================================ */

        @media (min-width: 768px) {

            .woocommerce-billing-fields__field-wrapper
            > .form-group {
                flex-grow: 0 !important;
                flex-shrink: 0 !important;
                max-width: none !important;
                clear: none !important;
            }

            /* Tipo de Pessoa */
            #billing_persontype_field {
                flex: 0 0 100% !important;
                width: 100% !important;
            }

            /* Nome / Sobrenome – 50% / 50% */
            #billing_first_name_field,
            #billing_last_name_field {
                flex-basis: calc((100% - 12px) / 2) !important;
                width: calc((100% - 12px) / 2) !important;
            }

            /* CPF – meia linha */
            #billing_cpf_field {
                flex-basis: calc((100% - 12px) / 2) !important;
                width: calc((100% - 12px) / 2) !important;
            }

            /* Empresa / CNPJ – 60% / 40% */
            #billing_company_field {
                flex-basis: calc((100% - 12px) * .60) !important;
                width: calc((100% - 12px) * .60) !important;
            }

            #billing_cnpj_field {
                flex-basis: calc((100% - 12px) * .40) !important;
                width: calc((100% - 12px) * .40) !important;
            }

            /* País / CEP – 70% / 30% */
            #billing_country_field {
                flex-basis: calc((100% - 12px) * .70) !important;
                width: calc((100% - 12px) * .70) !important;
            }

            #billing_postcode_field {
                flex-basis: calc((100% - 12px) * .30) !important;
                width: calc((100% - 12px) * .30) !important;
            }

            /* Endereço / Número / Complemento */
            #billing_address_1_field {
                flex-basis: calc((100% - 24px) * .50) !important;
                width: calc((100% - 24px) * .50) !important;
            }

            #billing_number_field {
                flex-basis: calc((100% - 24px) * .15) !important;
                width: calc((100% - 24px) * .15) !important;
            }

            #billing_address_2_field {
                flex-basis: calc((100% - 24px) * .35) !important;
                width: calc((100% - 24px) * .35) !important;
            }

            /* Bairro / Cidade / Estado */
            #billing_neighborhood_field {
                flex-basis: calc((100% - 24px) * .30) !important;
                width: calc((100% - 24px) * .30) !important;
            }

            #billing_city_field,
            #billing_state_field {
                flex-basis: calc((100% - 24px) * .35) !important;
                width: calc((100% - 24px) * .35) !important;
            }

            /* Preserva DDI / Telefone / E-mail */
            .woocommerce-billing-fields__field-wrapper
            > .footure-phone-row {
                flex: 0 0 100% !important;
                width: 100% !important;
            }
        }

        /* ============================================
           4. MOBILE
           ============================================ */

        @media (max-width: 767px) {

            .woocommerce-billing-fields__field-wrapper {
                row-gap: 12px !important;
                column-gap: 12px !important;
            }

            .woocommerce-billing-fields__field-wrapper
            > .form-group {
                margin-top: 0 !important;
                margin-bottom: 0 !important;
            }

            #billing_persontype_field {
                flex: 0 0 100% !important;
                width: 100% !important;
                max-width: 100% !important;
            }

            #billing_persontype_field .footure-v27-options {
                gap: 6px;
            }

            #billing_persontype_field .footure-v27-option {
                min-height: 72px;
                padding: 9px 4px;
                font-size: 11px;
            }

            #billing_persontype_field .footure-v27-option svg {
                width: 18px;
                height: 18px;
            }

            /* Mantém Nome e Sobrenome lado a lado */
            #billing_first_name_field,
            #billing_last_name_field {
                flex: 0 0 calc((100% - 12px) / 2) !important;
                width: calc((100% - 12px) / 2) !important;
                max-width: none !important;
            }

            /* Campos de identificação e endereço */
            #billing_cpf_field,
            #billing_company_field,
            #billing_cnpj_field,
            #billing_country_field,
            #billing_postcode_field,
            #billing_address_1_field,
            #billing_state_field {
                flex: 0 0 100% !important;
                width: 100% !important;
                max-width: 100% !important;
            }

            /* Número / Complemento */
            #billing_number_field,
            #billing_address_2_field {
                flex: 0 0 calc((100% - 12px) / 2) !important;
                width: calc((100% - 12px) / 2) !important;
                max-width: none !important;
            }

            /* Bairro / Cidade */
            #billing_neighborhood_field,
            #billing_city_field {
                flex: 0 0 calc((100% - 12px) / 2) !important;
                width: calc((100% - 12px) / 2) !important;
                max-width: none !important;
            }

            /* Preserva o contêiner de telefone */
            .woocommerce-billing-fields__field-wrapper
            > .footure-phone-row {
                flex: 0 0 100% !important;
                width: 100% !important;
                max-width: 100% !important;
            }
        }

        /* ============================================
           5. SELECT2 – ESTADO
           ============================================ */

        #billing_state_field .select2-container {
            width: 100% !important;
            max-width: 100% !important;
        }


        /* V2.8.8: incorpora o refinamento do antigo snippet 53. */
        body.woocommerce-checkout #customer_details
        .woocommerce-billing-fields .form-row > label {
            margin-bottom: 5px !important;
            line-height: 1.4 !important;
        }
        body.woocommerce-checkout #customer_details
        .woocommerce-billing-fields input.input-text,
        body.woocommerce-checkout #customer_details
        .woocommerce-billing-fields select,
        body.woocommerce-checkout #customer_details
        .woocommerce-billing-fields .select2-selection {
            min-height: 42px !important;
            border-radius: 7px !important;
            box-sizing: border-box !important;
        }
        body.woocommerce-checkout #customer_details
        .woocommerce-billing-fields .form-row input.input-text {
            max-width: 100% !important;
            box-sizing: border-box !important;
        }
        #billing_state_field .select2-container .select2-selection--single {
            width: 100% !important;
            box-sizing: border-box !important;
        }
        #billing_state_field .select2-selection__rendered {
            line-height: 40px !important;
        }
