/**
 * International phone input — Apple-inspired, profile-form aligned.
 */

.profile-container .profile-form-group__body .intl-phone-input {
    background: var(--sf-bg);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px var(--sf-separator);
    min-height: 38px;
    align-items: stretch;
}

.profile-container .profile-form-group__body .intl-phone-input:focus-within {
    background: var(--sf-bg);
    box-shadow:
        inset 0 0 0 1px rgba(0, 122, 255, 0.4),
        0 0 0 3px rgba(0, 122, 255, 0.1);
}

body.profile-page .profile-form-group__body .intl-phone-input {
    border-radius: 10px;
    background: var(--color-control);
    box-shadow: inset 0 0 0 1px var(--color-border-subtle);
    min-height: 46px;
}

body.profile-page .profile-form-group__body .intl-phone-input:focus-within {
    background: var(--color-surface);
    box-shadow:
        inset 0 0 0 1.5px var(--primary),
        0 0 0 4px var(--primary-light);
}

body.profile-page .profile-form-group__body .intl-phone-input__number {
    font-size: 17px;
    letter-spacing: -0.022em;
    color: var(--color-text);
}

body.profile-page .profile-form-group__body .intl-phone-input__number::placeholder {
    color: var(--color-text-faint);
}

body.profile-page .profile-form-group__body .intl-phone-input__dial {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text);
}

body.profile-page .profile-form-field--error .intl-phone-input.is-invalid {
    background: rgb(255 59 48 / 6%);
    box-shadow:
        inset 0 0 0 1.5px rgb(255 59 48 / 62%),
        0 0 0 4px rgb(255 59 48 / 10%);
}

body.profile-page .profile-form-field--error .intl-phone-input.is-invalid:focus-within {
    background: var(--color-surface);
    box-shadow:
        inset 0 0 0 1.5px rgb(255 59 48 / 72%),
        0 0 0 4px rgb(255 59 48 / 14%);
}

body.profile-page .profile-form-field--error .intl-phone-input__error {
    color: #d70015;
    font-weight: 500;
}

.profile-container .profile-form-group__body .intl-phone-input__code {
    padding: 0.4375rem 0.5rem 0.4375rem 0.625rem;
    border-radius: 8px 0 0 8px;
    font-size: 14px;
    gap: 0.3125rem;
}

.profile-container .profile-form-group__body .intl-phone-input__flag {
    width: 20px;
    height: 14px;
}

.profile-container .profile-form-group__body .intl-phone-input__flag .flag-icon {
    transform: scale(1.08);
}

.profile-container .profile-form-group__body .intl-phone-input__dial {
    min-width: 1.875rem;
}

.profile-container .profile-form-group__body .intl-phone-input__chevron {
    font-size: 10px;
}

.profile-container .profile-form-group__body .intl-phone-input__number {
    padding: 0.4375rem 0.625rem 0.4375rem 0.5rem;
    border-radius: 0 8px 8px 0;
    font-size: 15px;
    text-align: left;
}

.profile-container .intl-phone-input-host {
    margin: 0;
}

.profile-container .intl-phone-input-host .intl-phone-input__error {
    padding: 0 0 0.25rem;
}

