/* Custom Dropdown Component - Minimalistic Design */
/* Color Palette: Black, White, Silver, Grey */

.custom-dropdown-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    min-width: 200px;
    z-index: 10;
}

.custom-dropdown-wrapper.active {
    z-index: 10001 !important;
}

/* .custom-dropdown-menu.show{
    position: relative;
} */

.custom-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #000000;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.custom-dropdown-header:hover {
    border-color: #4a4a4a;
    background: #0d0d0d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.custom-dropdown-header.active {
    border-color: #5a5a5a;
    background: #0d0d0d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-dropdown-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.custom-dropdown-icon {
    color: #ffffff;
    transition: transform 0.3s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
}

.custom-dropdown-header.active .custom-dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #000000;
    border: 1px solid #2a2a2a;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    max-height: 30vh;
    overflow-y: auto;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.custom-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Custom Scrollbar */
.custom-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background: #000000;
    border-radius: 4px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #6a6a6a;
}

/* Search Box */
.custom-dropdown-search {
    position: sticky;
    top: 0;
    background: #000000;
    padding: 8px;
    border-bottom: 1px solid #2a2a2a;
    z-index: 99999;
}

.custom-dropdown-search input {
    width: 100%;
    padding: 8px 12px;
    background: #000000;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

.custom-dropdown-search input::placeholder {
    color: #999999;
}

.custom-dropdown-search input:focus {
    border-color: #6a6a6a;
    background: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(100, 100, 100, 0.2);
}

/* Dropdown Options */
.custom-dropdown-options {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.custom-dropdown-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.custom-dropdown-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: #ffffff;
}

.custom-dropdown-option.selected {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-left-color: #ffffff;
    font-weight: 600;
}

.custom-dropdown-option.selected::after {
    content: '✓';
    margin-left: auto;
    color: #ffffff;
    font-weight: bold;
}

.custom-dropdown-option.hidden {
    display: none;
}

/* No Results Message */
.custom-dropdown-no-results {
    padding: 16px;
    text-align: center;
    color: #999999;
    font-size: 13px;
    font-style: italic;
}

/* Disabled State */
.custom-dropdown-wrapper.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.custom-dropdown-header.disabled {
    cursor: not-allowed;
    background: #0a0a0a;
}

/* Focus State for Accessibility */
.custom-dropdown-header:focus-visible {
    outline: 2px solid #4a4a4a;
    outline-offset: 2px;
}

.custom-dropdown-option:focus-visible {
    outline: 2px solid #4a4a4a;
    outline-offset: -2px;
}

/* Animation for dropdown appearance */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 785px) and (max-width: 1400px){
    .preferences-bar-filters.expanded {
            min-height: 70vh;
            max-height: 70vh;
        }
    
    .preferences-bar.expanded,
    .profile-editor-bar.expanded {
        min-height: 70vh;
        max-height: 70vh;
    }
}

@media (min-width: 1400px){
    .preferences-bar-filters.expanded {
            min-height: 50vh;
            max-height: 50vh;
        }
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-dropdown-wrapper {
        min-width: auto;
    }

    .custom-dropdown-selected {
        font-size: 13px;
    }

    .custom-dropdown-option {
        padding: 9px 14px;
        font-size: 13px;
    }

    .custom-dropdown-menu {
        max-height: 250px;
    }
    
    /* Adjust expanded height for mobile */
    .preferences-bar.expanded,
    .profile-editor-bar.expanded {
        min-height: 50vh;
        max-height: 70vh;
    }
    
    .pref-two{
        min-height: 45vh !important;
        max-height: 45vh !important;
    }
}

@media (max-width: 480px) {

    .profile-editor-bar.expanded {
            min-height: 70vh !important;
    }
    
    .custom-dropdown-selected {
        font-size: 12px;
    }

    .custom-dropdown-option {
        padding: 8px 12px;
        font-size: 12px;
    }

    .custom-dropdown-menu {
        max-height: 200px;
    }
    
    /* Further adjust expanded height for small mobile */
    .preferences-bar.expanded,
    .profile-editor-bar.expanded {
        min-height: 42vh;
        max-height: 42vh;
    }
    
    /* Prevent height expansion when purpose filter is clicked on mobile */
    .preferences-bar-filters.expanded {
        min-height: auto;
        max-height: none;
    }
}

