/* Country Code Selector - Professional UI Design */

.phone-input-wrapper {
    display: flex;
    gap: 12px;
    width: 100%;
    position: relative;
}

.country-selector {
    position: relative;
    width: 130px;
    flex-shrink: 0;
}

/* Button Styling - Modern & Clean */
.country-selector-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 16px;
    height: 52px;
    background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
    border: 1.5px solid #e1e4e8;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.country-selector-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.country-selector-button:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15), 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.country-selector-button:hover::before {
    opacity: 1;
}

.country-selector-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.country-selector.open .country-selector-button {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

.country-selector.open .country-selector-button::before {
    opacity: 1;
}

.selected-country {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.country-flag {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.country-code {
    font-weight: 600;
    font-size: 15px;
    color: #1e293b;
    letter-spacing: -0.01em;
}

/* Arrow with smooth rotation */
.dropdown-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #64748b;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.country-selector.open .dropdown-arrow {
    transform: rotate(180deg);
    border-top-color: #3b82f6;
}

/* Dropdown Container - Premium Card Design */
.country-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 280px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 14px;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow: hidden;
    display: none;
    backdrop-filter: blur(10px);
}

.country-selector.open .country-dropdown {
    display: block;
    animation: dropdownSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Search Section - Modern Input */
.country-search {
    padding: 14px;
    background: linear-gradient(to bottom, #fafbfc 0%, #ffffff 100%);
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 2;
}

.country-search-wrapper {
    position: relative;
}

.country-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.2s ease;
}

.country-search input {
    width: 100%;
    padding: 11px 12px 11px 38px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    background: #ffffff;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.country-search input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.country-search input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: #ffffff;
}

.country-search input:focus + .country-search-icon {
    color: #3b82f6;
}

/* Country List - Professional Scroll */
.country-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: #ffffff;
}

.country-list::-webkit-scrollbar {
    width: 6px;
}

.country-list::-webkit-scrollbar-track {
    background: transparent;
}

.country-list::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #cbd5e1, #94a3b8);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.country-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #94a3b8, #64748b);
}

/* Country Options - Enhanced Design */
.country-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin-bottom: 3px;
}

.country-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 70%;
    background: linear-gradient(to bottom, #3b82f6, #6366f1);
    border-radius: 0 4px 4px 0;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.country-option:hover {
    background: linear-gradient(to right, #f0f9ff 0%, #f8fafc 100%);
    transform: translateX(2px);
}

.country-option:hover::before {
    width: 3px;
}

.country-option.selected {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border: 1px solid #bfdbfe;
    font-weight: 600;
}

.country-option.selected::before {
    width: 3px;
}

.country-option:active {
    transform: scale(0.98);
}

.country-option .country-flag {
    font-size: 26px;
    width: 36px;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s ease;
}

.country-option:hover .country-flag {
    transform: scale(1.1);
}

.country-dial-code {
    font-size: 15px;
    color: #334155;
    font-weight: 600;
    flex: 1;
    text-align: left;
    letter-spacing: -0.01em;
}

.country-option.selected .country-dial-code {
    color: #1e40af;
}

.country-option:hover .country-dial-code {
    color: #1e293b;
}

/* Selection Checkmark */
.country-option.selected::after {
    content: '✓';
    position: absolute;
    right: 12px;
    color: #3b82f6;
    font-weight: bold;
    font-size: 16px;
    animation: checkmarkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* No Results State */
.no-results {
    padding: 32px 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.no-results::before {
    content: '🔍';
    display: block;
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Phone Number Input - Matching Design */
.phone-number-input {
    flex: 1;
    padding: 0 16px;
    height: 52px;
    border: 1.5px solid #e1e4e8;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #0f172a;
    background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.phone-number-input:hover {
    border-color: #cbd5e1;
}

.phone-number-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.1);
    background: #ffffff;
    transform: translateY(-1px);
}

.phone-number-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Overlay - Premium Dark */
.country-selector-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    animation: fadeIn 0.2s ease;
}

.country-selector.open .country-selector-overlay {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile Responsive - Optimized */
@media (max-width: 640px) {
    .country-selector {
        width: 115px;
    }

    .country-selector-button {
        padding: 0 12px;
        height: 48px;
    }

    .country-dropdown {
        width: 260px;
        max-height: 380px;
        border-radius: 16px;
    }

    .country-list {
        max-height: 280px;
    }

    .country-option {
        padding: 10px 12px;
    }

    .country-option .country-flag {
        font-size: 24px;
        width: 32px;
    }

    .country-dial-code {
        font-size: 14px;
    }

    .phone-number-input {
        height: 48px;
        font-size: 14px;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .country-selector {
        width: 125px;
    }

    .country-dropdown {
        width: 270px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .country-selector-button {
        background: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
        border-color: #334155;
        color: #f1f5f9;
    }

    .country-dropdown {
        background: #1e293b;
        border-color: #334155;
    }

    .country-search {
        background: linear-gradient(to bottom, #0f172a 0%, #1e293b 100%);
        border-bottom-color: #334155;
    }

    .country-search input {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }

    .country-list {
        background: #1e293b;
    }

    .country-option:hover {
        background: linear-gradient(to right, #334155 0%, #1e293b 100%);
    }

    .country-dial-code {
        color: #cbd5e1;
    }

    .phone-number-input {
        background: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
        border-color: #334155;
        color: #f1f5f9;
    }
}

/* Accessibility - Focus Visible */
.country-selector-button:focus-visible,
.country-search input:focus-visible,
.phone-number-input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.country-option:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}
