/* International Phone Input Styling */
.iti {
    width: 100%;
    display: block;
}

.iti__flag-container {
    z-index: 10;
}

.iti__country-list {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--black);
    border: 1px solid var(--gold);
    color: var(--text-color);
}

.iti__country {
    padding: 8px 10px;
    display: flex;
    align-items: center;
}

.iti__country.iti__highlight {
    background-color: rgba(255, 69, 0, 0.1);
}

.iti__country-name {
    margin-right: 6px;
}

.iti__dial-code {
    color: var(--gold);
}

.iti__selected-flag {
    background-color: rgba(255, 69, 0, 0.05);
    border-right: 1px solid var(--gold);
}

.iti__arrow {
    border-top-color: var(--gold);
}

.iti__arrow--up {
    border-bottom-color: var(--gold);
}

.phone-valid-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    display: none;
}

.phone-invalid-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #dc3545;
    display: none;
}

.phone-input-wrapper {
    position: relative;
}

.iti--allow-dropdown input.is-valid ~ .phone-valid-icon {
    display: block;
}

.iti--allow-dropdown input.is-invalid ~ .phone-invalid-icon {
    display: block;
}

.phone-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.875em;
}

/* Force LTR direction for phone numbers in all languages */
.iti input[type=tel] {
    direction: ltr !important;
    text-align: left !important;
}

/* Fix RTL issues with the flag dropdown */
html[dir="rtl"] .iti--allow-dropdown input, 
html[dir="rtl"] .iti--allow-dropdown input[type=tel] {
    padding-right: 52px !important;
    padding-left: 6px !important;
    margin-right: 0 !important;
}

html[dir="rtl"] .iti__flag-container {
    right: 0 !important;
    left: auto !important;
}

html[dir="rtl"] .phone-valid-icon,
html[dir="rtl"] .phone-invalid-icon {
    left: 10px;
    right: auto;
}

/* Ensure the dropdown opens correctly in RTL mode */
html[dir="rtl"] .iti__country-list {
    text-align: left;
    left: 0;
    right: auto;
}
