/*
 * Babli Fashion Point — My Account > Addresses form: col-md-6 grid + checkout-identical style.
 * Additive only; loads after bfp-account-forms-signup.css and bfp-account-grid-v2.css.
 * Scope: the billing/shipping address editor (.woocommerce-address-fields) on /my-account/.
 *
 * Goal: every field sits two-per-row (col-md-6 / col-md-6) and every control matches the
 * Checkout Contact/Billing card EXACTLY - same label, same 40px shell, same radius/colors,
 * same select with chevron, same focus/hover, same red required star.
 * Does not touch the checkout, the Account Details form, or any other page.
 */

/* ---- Layout: the field wrapper becomes a two-column grid (all fields col-md-6). ---- */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields__field-wrapper {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 16px !important;
    row-gap: 14px !important;
    align-items: start !important;
}
/* Neutralise the theme's floats / nth-child pairing and force one column each. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields__field-wrapper .form-row {
    float: none !important;
    clear: none !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    grid-column: span 1 !important;
    min-width: 0 !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields__field-wrapper .form-row:nth-child(even),
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields__field-wrapper .form-row:nth-child(odd) {
    grid-column: span 1 !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .clear {
    display: none !important;
}

/* ---- Label: same as checkout (13px, 700, dark, above the control). ---- */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .form-row label {
    display: block !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
    color: #292523 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    overflow-wrap: anywhere !important;
}
/* Required star: same red as checkout. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .form-row label .required,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .form-row abbr.required {
    color: #e02b2b !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    border: 0 !important;
}

/* ---- Controls: identical shell to the checkout card. ---- */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields textarea {
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 13px !important;
    border: 1.33px solid #ece6e2 !important;
    border-radius: 11px !important;
    background: #faf8f7 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #25211f !important;
    line-height: normal !important;
    box-shadow: none !important;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}
