/* ======================================================================
   CYMART V16.55 — SERVICE MODAL IMEI FIELD STABILITY
   Fixes the regression introduced by older mobile overrides that forced
   every .form-control inside #modal-order to width:100% and allowed the
   IMEI flex row to wrap. The checksum digit field must remain a compact
   50px field beside the main 14-digit IMEI field on all viewport sizes.
   ====================================================================== */

/* Base guard (desktop + mobile): keep the native IMEI pair on one row. */
html body #modal-order .input-imei > .d-flex {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
}

html body #modal-order .input-imei > .d-flex > #imei1 {
    display: block !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
}

html body #modal-order .input-imei > .d-flex > #imei2 {
    display: block !important;
    flex: 0 0 50px !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    text-align: center !important;
}

/* Some services expose the optional ADD button in the same row. */
html body #modal-order .input-imei > .d-flex > #IMEI_ADD {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 120px !important;
    min-height: 46px !important;
    margin: 0 !important;
}

/* Explicitly neutralize V16.16/V16.17 mobile rules that made both inputs
   100% wide and stacked. Keep the modal itself responsive/full width. */
@media (max-width: 991.98px) {
    html body #modal-order .input-imei > .d-flex {
        flex-wrap: nowrap !important;
    }

    html body #modal-order .input-imei > .d-flex > input.form-control#imei1 {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 46px !important;
        min-height: 46px !important;
        margin: 0 !important;
    }

    html body #modal-order .input-imei > .d-flex > input.form-control#imei2 {
        flex: 0 0 50px !important;
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        height: 46px !important;
        min-height: 46px !important;
        margin: 0 !important;
    }
}

/* Very narrow phones: preserve the same structure but trim the gap. */
@media (max-width: 390px) {
    html body #modal-order .input-imei > .d-flex {
        gap: 6px !important;
    }

    html body #modal-order .input-imei > .d-flex > #imei2 {
        flex-basis: 46px !important;
        width: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
    }
}
