/**
 * Phone Input Override Styles
 * Minimal styling to match WordPress form inputs exactly
 */

/* Make the phone input container match other form fields */
.spai-form-group .iti {
    display: block;
    width: 100%;
}

/* Remove all intl-tel-input default margins/padding */
.spai-form-group .iti * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Reset the phone input to match other inputs exactly */
.spai-form-group .iti__tel-input {
    width: 100%;
    padding: 10px;
    padding-left: 10px; /* Dynamic padding will be applied via JS */
    border: 10px solid #ddd;
    border-radius: 3px;
    font-size: 16px;
    font-family: inherit;
    line-height: normal;
    height: auto;
    box-sizing: border-box;
    background-color: #fff;
    transition: border-color 0.3s, padding-left 0.2s;
}

/* Match focus state with other inputs */
.spai-form-group .iti__tel-input:focus {
    border-color: #999;
    outline: none;
}

/* Minimal country selector styling */
.spai-form-group .iti__country-container {
    padding: 0 !important;
    position: absolute;
    top: 1px;
    bottom: 1px;
    left: 1px;
}

.spai-form-group .iti__selected-country {
    height: 100%;
    padding: 0 !important;
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
}

.spai-form-group .iti__selected-country-primary {
    padding: 0 2px !important;
}

/* Minimal flag styling */
.spai-form-group .iti__flag {
    margin-right: 1px !important;
    transform: scale(0.9); /* Make flag slightly smaller */
}

/* Simple arrow */
.spai-form-group .iti__arrow {
    border-top-color: #666;
    margin-left: 2px;
    transform: scale(0.8); /* Make arrow smaller */
}

.spai-form-group .iti__arrow--up {
    border-bottom-color: #666;
}

/* Plain dropdown styling */
.spai-form-group .iti__dropdown-content {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 2px;
}

/* Simple search input */
.spai-form-group .iti__search-input {
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    font-family: inherit;
}

.spai-form-group .iti__search-input:focus {
    outline: none;
    border-bottom-color: #999;
}

/* Plain country list */
.spai-form-group .iti__country-list {
    max-height: 200px;
    overflow-y: auto;
}

.spai-form-group .iti__country {
    padding: 8px 10px;
    font-size: 14px;
    cursor: pointer;
}

.spai-form-group .iti__country.iti__highlight {
    background-color: #f0f0f0;
}

.spai-form-group .iti__country:hover {
    background-color: #f5f5f5;
}

/* Minimal dial code styling */
.spai-form-group .iti__dial-code {
    color: #666;
    margin-left: 6px;
}

/* Plain selected dial code */
.spai-form-group .iti__selected-dial-code {
    margin-left: 1px !important;
    color: #333;
    font-size: 16px; /* Match input font size */
    font-weight: normal; /* Ensure normal weight */
}

/* When separateDialCode is enabled - keep it plain */
.spai-form-group .iti--separate-dial-code .iti__tel-input {
    padding-left: 10px;
}

.spai-form-group .iti--separate-dial-code .iti__selected-country {
    background-color: transparent;
}

/* RTL support */
[dir="rtl"] .spai-form-group .iti__tel-input {
    padding-left: 10px;
    padding-right: 10px; /* Dynamic padding will be applied via JS */
}

[dir="rtl"] .spai-form-group .iti__selected-country {
    border: none;
}

/* Error state */
.spai-form-group.has-error .iti__tel-input {
    border-color: #d63638;
}

/* Disabled state */
.spai-form-group .iti__tel-input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.spai-form-group .iti__tel-input:disabled + .iti__country-container .iti__selected-country {
    cursor: not-allowed;
}