/* Force black background for all themes */
@media (prefers-color-scheme: dark), (prefers-color-scheme: light) {
    .custom-dropdown-header {
        background: #000000 !important;
    }
    
    .custom-dropdown-menu {
        background: #000000 !important;
    }
    
    .custom-dropdown-selected {
        color: #ffffff !important;
    }
    
    .custom-dropdown-icon {
        color: #ffffff !important;
    }
    
    .custom-dropdown-option {
        color: #ffffff !important;
    }
    
    .custom-dropdown-search input {
        background: #000000 !important;
        color: #ffffff !important;
        border-color: #3a3a3a !important;
    }
    
    .custom-dropdown-search input::placeholder {
        color: #999999 !important;
    }
}

/* Integration with existing form styles */
.preference-group .custom-dropdown-wrapper {
    width: 100%;
    z-index: 100;
}

.preference-group .custom-dropdown-wrapper.active {
    z-index: 10001 !important;
}

.profile-editor-country-section .custom-dropdown-wrapper {
    width: 100%;
    z-index: 100;
}

.profile-editor-country-section .custom-dropdown-wrapper.active {
    z-index: 10001 !important;
}

/* Ensure custom dropdowns align properly in filters bar */
.preferences-bar-filters .custom-dropdown-wrapper {
    min-width: 200px;
    z-index: 100;
}

.preferences-bar-filters .custom-dropdown-wrapper.active {
    z-index: 10001 !important;
}

/* Ensure dropdown is above all containers */
.preferences-bar,
.preferences-bar-filters {
    position: relative;
    z-index: 1;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

/* Expanded state for containers when dropdown is open */
.preferences-bar.expanded,
.preferences-bar-filters.expanded {
    height: auto;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    border-color: #444;
}

/* .preferences-bar.expanded {
    min-height: 60vh;
    max-height: 60vh;
} */

.profile-editor-bar.expanded {
    height: auto;
    min-height: 60vh;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    border-color: #444;
}

.custom-dropdown-wrapper.active,
.custom-dropdown-wrapper:has(.custom-dropdown-menu.show) {
    z-index: 10001 !important;
}

/* Close other dropdowns in same container */
.preference-group {
    position: relative;
    z-index: 1;
}

.preference-group:has(.custom-dropdown-wrapper.active) {
    z-index: 10000;
}

/* Smooth scrollbar for expanded containers */
.preferences-bar.expanded::-webkit-scrollbar,
.preferences-bar-filters.expanded::-webkit-scrollbar,
.profile-editor-bar.expanded::-webkit-scrollbar {
    width: 8px;
}

.preferences-bar.expanded::-webkit-scrollbar-track,
.preferences-bar-filters.expanded::-webkit-scrollbar-track,
.profile-editor-bar.expanded::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 4px;
}

.preferences-bar.expanded::-webkit-scrollbar-thumb,
.preferences-bar-filters.expanded::-webkit-scrollbar-thumb,
.profile-editor-bar.expanded::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

.preferences-bar.expanded::-webkit-scrollbar-thumb:hover,
.preferences-bar-filters.expanded::-webkit-scrollbar-thumb:hover,
.profile-editor-bar.expanded::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Override original select display when custom dropdown is present */
.custom-dropdown-wrapper + select[style*="display: none"] {
    display: none !important;
}

/* Smooth transitions for showing/hiding job role group */
#jobRoleGroup {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

#jobRoleGroup[style*="display: none"] {
    max-height: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#jobRoleGroup[style*="display: block"] {
    max-height: none;
    opacity: 1;
    overflow: visible;
}

/* Ensure Job dropdown wrapper is visible and properly styled */
#jobRoleGroup .custom-dropdown-wrapper {
    width: 100%;
    min-width: 200px;
}

#jobRoleGroup[style*="display: block"] .custom-dropdown-wrapper {
    display: inline-block;
}

#jobRoleGroup[style*="display: none"] .custom-dropdown-wrapper {
    display: none;
}

/* Responsive Design */