/* =====================================================
   Noor-e-Ilm International Phone & Country Components
   Shared with Student Registration, Edit Profile and
   Admin student add/edit. Brand palette:
   navy #0B1F4D | teal #06B6B4 | gold #F5B400 | slate #64748B
   ===================================================== */

/* ---------- intl-tel-input theming (v29) ---------- */
.nii-phone-wrap {
    position: relative;
}

.nii-phone-wrap .iti {
    display: block;
    width: 100%;
    --iti-hover-color: rgba(6, 182, 180, .08);
    --iti-border-color: #cbd5e1;
    --iti-border-radius: 10px;
    --iti-icon-color: #94a3b8;
    --iti-arrow-size: 7px;
    --iti-arrow-width: 2px;
    --iti-arrow-padding: 8px;
    --iti-search-field-padding: 10px;
    --iti-selected-dial-code-font-size: 15px;
    --iti-selected-flag-width: 46px;
    --iti-selected-country-padding: 0 8px 0 14px;
}

.nii-phone-wrap .iti__tel-input:focus {
    box-shadow: none;
}

/* Match the surrounding field border radius on the selector */
.nii-phone-wrap .iti__selected-country {
    border-radius: 10px 0 0 10px;
}

.nii-phone-wrap .iti__selected-dial-code {
    color: var(--si-slate, #64748B);
    font-weight: 600;
    margin-left: 6px;
}

.nii-phone-wrap .iti__arrow {
    margin-left: 6px;
}

/* country dropdown */
.nii-phone-wrap .iti__country-list {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(11, 31, 77, .16);
    max-height: 210px;
}

.nii-phone-wrap .iti__country {
    border-radius: 7px;
    margin: 2px 6px;
    padding: 7px 10px;
}

.nii-phone-wrap .iti__country.iti__highlight {
    background: rgba(6, 182, 180, .10);
}

.nii-phone-wrap .iti__country-name {
    color: #0B1F4D;
    font-size: .9rem;
}

.nii-phone-wrap .iti__search-input {
    width: 100%;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: .88rem;
    color: #0B1F4D;
}

.nii-phone-wrap .iti__search-input:focus {
    border-color: #06B6B4 !important;
    box-shadow: 0 0 0 .22rem rgba(6, 182, 180, .16);
    outline: none;
}

/* =====================================================
   FLAG FIX
   -----------------------------------------------------
   intl-tel-input v29's own CSS renders the flag sprite
   through:
     image-set(var(--iti-path-flags-1x) 1x,
               var(--iti-path-flags-2x) 2x)
   but flags@2x.webp was missing from the build, so the
   whole background was dropped and every flag rendered as
   a blank box. These overrides load the same sprite with a
   plain url() (works in every browser) so actual flags are
   always visible - in the phone country selector AND in
   the searchable country combobox.
   ===================================================== */

/* Phone country selector flag: use the 1x sprite directly. */
.nii-phone-wrap .iti__flag {
    background-image: url(../vendor/intl-tel-input/img/flags.webp);
}

/* Country combobox container: creates the containing block so the
   dropdown panel is positioned directly under its own field rather
   than escaping to the viewport. */
.nii-country {
    position: relative;
}

/* Selected-value field: the flag is a dedicated element (nii-sel-flag)
   in front of the text, so only ONE flag ever shows. */
.nii-country .nii-country-field {
    background: #fff;
    background-image: none !important;
    padding-left: 40px;
    padding-right: 36px;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.nii-country .nii-country-field::placeholder {
    color: #94a3b8;
}

/* The selected country's flag - fixed size, never squished. */
.nii-country .nii-sel-flag {
    position: absolute;
    left: 11px;
    top: 50%;
    width: 20px;
    height: 15px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

/* Dropdown caret (chevron) on the right side. */
.nii-country::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    transform: translateY(-50%) rotate(45deg);
    border-right: 2px solid var(--nii-slate, #64748B);
    border-bottom: 2px solid var(--nii-slate, #64748B);
    transition: transform .15s ease;
    pointer-events: none;
}

.nii-country.nii-open::after {
    transform: translateY(-50%) rotate(-135deg);
}

/* Country combobox dropdown rows + selected flag share the same
   fixed-size sprite flag (never inline, so it can never collapse). */
.nii-fi .iti__flag,
.nii-sel-flag .iti__flag {
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 0;
    flex: none;
    flex-shrink: 0;
    background-image: url(../vendor/intl-tel-input/img/flags.webp);
}

.nii-country-field:focus {
    border-color: var(--nii-teal, #06B6B4);
    box-shadow: 0 0 0 .22rem rgba(6, 182, 180, .16);
    outline: none;
}

.nii-country-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(11, 31, 77, .18);
    max-height: 260px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nii-country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: .9rem;
    color: #0B1F4D;
}

.nii-country-option:hover,
.nii-country-option.nii-active {
    background: rgba(6, 182, 180, .10);
}

.nii-country-option.nii-active {
    font-weight: 600;
}

.nii-fi {
    font-size: 1.05rem;
    line-height: 1;
    width: 26px;
    text-align: center;
    flex: none;
}

.nii-country-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nii-country-code {
    color: #64748B;
    font-size: .82rem;
    font-weight: 600;
    margin-left: auto;
    padding-left: 10px;
    flex: none;
}

.nii-country-empty {
    padding: 12px;
    color: #64748B;
    font-size: .88rem;
    text-align: center;
}

/* mobile: keep menus inside the viewport */
@media (max-width: 575.98px) {
    .nii-country-menu {
        max-height: 240px;
    }
}