/* Searchable country-code phone input -- themed to the auth blue (#1E88E5).
   Vanilla, no JS framework. Used on register + social-signup pages. */

.phone-input {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: visible;
}

.phone-input:focus-within {
    border-color: #1E88E5;
    box-shadow: 0 0 0 0.2rem rgba(30, 136, 229, 0.25);
}

/* ---- Selector (flag + chevron) ---- */
.phone-input__selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 12px;
    border: none;
    background: transparent;
    border-right: 1px solid #e5e7eb;
    cursor: pointer;
    color: #333;
    border-radius: 8px 0 0 8px;
    font-size: 1rem;
    line-height: 1;
}

.phone-input__selector:focus { outline: none; }
.phone-input__selector:hover { background: #f8f9fa; }

.phone-input__flag {
    min-width: 1.6em;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
}

.phone-input__chevron {
    font-size: 0.75rem;
    color: #6c757d;
    transition: transform 0.15s ease;
}

.phone-input.is-open .phone-input__chevron { transform: rotate(180deg); }

/* ---- Dial-code prefix + national number ---- */
.phone-input__prefix {
    display: flex;
    align-items: center;
    padding-left: 12px;
    color: #6c757d;
    white-space: nowrap;
}

.phone-input__number {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 12px;
    font-size: 1rem;
    color: #333;
    border-radius: 0 8px 8px 0;
}

.phone-input__number:focus { outline: none; box-shadow: none; }

/* ---- Dropdown ---- */
.phone-input__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1050;
    min-width: 300px;
    max-width: 420px;
    width: max-content;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.phone-input__dropdown[hidden] { display: none; }

.phone-input__search-wrap {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.phone-input__search-icon {
    position: absolute;
    top: 50%;
    left: 22px;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.85rem;
    pointer-events: none;
}

.phone-input__search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #333;
}

.phone-input__search:focus {
    outline: none;
    border-color: #1E88E5;
    box-shadow: 0 0 0 0.15rem rgba(30, 136, 229, 0.2);
}

.phone-input__list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.phone-input__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.phone-input__item[hidden] { display: none; }
.phone-input__item:hover,
.phone-input__item.is-active { background: #f1f5f9; }

.phone-input__item.is-selected { background: rgba(30, 136, 229, 0.08); }

.phone-input__item-flag {
    min-width: 1.6em;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.phone-input__item-name {
    flex: 1 1 auto;
    color: #1f2937;
    white-space: nowrap;
}

.phone-input__item-code {
    color: #6b7280;
    white-space: nowrap;
}

.phone-input__check {
    color: #1E88E5;
    font-size: 0.85rem;
    visibility: hidden;
    margin-left: 4px;
}

.phone-input__item.is-selected .phone-input__check { visibility: visible; }

.phone-input__empty {
    padding: 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
}

.phone-input__empty[hidden] { display: none; }

/* ---- RTL ---- */
[dir="rtl"] .phone-input__selector {
    border-right: none;
    border-left: 1px solid #e5e7eb;
    border-radius: 0 8px 8px 0;
}
[dir="rtl"] .phone-input__prefix { padding-left: 0; padding-right: 12px; }
[dir="rtl"] .phone-input__dropdown { left: auto; right: 0; }
[dir="rtl"] .phone-input__search-icon { left: auto; right: 22px; }
[dir="rtl"] .phone-input__search { padding: 8px 34px 8px 12px; }
