/* ========== Phone country dropdown theme ==========
   Matches the site's custom selects (src/js/modules/forms/custom-select.js).
   Colors use the theme custom properties emitted in src/scss/base/_layout.scss, so
   the dropdown follows the dark/light toggle. The fixed values mirror the SCSS tokens
   $color-yellow-alpha, $radius-md, $shadow-medium and $z-modal.
   Loaded after intlTelInput.min.css so these rules win without touching the library file.
*/

/* On :root because on touch devices the list opens in a popup appended to <body>, outside the field */
:root {
    --iti-border-color: var(--color-border-strong);
    --iti-country-selector-bg: var(--color-surface-alt);
    --iti-icon-color: var(--color-text-muted);
    --iti-hover-color: rgba(255, 210, 31, 0.15);
    --iti-strict-reject-flash-color: rgba(255, 210, 31, 0.15);
    --iti-spacer-horizontal: 12px;
    --iti-arrow-padding: 8px;
}

/* The library wraps the input in an inline-block ".iti", which would size the field to its content */
.field .iti {
    display: block;
    width: 100%;
}

/* The popup list is attached to <body>: lift it above the sticky header and the floating buttons */
.iti--detached-country-selector {
    z-index: 10000;
}

/* Selected-country button: rounded to sit inside the input's left corners */
.iti__selected-country-primary {
    border-radius: 10px 0 0 10px;
}

.iti__selected-country:focus-visible {
    outline: 2px solid var(--color-yellow-text);
    outline-offset: -2px;
    border-radius: 10px 0 0 10px;
}

/* Dropdown panel */
.iti--inline-country-selector .iti__country-selector {
    margin-top: 4px;
    overflow: hidden;
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.iti--fullscreen-popup .iti__country-selector {
    overflow: hidden;
    border-radius: 10px;
}

.iti--inline-country-selector .iti__country-list {
    max-height: 240px;
}

.iti__country-list {
    padding: 4px;
    color: var(--color-text);
}

/* Search box: no field-style focus ring inside the panel, the wrapper underline marks it */
.iti .iti__search-input {
    padding-top: 12px;
    padding-bottom: 12px;
    border: 0;
    border-radius: 0;
    background: var(--color-surface-alt);
    color: var(--color-text);
    font-size: 1rem;
    box-shadow: none;
}

.iti .iti__search-input::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.iti .iti__search-input:focus-visible {
    outline: none;
}

.iti__search-input-wrapper:focus-within {
    box-shadow: inset 0 -2px 0 var(--color-yellow-text);
}

/* Options */
.iti__country {
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1.5;
}

.iti__country[aria-selected="true"] {
    font-weight: 600;
    color: var(--color-yellow-text);
}

.iti__country[aria-selected="true"] .iti__country-check {
    color: var(--color-yellow-text);
}

.iti__dial-code {
    margin-left: 6px;
    color: var(--color-text-muted);
}

.iti__no-results {
    padding: 12px;
    color: var(--color-text-muted);
}

/* High contrast mode drops backgrounds and shadows: outlines keep the focus and the highlighted option visible */
@media (forced-colors: active) {
    .iti__search-input-wrapper:focus-within {
        outline: 2px solid;
        outline-offset: -2px;
    }

    .iti__country.iti__highlight {
        outline: 2px solid;
        outline-offset: -2px;
    }
}
