/**
 * intl-tel-input custom country picker (validate-phone.js).
 * Loaded on account + auth: survives Tailwind CDN preflight / Bootstrap resets.
 */

/* Hide plugin’s native dropdown; we use the custom modal list */
.iti__country-list {
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

.iti--container {
    z-index: 10000000040 !important;
}

/* Root: id bumps specificity above Tailwind utilities on wrapper-account */
#intl-tel-country-modal.intl-tel-country-modal {
    z-index: 10000000050;
}

.intl-tel-country-modal {
    overscroll-behavior: contain;
    position: fixed;
    inset: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
}

.intl-tel-country-modal.hidden {
    display: none !important;
}

body.intl-tel-modal-open {
    overflow: hidden;
}

.intl-tel-country-modal__backdrop {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    background: #00000080;
    position: absolute;
    inset: 0;
    z-index: 0;
}

.intl-tel-country-modal__panel {
    border: 1px solid #edf0e6;
    background: #fff;
    border-radius: 0.75rem;
    flex-direction: column;
    width: min(28rem, calc(100% - 2rem));
    max-width: 28rem;
    max-height: min(85vh, 32rem);
    margin: 0;
    flex-shrink: 0;
    display: flex;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 48px rgba(24, 24, 27, 0.08);
}

.intl-tel-country-modal__head {
    border-bottom: 1px solid #edf0e6;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    display: flex;
}

.intl-tel-country-modal__title {
    color: #18181b;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Close: explicit reset so Bootstrap / preflight don’t flatten the control */
#intl-tel-country-modal .intl-tel-country-modal__close {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    margin: 0;
    background: #f3f8e8;
    width: 2.25rem;
    height: 2.25rem;
    color: #18181b;
    cursor: pointer;
    border: none;
    border-radius: 9999px;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    padding: 0;
    font-family: inherit;
}

.intl-tel-country-modal__close:hover {
    background: #edf0e6;
    opacity: 1;
}

.intl-tel-country-modal__search-wrap {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    position: relative;
}

.intl-tel-country-modal__search-icon {
    color: #5d6167;
    pointer-events: none;
    font-size: 0.875rem;
    position: absolute;
    top: 50%;
    left: 1.5rem;
    transform: translateY(-50%);
}

#intl-tel-country-modal .intl-tel-country-modal__search {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    margin: 0;
    display: block;
    width: 100%;
    border: 1px solid #edf0e6;
    background: #f6f8f1;
    color: #18181b;
    border-radius: 0.75rem;
    padding: 0.625rem 0.75rem 0.625rem 2.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    font-family: inherit;
}

.intl-tel-country-modal__search::placeholder {
    color: #5d6167;
    opacity: 1;
}

.intl-tel-country-modal__search:focus {
    border-color: #b1e346;
    box-shadow: 0 0 0 2px rgba(177, 227, 70, 0.35);
    outline: none;
}