.profile-container .intl-phone-input {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: var(--sf-radius-field);
    background: var(--sf-fill);
    box-shadow: inset 0 0 0 1px transparent;
    transition:
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.profile-container .intl-phone-input:focus-within {
    background: var(--sf-bg);
    box-shadow:
        0 0 0 3px rgba(0, 194, 168, 0.14),
        inset 0 0 0 1px rgba(0, 194, 168, 0.22);
}

.profile-container .intl-phone-input.is-invalid {
    box-shadow:
        0 0 0 3px rgba(255, 59, 48, 0.12),
        inset 0 0 0 1px rgba(255, 59, 48, 0.35);
}

.profile-container .intl-phone-input.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.profile-container .intl-phone-input__code {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0.75rem 0.625rem 0.75rem 0.875rem;
    border: none;
    border-right: 1px solid var(--sf-separator);
    border-radius: var(--sf-radius-field) 0 0 var(--sf-radius-field);
    background: transparent;
    color: var(--sf-text);
    font-family: var(--sf-font);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.profile-container .intl-phone-input__code:hover {
    background: var(--color-control-hover);
}

.profile-container .intl-phone-input__code:focus-visible {
    outline: none;
    background: rgba(0, 194, 168, 0.08);
}

.profile-container .intl-phone-input__flag {
    display: inline-flex;
    width: 22px;
    height: 16px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.profile-container .intl-phone-input__flag .flag-icon {
    transform: scale(1.15);
}

.profile-container .intl-phone-input__placeholder-flag {
    display: inline-block;
    width: 22px;
    height: 16px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--color-control), var(--color-surface-strong));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.profile-container .intl-phone-input.is-unknown-region .intl-phone-input__dial {
    color: var(--sf-label);
}

.profile-container .intl-phone-input__dial {
    min-width: 2.25rem;
    text-align: left;
    white-space: nowrap;
}

.profile-container .intl-phone-input__chevron {
    color: var(--sf-label);
    font-size: 11px;
    line-height: 1;
}

.profile-container .intl-phone-input__number {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0.75rem 0.875rem 0.75rem 0.75rem;
    border: none;
    border-radius: 0 var(--sf-radius-field) var(--sf-radius-field) 0;
    background: transparent;
    color: var(--sf-text);
    font-family: var(--sf-font);
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.022em;
}

.profile-container .intl-phone-input__number::placeholder {
    color: var(--color-text-faint);
}

.profile-container .intl-phone-input__number:focus {
    outline: none;
}

.profile-container .intl-phone-input__hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.profile-container .intl-phone-input__error {
    margin-top: 0.375rem;
    font-family: var(--sf-font);
    font-size: 12px;
    line-height: 1.35;
    color: #ff3b30;
}

.intl-phone-menu {
    position: fixed;
    z-index: 10200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    background: var(--color-surface-glass-strong);
    box-shadow: var(--shadow-surface-lg);
    backdrop-filter: blur(20px);
}

.intl-phone-menu__search-wrap {
    padding: 0.625rem 0.75rem 0.5rem;
    border-bottom: 1px solid var(--sf-separator, rgba(60, 60, 67, 0.14));
}

.intl-phone-menu__search {
    width: 100%;
    margin: 0;
    padding: 0.625rem 0.75rem;
    border: none;
    border-radius: 10px;
    background: var(--color-control);
    color: var(--color-text);
    font-family: -apple-system, blinkmacsystemfont, "SF Pro Text", system-ui, sans-serif;
    font-size: 16px;
}

.intl-phone-menu__search:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.14);
}

.intl-phone-menu__options {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.25rem;
}

.intl-phone-menu__option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--color-text);
    font-family: -apple-system, blinkmacsystemfont, "SF Pro Text", system-ui, sans-serif;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.intl-phone-menu__option:hover,
.intl-phone-menu__option:focus-visible {
    background: rgba(0, 194, 168, 0.08);
    outline: none;
}

.intl-phone-menu__option-flag {
    flex-shrink: 0;
}

.intl-phone-menu__option-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.intl-phone-menu__option-dial {
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.intl-phone-menu__empty {
    padding: 1rem 0.75rem;
    color: var(--color-text-muted);
    font-family: -apple-system, blinkmacsystemfont, "SF Pro Text", system-ui, sans-serif;
    font-size: 14px;
    text-align: center;
}

.intl-phone-sheet {
    position: fixed;
    inset: 0;
    z-index: 10200;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.intl-phone-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: none;
    background: var(--color-overlay);
    cursor: pointer;
}

.intl-phone-sheet__panel {
    position: relative;
    display: flex;
    max-height: min(78vh, 560px);
    flex-direction: column;
    border-radius: 18px 18px 0 0;
    background: var(--color-surface-raised);
    box-shadow: var(--shadow-surface-lg);
}

.intl-phone-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem 0.5rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

.intl-phone-sheet__title {
    font-family: -apple-system, blinkmacsystemfont, "SF Pro Display", system-ui, sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text);
}

.intl-phone-sheet__done {
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--primary, #00c2a8);
    font-family: -apple-system, blinkmacsystemfont, "SF Pro Text", system-ui, sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 767px) {
    .profile-container .intl-phone-input:focus-within,
    .profile-container .profile-form-group__body .intl-phone-input:focus-within {
        box-shadow: inset 0 0 0 1px rgba(0, 194, 168, 0.45);
    }

    .profile-container .intl-phone-input__number,
    .profile-container .profile-form-group__body .intl-phone-input__number {
        font-size: 16px;
        touch-action: manipulation;
    }

    .profile-container .intl-phone-input__code {
        padding-left: 0.75rem;
        font-size: 16px;
        touch-action: manipulation;
    }
}
