/* ============================================
   CUSTOM PHONE INPUT STYLES - WITH FLAG IMAGES
   ============================================ */

/* Phone Input Wrapper */
.phone-input-wrapper-new {
    position: relative;
    width: 100%;
}

/* Country Selector Button */
.phone-country-selector {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    z-index: 10;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: transparent;
}

/* .phone-country-selector:hover {
    background-color: #f3f4f6;
} */

/* Flag IMAGE Display - CRITICAL FOR SHOWING FLAGS */
.phone-flag-img {
    width: 24px !important;
    height: 18px !important;
    object-fit: cover;
    border-radius: 2px;
    display: block;
    border: 1px solid #e5e7eb;
}

/* Dial Code Display */
.phone-dial-code {
    color: #1f2937;
    font-size: 16px;
    font-weight: 500;
    /* min-width: 45px; */
    display: inline-block;
}

/* Dropdown Arrow */
.phone-dropdown-arrow {
    color: #9ca3af;
    font-size: 10px;
    transition: transform 0.2s ease;
    display: inline-block;
    margin-left: 2px;
}

.phone-country-selector:hover .phone-dropdown-arrow {
    color: #1f2937;
}

/* Phone Number Input Field */
.phone-input-wrapper-new .phone-number-field {
    padding: 8px 24px 8px 140px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 100px !important;
    font-size: 16px !important;
    color: #1f2937 !important;
    transition: all 0.2s ease !important;
    background: white !important;
}

/* .phone-input-wrapper-new .phone-number-field:focus {
    outline: none !important;
    border-color: #0A3051 !important;
    border-width: 2px !important;
    padding: 17px 23px 7px 139px !important;
} */

/* Label Positioning for Phone Input */
.phone-input-wrapper-new .input-label {
    position: absolute;
    left: 140px !important;
/*     top: 50% !important; */
    transform: translateY(-50%) !important;
    font-size: 16px;
    color: #9ca3af;
    pointer-events: none;
    transition: all 0.2s ease;
    background: white;
    padding: 0 4px;
    z-index: 1;
}

.phone-input-wrapper-new .phone-number-field:focus + .input-label,
.phone-input-wrapper-new .phone-number-field:not(:placeholder-shown) + .input-label {
    top: -8px !important;
    left: 24px !important;
    font-size: 12px !important;
    color: #0A3051 !important;
    transform: translateY(0) !important;
}

/* Dropdown Container */
.phone-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    max-width: 380px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    overflow: hidden;
    display: none;
}

/* Search Input in Dropdown */
.phone-search {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.phone-search:focus {
    background-color: #f9fafb;
}

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

/* Dropdown List Container */
.phone-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
}

/* Individual Dropdown Item */
.phone-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.phone-dropdown-item:last-child {
    border-bottom: none;
}

.phone-dropdown-item:hover {
    background-color: #f3f4f6;
}

.phone-dropdown-item:active {
    background-color: #e5e7eb;
}

/* Dropdown Flag IMAGE - CRITICAL */
.phone-dropdown-flag-img {
    width: 28px !important;
    height: 21px !important;
    object-fit: cover;
    border-radius: 2px;
    display: block;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* Dropdown Item Text */
.phone-dropdown-name {
    flex: 1;
    color: #1f2937;
    font-size: 14px;
    font-weight: 400;
}

.phone-dropdown-code {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

/* Custom Scrollbar for Dropdown */
.phone-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.phone-dropdown-list::-webkit-scrollbar-track {
    background: #f9fafb;
}

.phone-dropdown-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.phone-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Firefox Scrollbar */
.phone-dropdown-list {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f9fafb;
}

/* Ensure dropdown appears above other elements */
body > .phone-dropdown,
.elementor-popup-modal .phone-dropdown {
    z-index: 999999 !important;
}

/* Loading state for flag images */
.phone-flag-img[src=""],
.phone-dropdown-flag-img[src=""] {
    background: #f3f4f6;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media only screen and (max-width: 768px) {
    /* Adjust phone input padding for mobile */
    .phone-input-wrapper-new .phone-number-field {
        padding: 18px 20px 8px 135px !important;
        font-size: 14px !important;
    }
    
    .phone-input-wrapper-new .phone-number-field:focus {
        padding: 17px 19px 7px 134px !important;
    }
    
    /* Adjust label position for mobile */
    .phone-input-wrapper-new .input-label {
        left: 135px !important;
        font-size: 14px;
    }
    
    .phone-input-wrapper-new .phone-number-field:focus + .input-label,
    .phone-input-wrapper-new .phone-number-field:not(:placeholder-shown) + .input-label {
        font-size: 11px !important;
    }
    
    /* Adjust country selector for mobile */
    .phone-country-selector {
        left: 20px;
        padding: 5px 8px;
        gap: 6px;
    }
    
    /* Adjust flag size for mobile */
    .phone-flag-img {
        width: 20px !important;
        height: 15px !important;
    }
    
    .phone-dial-code {
        font-size: 14px;
        min-width: 40px;
    }
    
    /* Make dropdown responsive */
    .phone-dropdown {
        max-width: calc(100% - 8px);
        left: 4px;
        right: 4px;
    }
    
    /* Adjust dropdown items for mobile */
    .phone-dropdown-item {
        padding: 10px 14px;
        gap: 10px;
    }
    
    /* Adjust dropdown flag size for mobile */
    .phone-dropdown-flag-img {
        width: 24px !important;
        height: 18px !important;
    }
    
    .phone-dropdown-name {
        font-size: 13px;
    }
    
    .phone-dropdown-code {
        font-size: 13px;
    }
}

@media only screen and (max-width: 480px) {
    .phone-input-wrapper-new .phone-number-field {
        padding: 18px 16px 8px 125px !important;
    }
    
    .phone-input-wrapper-new .phone-number-field:focus {
        padding: 17px 15px 7px 124px !important;
    }
    
    .phone-input-wrapper-new .input-label {
        left: 125px !important;
    }
    
    .phone-country-selector {
        left: 16px;
    }
    
    .phone-dial-code {
        font-size: 13px;
        min-width: 38px;
    }
}