/* Country Selector Styles */
.country-selector {
    position: relative;
    width: 100%;
}

.country-selector-button {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}

.country-selector-button:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.country-selector-button:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.country-selector.open .country-selector-button {
    border-color: #007bff;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.country-selector-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    color: #333;
}

.country-selector-text:empty::before {
    content: attr(data-placeholder);
    color: #6c757d;
}

.country-selector-arrow {
    color: #6c757d;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.country-selector.open .country-selector-arrow {
    transform: rotate(180deg);
}

.country-selector-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #007bff;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
}

.country-selector-search {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid #e1e5e9;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.country-selector-search:focus {
    border-bottom-color: #007bff;
    background-color: #f8f9fa;
}

.country-selector-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}

.country-selector-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

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

.country-selector-item:hover {
    background-color: #f8f9fa;
}

.country-selector-item:focus {
    outline: none;
    background-color: #e3f2fd;
}

.country-selector-item.selected {
    background-color: #007bff;
    color: white;
}

.country-selector-item.selected:hover {
    background-color: #0056b3;
}

.country-flag {
    font-size: 20px;
    width: 24px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.country-name {
    flex: 1;
    font-weight: 500;
    color: inherit;
}

.country-code {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    opacity: 0.8;
    min-width: 24px;
    text-align: right;
}

.country-selector-item.selected .country-code {
    color: rgba(255, 255, 255, 0.8);
}

/* Scrollbar Styling */
.country-selector-list::-webkit-scrollbar {
    width: 6px;
}

.country-selector-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.country-selector-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.country-selector-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation für Dropdown */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.country-selector-dropdown {
    animation: slideDown 0.2s ease;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .country-selector-dropdown {
        max-height: 250px;
    }
    
    .country-selector-list {
        max-height: 190px;
    }
    
    .country-selector-item {
        padding: 14px 16px;
    }
    
    .country-flag {
        font-size: 18px;
        width: 22px;
        height: 16px;
    }
    
    .country-name {
        font-size: 15px;
    }
    
    .country-code {
        font-size: 11px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .country-selector-button {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .country-selector-button:hover {
        border-color: #3182ce;
    }
    
    .country-selector-dropdown {
        background: #2d3748;
        border-color: #3182ce;
    }
    
    .country-selector-search {
        background: #2d3748;
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .country-selector-search:focus {
        background: #374151;
        border-bottom-color: #3182ce;
    }
    
    .country-selector-item {
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .country-selector-item:hover {
        background-color: #374151;
    }
    
    .country-selector-item:focus {
        background-color: #4a5568;
    }
    
    .country-code {
        color: #a0aec0;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .country-selector-button {
        border-width: 3px;
        border-color: #000;
    }
    
    .country-selector-button:focus {
        outline: 3px solid #0066cc;
        outline-offset: 2px;
    }
    
    .country-selector-item.selected {
        background-color: #000;
        color: #fff;
    }
}

/* Loading State */
.country-selector.loading .country-selector-button {
    opacity: 0.6;
    cursor: wait;
}

.country-selector.loading .country-selector-button::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid #e1e5e9;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Error State */
.country-selector.error .country-selector-button {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.country-selector.error .country-selector-text {
    color: #dc3545;
}

/* Disabled State */
.country-selector.disabled .country-selector-button {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.country-selector.disabled .country-selector-button:hover {
    border-color: #e1e5e9;
    box-shadow: none;
}