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

.iti__flag-container {
    background: transparent !important;
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    padding-right: 0 !important;
}

/* Ensure flag box stays in place - ONLY for selected flag, not dropdown */
.iti__selected-flag .iti__flag-box {
    position: absolute !important;
    left: 12px !important; /* Fixed position from left */
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* Reset position for dropdown flags */
.iti__country-list .iti__flag-box {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
}

.iti__selected-flag {
    background-color: #2a2b35 !important; /* Match form background to prevent overlay */
    border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 0 8px 0 12px !important; /* More padding on left to prevent flag cutoff */
    width: 95px !important; /* Reduced width to not cover input */
    box-sizing: border-box !important;
    overflow: hidden !important; /* Prevent content overflow */
}

.iti__selected-flag:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.iti__selected-dial-code {
    color: #fff !important;
    margin-left: 4px !important;
    background: #2a2b35 !important; /* Match form background */
    padding: 0 2px !important;
    z-index: 2 !important;
    position: relative !important;
}

.iti input[type="tel"],
.iti input[type="text"] {
    width: 100% !important;
    background: rgba(0, 0, 0, 0.3) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 12px !important;
    padding-left: 105px !important; /* Reduced to match flag width */
    border-radius: 4px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 0.95rem !important;
}

/* Hide placeholder text completely to avoid overlap */
.iti input[type="tel"]::placeholder,
.iti input[type="text"]::placeholder,
#phone::placeholder {
    color: transparent !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Admin portal specific phone field fixes */
#newProspectPhone,
#editPhone {
    padding-left: 110px !important; /* Reduced to match actual flag width */
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Fix for Add Prospect phone field wrapper */
#addProspectPanel .iti,
#prospectAddPanel .iti {
    width: 60% !important; /* Match other input fields width */
    display: inline-block !important;
}

#addProspectPanel .iti input[type="tel"],
#prospectAddPanel .iti input[type="tel"] {
    width: 100% !important;
    padding-left: 110px !important;
}

/* Ensure the flag container doesn't overlap in admin portal */
#addProspectPanel .iti__selected-flag,
#prospectAddPanel .iti__selected-flag,
#prospectDetailPanel .iti__selected-flag {
    width: 100px !important; /* Narrower to not cover input */
    z-index: 10 !important;
}

/* Admin portal phone input specific */
#addProspectPanel .iti input[type="tel"],
#prospectAddPanel .iti input[type="tel"],
#prospectDetailPanel .iti input[type="tel"] {
    padding-left: 110px !important; /* Match the flag width plus small gap */
}

.iti input[type="tel"]:focus,
.iti input[type="text"]:focus {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: #D4AF37 !important; /* Equstech gold */
    outline: none !important;
}

.iti__country-list {
    background: #1a1a1a !important;
    border: 1px solid #D4AF37 !important; /* Equstech gold */
    color: white !important;
    max-height: 200px !important;
    border-radius: 4px !important;
    margin-top: 2px !important;
    z-index: 99999 !important;
    overflow-y: auto !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
}

.iti__country-list.iti__hide {
    display: none !important;
}

.iti__country-list--dropdown,
.iti__country-list--dropup {
    display: block !important;
}

.iti__country {
    padding: 8px 10px !important;
    color: white !important;
}

.iti__country:hover,
.iti__country.iti__highlight {
    background-color: #D4AF37 !important; /* Equstech gold */
    color: #1a1b23 !important; /* Dark text on gold */
}

.iti__country:hover .iti__country-name,
.iti__country:hover .iti__dial-code,
.iti__country.iti__highlight .iti__country-name,
.iti__country.iti__highlight .iti__dial-code {
    color: #1a1b23 !important; /* Dark text on gold */
}

.iti__country-name,
.iti__dial-code {
    color: white !important;
}

.iti__arrow {
    border-top-color: white !important;
}

.iti__arrow--up {
    border-bottom-color: white !important;
    border-top-color: transparent !important;
}

/* Modal specific styling */
.modal .iti input[type="tel"],
#ctaModal .iti input[type="tel"] {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Admin portal specific */
.admin-portal .iti input[type="tel"],
.detail-panel .iti input[type="tel"] {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Hide manual country code selects in admin portal */
select#phoneCountryCode,
select#userCountryCode,
select#editPhoneCountryCode,
select#editUserCountryCode,
select#newProspectCountryCode,
select#newUserCountryCode {
    display: none !important;
}

/* Mobile-specific - hide default dropdown and style flag button */
@media (max-width: 768px) {
    /* Hide the default dropdown completely on mobile */
    .iti__country-list,
    body > .iti__country-list {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Make flag button more obvious it's clickable */
    .iti__selected-flag {
        background: rgba(212, 175, 55, 0.1) !important;
        border: 1px solid #D4AF37 !important;
    }
    
    .iti__selected-flag:hover {
        background: rgba(212, 175, 55, 0.2) !important;
    }

/* Mobile-specific fixes - ensure dropdown works on mobile */
@media (max-width: 768px) {
    /* Ensure dropdown is visible and accessible on mobile */
    .iti__country-list {
        max-height: 200px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 9999 !important;
    }
    
    .iti__selected-flag {
        cursor: pointer !important;
        user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
    }
    
    /* Prevent any dropdown arrow from showing on mobile */
    .iti__arrow {
        display: none !important;
    }
    
    /* Ensure flag button is easily tappable */
    .iti__flag-container {
        min-height: 44px !important; /* iOS minimum tap target */
        display: flex !important;
        align-items: center !important;
    }
    
    /* Fix phone input padding on mobile */
    .iti input[type="tel"] {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
}
}