@supports (color: color-mix(in lab, red, red)) {
    .intl-tel-country-modal__search:focus {
        box-shadow: 0 0 0 2px color-mix(in srgb, #b1e346 32%, transparent);
    }
}

.intl-tel-country-modal__list-wrap {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.intl-tel-country-modal__list {
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 0 0.5rem 1rem;
    overflow-y: auto;
}

#intl-tel-country-modal .intl-tel-country-modal__row {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    margin: 0 0 2px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    color: #18181b;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    display: flex;
    font-family: inherit;
}

.intl-tel-country-modal__row:hover,
.intl-tel-country-modal__row:focus {
    background: #f3f8e8;
    outline: none;
}

.intl-tel-country-modal__flag-wrap {
    aspect-ratio: 120 / 80;
    background: #eceff4;
    width: 1.25rem;
    max-width: 22px;
    height: 0.85rem;
    max-height: 15px;
    box-shadow: 0 0 0 1px #dce0d3;
    border-radius: 0.25rem;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    display: inline-flex;
    overflow: hidden;
}

@supports (color: color-mix(in lab, red, red)) {
    .intl-tel-country-modal__flag-wrap {
        box-shadow: 0 0 0 1px color-mix(in srgb, #dce0d3 85%, transparent);
    }
}

.intl-tel-country-modal__flag-img {
    object-fit: cover;
    object-position: center;
    vertical-align: middle;
    width: 100%;
    height: 100%;
    display: block;
}

.intl-tel-country-modal__flag-fallback {
    font-family: Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji, sans-serif;
    font-size: 0.75rem;
    line-height: 1;
}

.intl-tel-country-modal__flag-fallback.is-visible {
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    display: inline-flex !important;
}

.intl-tel-country-modal__name {
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.intl-tel-country-modal__dial {
    color: #5d6167;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Dark — account uses html.dark + data-theme; keep .dark for Tailwind selector mode */
.dark .intl-tel-country-modal__backdrop,
html.dark .intl-tel-country-modal__backdrop,
html[data-theme="dark"] .intl-tel-country-modal__backdrop {
    background: rgba(0, 0, 0, 0.78);
}

.dark .intl-tel-country-modal__panel,
html.dark .intl-tel-country-modal__panel,
html[data-theme="dark"] .intl-tel-country-modal__panel {
    border-color: #373935;
    background: #212220;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.dark .intl-tel-country-modal__head,
html.dark .intl-tel-country-modal__head,
html[data-theme="dark"] .intl-tel-country-modal__head {
    border-bottom-color: #373935;
}

.dark .intl-tel-country-modal__title,
html.dark .intl-tel-country-modal__title,
html[data-theme="dark"] .intl-tel-country-modal__title {
    color: #fff;
}

.dark #intl-tel-country-modal .intl-tel-country-modal__close,
html.dark #intl-tel-country-modal .intl-tel-country-modal__close,
html[data-theme="dark"] #intl-tel-country-modal .intl-tel-country-modal__close {
    background: #191a17;
    color: #e4e4e7;
}

.dark #intl-tel-country-modal .intl-tel-country-modal__close:hover,
html.dark #intl-tel-country-modal .intl-tel-country-modal__close:hover,
html[data-theme="dark"] #intl-tel-country-modal .intl-tel-country-modal__close:hover {
    background: #2a2b28;
    opacity: 1;
}

.dark .intl-tel-country-modal__search-icon,
html.dark .intl-tel-country-modal__search-icon,
html[data-theme="dark"] .intl-tel-country-modal__search-icon {
    color: #a1a49d;
}

.dark #intl-tel-country-modal .intl-tel-country-modal__search,
html.dark #intl-tel-country-modal .intl-tel-country-modal__search,
html[data-theme="dark"] #intl-tel-country-modal .intl-tel-country-modal__search {
    border-color: #373935;
    background: #191a17;
    color: #fff;
}

.dark .intl-tel-country-modal__search::placeholder,
html.dark .intl-tel-country-modal__search::placeholder,
html[data-theme="dark"] .intl-tel-country-modal__search::placeholder {
    color: #a1a49d;
    opacity: 1;
}

.dark .intl-tel-country-modal__search:focus,
html.dark .intl-tel-country-modal__search:focus,
html[data-theme="dark"] .intl-tel-country-modal__search:focus {
    border-color: #b1e346;
    box-shadow: 0 0 0 2px rgba(177, 227, 70, 0.35);
    outline: none;
}

.dark #intl-tel-country-modal .intl-tel-country-modal__row,
html.dark #intl-tel-country-modal .intl-tel-country-modal__row,
html[data-theme="dark"] #intl-tel-country-modal .intl-tel-country-modal__row {
    color: #f4f4f5;
}

.dark #intl-tel-country-modal .intl-tel-country-modal__row:hover,
.dark #intl-tel-country-modal .intl-tel-country-modal__row:focus,
html.dark #intl-tel-country-modal .intl-tel-country-modal__row:hover,
html.dark #intl-tel-country-modal .intl-tel-country-modal__row:focus,
html[data-theme="dark"] #intl-tel-country-modal .intl-tel-country-modal__row:hover,
html[data-theme="dark"] #intl-tel-country-modal .intl-tel-country-modal__row:focus {
    background: #2a2b28;
    outline: none;
}

.dark .intl-tel-country-modal__dial,
html.dark .intl-tel-country-modal__dial,
html[data-theme="dark"] .intl-tel-country-modal__dial {
    color: #a1a49d;
}

.dark .intl-tel-country-modal__flag-wrap,
html.dark .intl-tel-country-modal__flag-wrap,
html[data-theme="dark"] .intl-tel-country-modal__flag-wrap {
    background: #2a2b28;
    box-shadow: 0 0 0 1px #373935;
}

@supports (color: color-mix(in lab, red, red)) {
    .dark .intl-tel-country-modal__search:focus,
    html.dark .intl-tel-country-modal__search:focus,
    html[data-theme="dark"] .intl-tel-country-modal__search:focus {
        box-shadow: 0 0 0 2px color-mix(in srgb, #b1e346 32%, transparent);
    }
}
