/* PhoneInputField — Metronic/Bootstrap input-group. The country dropdown button and the number input form a
   SINGLE joined field on one line: the input-group gives them the shared rounded border natively, so no CSS
   targets MudBlazor internals anymore. Only the Blazor-managed country dropdown menu needs positioning here.
   Global sheet (linked from index.html) — this project does NOT wire the scoped-CSS bundle. */

.phone-input-group {
    position: relative;
    flex-wrap: nowrap;
}

.phone-country-toggle {
    white-space: nowrap;
}

/* ---- Match the sibling MudBlazor Outlined/Dense fields ------------------------------------------------
   Drive the button + input off MudBlazor's own CSS variables so the phone field reads as part of the same
   form (soft-grey fill, MudBlazor typography, input-line border, MudBlazor radius, dense height) rather than
   a raw Bootstrap control (Inter font / white fill / Bootstrap border). */
.phone-input-group .phone-country-toggle,
.phone-input-group .form-control {
    font-family: var(--mud-typography-input-family, var(--mud-typography-body1-family, "Roboto", "Helvetica Neue", Arial, sans-serif));
    font-size: var(--mud-typography-body1-size, 1rem);
    color: var(--mud-palette-text-primary, inherit);
    background-color: var(--mud-palette-background-grey, #f5f5f5);
    border: 1px solid var(--mud-palette-lines-inputs, rgba(0, 0, 0, 0.23));
    min-height: 40px;
}

/* Rounded OUTER corners (MudBlazor radius), SQUARE inner corners where the two meet — !important to beat
   Bootstrap's own input-group radius rules. Flag button = left item, number input = right item. */
.phone-input-group .phone-country-toggle {
    border-right: 0;
    border-top-left-radius: var(--mud-default-borderradius, 4px) !important;
    border-bottom-left-radius: var(--mud-default-borderradius, 4px) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.phone-input-group .form-control {
    border-top-right-radius: var(--mud-default-borderradius, 4px) !important;
    border-bottom-right-radius: var(--mud-default-borderradius, 4px) !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.phone-country-toggle:hover:not(:disabled) {
    background-color: var(--mud-palette-action-default-hover, rgba(0, 0, 0, 0.04));
}

/* MudBlazor-like focus: highlight the whole group, no Bootstrap glow. */
.phone-input-group:focus-within .phone-country-toggle,
.phone-input-group:focus-within .form-control {
    border-color: var(--mud-palette-primary, #594ae2);
}

.phone-input-group .form-control:focus {
    box-shadow: none;
    background-color: var(--mud-palette-background-grey, #f5f5f5);
}

/* Error state mirrors MudBlazor's red outline across the whole group. */
.phone-input-group .form-control.is-invalid {
    border-color: var(--mud-palette-error, #f44336);
    background-image: none;
}

.phone-input-group:has(.form-control.is-invalid) .phone-country-toggle {
    border-color: var(--mud-palette-error, #f44336);
}

/* Country list: anchored under the group, Blazor-managed open state, MudBlazor typography. */
.phone-country-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1050;
    min-width: 260px;
    max-height: 280px;
    overflow-y: auto;
    font-family: var(--mud-typography-body1-family, "Roboto", "Helvetica Neue", Arial, sans-serif);
}

.phone-country-menu .dropdown-item {
    cursor: pointer;
}

/* Full-viewport transparent layer that closes the menu on an outside click (below the menu, above the rest). */
.phone-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}
