/* Phone Formatter Styles */

.phone-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.country-flag-button {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    z-index: 2;
    transition: transform 0.2s ease;
}

.country-flag-button:hover {
    transform: translateY(-50%) scale(1.1);
}

.country-flag-button:focus {
    outline: none;
    transform: translateY(-50%) scale(1.1);
}

.phone-input-wrapper input[type="tel"],
.phone-input-wrapper .phone-input,
.phone-input-wrapper .property-phone-input,
.phone-input-wrapper #phone-input,
.phone-input-wrapper input[name="phone"] {
    padding-left: 44px !important;
    width: 100%;
}

.country-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    background: #333;
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    min-width: 200px;
    padding: 8px 0;
}

.country-option {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #fff;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #555;
}

.country-option:last-child {
    border-bottom: none;
}

.country-option:hover {
    background: #555;
}

.country-option:first-child {
    border-radius: 8px 8px 0 0;
}

.country-option:last-child {
    border-radius: 0 0 8px 8px;
}

/* Phone input validation states */
.phone-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2) !important;
}

.phone-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .country-selector {
        min-width: 50px;
        max-width: 60px;
        font-size: 12px;
        padding: 6px 8px;
        padding-right: 28px;
        background-size: 14px;
    }
}

/* Integration with existing form styles */
.consultation-form-row .phone-input-wrapper,
.catalog-download-form .phone-input-wrapper,
.contact-form .phone-input-wrapper {
    margin-bottom: 0;
    align-self: flex-start;
}

/* Ensure proper alignment in flex containers */
.consultation-form-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.consultation-form-row .consultation-input {
    flex: 1;
    max-width: none;
    min-width: 50%;
}

/* Property feedback form adjustments */
.property-feedback-form .phone-input-wrapper {
    margin-right: 8px;
    margin-bottom: 0;
}

/* Landing page specific flag positioning */
.ruble-landing-form .country-flag-button {
    left: 18px;
    transform: translateY(-35%);
}

.ruble-landing-form .phone-input-wrapper input {
    padding-left: 50px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .country-flag-button {
        font-size: 16px;
        width: 20px;
        height: 20px;
        left: 14px;
    }
    
    .phone-input-wrapper input {
        padding-left: 38px !important;
    }
    
    .country-dropdown {
        min-width: 180px;
        max-height: 250px;
    }
    
    /* Landing page mobile adjustments */
    .ruble-landing-form .country-flag-button {
        left: 14px;
    }
    
    .ruble-landing-form .phone-input-wrapper input {
        padding-left: 40px !important;
    }
}

/* Adjust country selector for very small screens */
@media (max-width: 480px) {
    .country-flag-button {
        font-size: 14px;
        width: 18px;
        height: 18px;
        left: 14px;
    }
    
    .phone-input-wrapper input {
        padding-left: 32px !important;
    }
    
    /* Landing page very small screen adjustments */
    .ruble-landing-form .country-flag-button {
        left: 14px;
    }
    
    .ruble-landing-form .phone-input-wrapper input {
        padding-left: 35px !important;
    }
    
    .consultation-form-row,
    .property-feedback-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .consultation-form-row .consultation-input,
    .property-feedback-form .property-feedback-input {
        margin-left: 0;
    }
}
