/**
 * Profile country picker — matches profile-form input shells (iOS Settings style).
 */

.profile-country-field {
    width: 100%;
}

.profile-country-field__picker {
    width: 100%;
}

.profile-form-field .profile-country-field__trigger {
    width: 100%;
    height: auto;
    min-height: 38px;
    margin: 0;
    padding: 0.5rem 0.625rem;
    gap: 0.5rem;
    border: none;
    border-radius: 8px;
    background: var(--sf-bg);
    color: var(--sf-text);
    font-family: var(--sf-font);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: -0.018em;
    line-height: 1.3;
    box-shadow: inset 0 0 0 1px var(--sf-separator);
    transition:
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.profile-form-field .profile-country-field__trigger:hover {
    box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

.profile-form-field .profile-country-field__trigger:focus-visible,
.profile-country-field__picker.is-open .profile-country-field__trigger {
    outline: none;
    box-shadow:
        inset 0 0 0 1px #00c2a8,
        0 0 0 3px rgba(0, 194, 168, 0.14);
}

.profile-form-field .profile-country-field.is-invalid .profile-country-field__trigger,
.profile-form-field .profile-country-field__trigger.is-invalid {
    background: rgb(255 59 48 / 4%);
    box-shadow:
        inset 0 0 0 1px rgb(255 59 48 / 55%),
        0 0 0 3px rgb(255 59 48 / 10%);
}

.profile-country-field__error {
    margin: 0.125rem 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: #b42318;
}

.profile-form-field .profile-country-field__trigger .prebook-country-picker__trigger-label {
    color: var(--color-text-faint);
    font-size: 15px;
    font-weight: 400;
}

.profile-form-field .profile-country-field__trigger.has-selection .prebook-country-picker__trigger-label,
.profile-form-field
    .profile-country-field__trigger
    .prebook-country-picker__trigger-label:not(.is-placeholder) {
    color: var(--sf-text);
}

.profile-form-field .profile-country-field__trigger .prebook-country-picker__chevron {
    color: var(--color-text-faint);
    font-size: 11px;
}

/* Profile page — full-width picker fields matching text inputs */
body.profile-page .profile-form-field--picker .profile-country-field__trigger {
    min-height: 46px;
    padding: 0.6875rem 0.875rem;
    border-radius: 10px;
    background: var(--color-control);
    box-shadow: inset 0 0 0 1px var(--color-border-subtle);
    justify-content: space-between;
}

body.profile-page .profile-form-field--picker .profile-country-field__trigger:hover {
    box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

body.profile-page .profile-form-field--picker .profile-country-field__trigger:focus-visible,
body.profile-page .profile-form-field--picker .profile-country-field__picker.is-open .profile-country-field__trigger {
    outline: none;
    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-field--picker .profile-country-field__trigger .prebook-country-picker__trigger-label {
    text-align: left;
    font-size: 17px;
    letter-spacing: -0.022em;
    color: var(--color-text-faint);
}

body.profile-page .profile-form-field--picker .profile-country-field__trigger.has-selection .prebook-country-picker__trigger-label,
body.profile-page .profile-form-field--picker .profile-country-field__trigger .prebook-country-picker__trigger-label:not(.is-placeholder) {
    color: var(--color-text);
}

body.profile-page .profile-form-field--picker .profile-country-field__trigger .prebook-country-picker__chevron {
    margin-left: 0.5rem;
    color: var(--color-text-muted);
    font-size: 12px;
}

body.profile-page .profile-form-field--error .profile-country-field.is-invalid .profile-country-field__trigger,
body.profile-page .profile-form-field--error .profile-country-field__trigger.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 .profile-country-field__error {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: #d70015;
}

.profile-form-field .profile-country-field__trigger .prebook-country-picker__trigger-flag {
    width: 20px;
    height: 20px;
}

.profile-form-field .profile-country-field__trigger .prebook-country-picker__placeholder-flag {
    width: 1.1rem;
    height: 0.75rem;
}

.profile-form-field .profile-country-field__trigger.has-legacy-selection .prebook-country-picker__trigger-label {
    color: var(--sf-text);
    font-style: normal;
}

/* Desktop / fallback dropdown on profile */
.profile-page .prebook-country-picker__menu {
    z-index: 10100;
    border: 0.5px solid var(--color-border-subtle);
    background: var(--color-surface-raised);
    box-shadow: var(--shadow-surface-lg);
}

.profile-page .prebook-country-picker__search {
    background: var(--color-control);
    border-color: var(--color-border-subtle);
    color: var(--color-text);
}

.profile-page .prebook-country-picker__option {
    color: var(--color-text);
}

/* ── Profile mobile bottom sheet (standalone, not inside prebook modal) ── */

body.profile-picker-swap-guard .profile-country-field__picker,
body.profile-picker-swap-guard .profile-country-sheet,
body.profile-picker-swap-guard .intl-phone-input__code {
    pointer-events: none;
}

body.profile-country-sheet-open {
    overflow: hidden;
    touch-action: none;
}

.profile-country-sheet {
    --pb-bg: var(--color-control);
    --pb-surface: var(--color-surface);
    --pb-text: var(--color-text);
    --pb-secondary: var(--color-text-secondary);
    --pb-label: var(--color-text-muted);
    --pb-separator: var(--color-border-subtle);
    --pb-accent: #00c2a8;
    --pb-font:
        -apple-system, blinkmacsystemfont, "SF Pro Text", "SF Pro Display",
        system-ui, sans-serif;

    position: fixed;
    inset: 0;
    z-index: 10150;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    max-width: 100%;
    margin: 0;
    font-family: var(--pb-font);
    overscroll-behavior: none;
}

.profile-country-sheet[hidden] {
    display: none !important;
}

.profile-country-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: none;
    margin: 0;
    padding: 0;
    background: var(--color-overlay);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.profile-country-sheet__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: 260px;
    max-height: calc(100dvh - 10px);
    margin: 0;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    background: var(--pb-surface);
    box-shadow: var(--shadow-surface-lg);
    transform: translate3d(0, 0, 0);
    will-change: height;
}

.profile-country-sheet__header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 0.5px solid var(--pb-separator);
    background: var(--pb-surface);
}

.profile-country-sheet__title {
    font-size: 15px;
    font-weight: 650;
    color: var(--pb-text);
}

.profile-country-sheet__done {
    border: none;
    background: transparent;
    color: var(--pb-accent);
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
    padding: 4px 0;
}

.profile-country-sheet .prebook-country-picker__search-wrap {
    flex-shrink: 0;
    padding: 10px 12px 0;
    background: var(--pb-surface);
}

.profile-country-sheet .prebook-country-picker__search {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 0.5px solid var(--pb-separator);
    border-radius: 10px;
    background: var(--pb-bg);
    font-size: 16px;
    color: var(--pb-text);
}

.profile-country-sheet .prebook-country-picker__search:focus {
    outline: none;
    border-color: var(--pb-accent);
    box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.14);
}

.profile-country-sheet .prebook-country-picker__options {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--pb-surface);
}

.profile-country-sheet .prebook-country-picker__option {
    width: 100%;
    color: var(--pb-text);
    background: transparent;
}

.profile-country-sheet .prebook-country-picker__option:hover,
.profile-country-sheet .prebook-country-picker__option:focus-visible {
    background: var(--color-control-hover);
}

.profile-country-sheet .prebook-country-picker__empty {
    color: var(--pb-secondary);
}

@media (max-width: 767px) {
    .profile-form-field .profile-country-field__trigger,
    .profile-form-field .profile-country-field__trigger .prebook-country-picker__trigger-label {
        font-size: 16px;
    }
}

@media (max-width: 520px) {
    .profile-page .prebook-country-picker__menu {
        border-radius: 14px;
        background: var(--color-surface-raised);
    }
}
