/* Phone Validation — V-Town Theme */

.phone-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    overflow: visible;
    transition: border-color 0.2s ease;
}

.phone-input-wrapper:focus-within {
    border-color: #2B6E63;
    box-shadow: 0 0 0 3px rgba(43,110,99,.1);
}

.country-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 10px;
    background: #f9fafb;
    border: none;
    border-right: 1px solid #e5e7eb;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
    min-width: 95px;
    font-family: inherit;
}

[dir="rtl"] .country-selector {
    border-right: none;
    border-left: 1px solid #e5e7eb;
    border-radius: 0 8px 8px 0;
}

.country-selector:hover { background: #f0f0f0; }

.country-selector .country-flag { font-size: 18px; line-height: 1; }

.country-selector .country-code {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
    font-family: 'SF Mono', 'Monaco', monospace;
    letter-spacing: 0.02em;
}

.country-selector .chevron {
    width: 11px; height: 11px;
    color: #6b7280;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.country-selector[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.phone-input-wrapper input[type="tel"],
.phone-input-wrapper input[name="phone"] {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 12px 14px !important;
    font-size: 15px !important;
    color: #1a1a1a !important;
    outline: none !important;
    box-shadow: none !important;
    min-width: 0;
    font-family: inherit !important;
    border-radius: 0 !important;
}

.phone-input-wrapper input::placeholder { color: #9ca3af; }

.phone-error {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #ef4444;
}

/* Dropdown */
.country-dropdown {
    position: fixed;
    width: 300px;
    max-width: min(300px, 92vw);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.18);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    overflow: hidden;
}

.country-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    animation: vtDropdownFade 0.2s ease forwards;
}

@keyframes vtDropdownFade {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.country-search {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.country-search-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.country-search-input:focus { border-color: #2B6E63; }

.country-options {
    max-height: 260px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.country-options::-webkit-scrollbar { width: 5px; }
.country-options::-webkit-scrollbar-track { background: #f9fafb; }
.country-options::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.12s ease;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.country-option:last-child { border-bottom: none; }
.country-option:hover { background: #f0fdf4; }
.country-option.selected { background: rgba(43,110,99,0.08); }

.country-option .country-flag { font-size: 18px; line-height: 1; flex-shrink: 0; }

.country-option .country-name {
    flex: 1;
    font-size: 13px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-option .country-code {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    font-family: 'SF Mono', 'Monaco', monospace;
    flex-shrink: 0;
}

.country-option.selected .country-name { font-weight: 700; }

/* Priority MENA countries */
.country-option[data-iso="EG"],
.country-option[data-iso="SA"],
.country-option[data-iso="AE"],
.country-option[data-iso="KW"],
.country-option[data-iso="QA"] {
    background: rgba(43,110,99,0.04);
}

[dir="rtl"] .country-option { flex-direction: row-reverse; }
[dir="rtl"] .country-selector { flex-direction: row-reverse; }

@media (max-width: 480px) {
    .country-dropdown { max-width: calc(100vw - 8px); }
    .country-selector { min-width: 80px; padding: 10px 8px; }
    .country-selector .country-code { font-size: 11px; }
    .phone-input-wrapper input[type="tel"],
    .phone-input-wrapper input[name="phone"] { padding: 10px 10px !important; font-size: 14px !important; }
    .country-options { max-height: 210px; }
}