/* Select: room for the chevron + the same chevron as checkout. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select {
    padding: 0 38px 0 13px !important;
    line-height: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2377716e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 14px 14px !important;
    background-color: #faf8f7 !important;
    cursor: pointer !important;
}
/* Textarea keeps a natural height like checkout. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields textarea {
    height: auto !important;
    min-height: 90px !important;
    padding: 10px 13px !important;
}
/* Hover + focus: identical to checkout. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):hover,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select:hover,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields textarea:hover {
    border-color: #dcd3cd !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select:focus,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields textarea:focus {
    outline: none !important;
    border-color: #ff4b1f !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(255, 75, 31, .11) !important;
}

/* ---- Submit button: same as the login/signup / checkout primary. ---- */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields button[type="submit"],
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .woocommerce-Button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-height: 48px !important;
    height: auto !important;
    margin-top: 4px !important;
    padding: 14px 22px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: linear-gradient(180deg, #ff5a2f, #ed3e15) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    box-shadow: 0 6px 16px rgba(237, 62, 21, .22) !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields button[type="submit"]:hover,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .woocommerce-Button:hover {
    background: linear-gradient(180deg, #ff6a41, #ff4b1f) !important;
}

/* ---- Mobile: one column. ---- */
@media (max-width: 767px) {
    body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields__field-wrapper {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields__field-wrapper .form-row {
        grid-column: 1 !important;
    }
}
/* ============================================================================
   v2 fixes
   ==========================================================================*/

/* WC wraps every control in <span class="woocommerce-input-wrapper">. Make it a
   full-width block so controls fill their grid cell. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .form-row .woocommerce-input-wrapper {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Address line 2 (Apartment): guarantee the label renders ABOVE the field, like
   every other row, with the same 13px/700 dark styling. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    margin: 0 0 6px !important;
    color: #292523 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}
/* The "(optional)" marker should read as light meta text, not part of the label. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .form-row label .optional {
    color: #77716e !important;
    font-weight: 600 !important;
}

/* ---- Phone field: single box (the JS shell owns the border, like checkout). ----
   The account-area phone shell (.bfp-phone-shell, created by bfp-account-fields.js)
   already draws the box + the +91 prefix. Strip our own border/background from the
   input inside it so there is no double box. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .bfp-phone-shell input,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .bfp-phone-shell input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
    width: auto !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 13px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .bfp-phone-shell input:focus {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
/* Give the shell the same height/margins as the other controls. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .bfp-phone-shell {
    margin: 0 !important;
    height: 40px !important;
}

/* ---- State / Country selects: force the checkout look even over selectWoo. ---- */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select.state_select,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields select.country_to_state {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 38px 0 13px !important;
    border: 1.33px solid #ece6e2 !important;
    border-radius: 11px !important;
    background-color: #faf8f7 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2377716e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 14px 14px !important;
    color: #25211f !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-overflow: ellipsis !important;
}
/* selectWoo / select2 containers (if the theme initialises them) inherit the box. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container .select2-selection--single {
    height: 40px !important;
    border: 1.33px solid #ece6e2 !important;
    border-radius: 11px !important;
    background: #faf8f7 !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    color: #25211f !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding-left: 13px !important;
}

/* ============================================================================
   v3: WC renders address_2's label with class "screen-reader-text" (visually
   hidden) because it is optional, and moves the text into the placeholder.
   The client wants the label VISIBLE above the field, like every other row.
   ==========================================================================*/
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .form-row > label.screen-reader-text {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    border: 0 !important;
    display: block !important;
    visibility: visible !important;
    color: #292523 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}
/* The placeholder is now redundant with a visible label - hide it. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2 {
    /* keep any real value readable; just stop the duplicate hint text */
    text-overflow: ellipsis !important;
}

/* Hide the now-duplicate placeholder text on the address_2 fields (label shows it). */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2::placeholder,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

/* ============================================================================
   v4: (1) Apartment label without "(optional)" + show its placeholder again.
       (2) State/Country: if selectWoo still wraps them, style the widget to match
           the plain field (the JS normally removes it entirely).
   ==========================================================================*/

/* (1) Apartment: drop the "(optional)" suffix and restore the grey placeholder. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label .optional,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label .optional {
    display: none !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2::placeholder,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2::placeholder {
    color: #9c958f !important;
    opacity: 1 !important;
}

/* (2) selectWoo/select2 fallback skin (only if the widget is still present). */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container {
    width: 100% !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container .select2-selection--single {
    height: 40px !important;
    min-height: 40px !important;
    border: 1.33px solid #ece6e2 !important;
    border-radius: 11px !important;
    background: #faf8f7 !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    padding-left: 13px !important;
    color: #25211f !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
    right: 8px !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container--focus .select2-selection--single,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields .select2-container--open .select2-selection--single {
    border-color: #ff4b1f !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(255, 75, 31, .11) !important;
}

/* v4b: the client prefers the ORIGINAL WooCommerce behaviour on the apartment
   field — a grey PLACEHOLDER inside the box, no visible label above. Undo the
   v3 label-forcing for address_2 (label stays screen-reader-only as WC intended). */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================================================
   v5: client wants the Apartment (address_2) LABEL visible above the field.
   v4b hid it (placeholder style); v5 brings the label back and hides the
   now-duplicate placeholder text.
   ==========================================================================*/
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    border: 0 !important;
    display: block !important;
    visibility: visible !important;
    color: #292523 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}
/* Hide the duplicate placeholder now that the label shows the same text. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2::placeholder,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

/* ============================================================================
   v6: client wants the Apartment (address_2) PLACEHOLDER visible again (not the
   label). Undo v5's label-forcing: hide the label and show the grey placeholder.
   ==========================================================================*/
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2::placeholder,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2::placeholder {
    color: #9c958f !important;
    opacity: 1 !important;
}

/* ============================================================================
   v7: client wants BOTH — the Apartment label ABOVE the field AND the grey
   placeholder INSIDE it, at the same time.
   ==========================================================================*/
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    border: 0 !important;
    display: block !important;
    visibility: visible !important;
    color: #292523 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}
/* Show the "(optional)" marker lightly next to the label. */
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #shipping_address_2_field > label .optional,
body.woocommerce-account .woocommerce-MyAccount-content .woocommerce-address-fields #billing_address_2_field > label .optional {
    display: inline !important;
    color: #77716e !important;
    font-weight: 600 !important;
}
