/* Country Code Selector Styles */
.phone-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.country-selector {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 110px;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-right: none;
    border-radius: 0.375rem 0 0 0.375rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 6px;
}

.phone-input-group input,
.phone-input-group .form-control {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.country-selector:hover {
    background: #e9ecef;
}

.country-selector.active {
    background: #fff;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.country-flag {
    font-size: 1.2em;
    margin-right: 0.25rem;
}

.country-code {
    font-weight: 500;
    color: #495057;
    font-size: 0.875rem;
}

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    min-width: 280px;
    max-width: 360px;
}

.country-dropdown.show {
    display: block;
}

.country-search {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.country-search input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.country-search input:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.country-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.country-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f8f9fa;
}

.country-item:hover {
    background-color: #f8f9fa;
}

.country-item.active {
    background-color: #e7f3ff;
    color: #0c63e4;
}

.country-item-flag {
    font-size: 1.2em;
    margin-right: 0.75rem;
    width: 1.5em;
    text-align: center;
}

.country-item-info {
    flex: 1;
}

.country-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: #212529;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-item-code {
    font-size: 0.75rem;
    color: #6c757d;
}

.phone-number-input {
    flex: 1;
    border-radius: 0 0.375rem 0.375rem 0 !important;
    border-left: none !important;
}

.phone-number-input:focus {
    border-left: 1px solid #86b7fe !important;
    margin-left: -1px;
}


/* Responsive design */
@media (max-width: 576px) {
    .country-selector {
        min-width: 90px;
        padding: 0.375rem 0.5rem;
    }
    
    .country-flag {
        font-size: 1.1em;
        margin-right: 0.125rem;
    }
    
    .country-code {
        font-size: 0.8rem;
    }
    
    .country-item {
        padding: 0.625rem;
    }
    
    .country-item-flag {
        margin-right: 0.5rem;
    }
    
    .country-dropdown {
        min-width: 240px;
        max-width: 300px;
    }
}

/* Animation for dropdown */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.country-dropdown.show {
    animation: slideDown 0.2s ease-out;
}

/* Loading state */
.country-selector.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Error state */
.phone-input-group.error .country-selector {
    border-color: #dc3545;
}

.phone-input-group.error .phone-number-input {
    border-color: #dc3545;
}

/* Success state */
.phone-input-group.success .country-selector {
    border-color: #198754;
}

.phone-input-group.success .phone-number-input {
    border-color: #198754;
}
