/* ============================================
   Custom Dropdown Component
   Dark theme styled dropdown to replace native select
   ============================================ */

.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown__trigger {
    width: 100%;
    padding: 14px 16px;
    padding-right: 44px;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    background: rgba(15, 20, 25, 0.8);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-align: start;
}

.custom-dropdown__trigger:hover {
    border-color: var(--border-secondary);
    background: rgba(15, 20, 25, 0.95);
}

.custom-dropdown__trigger:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.custom-dropdown.open .custom-dropdown__trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.custom-dropdown__trigger-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.custom-dropdown__trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dropdown__arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    color: var(--text-secondary);
    transition: transform var(--transition-base);
    pointer-events: none;
}

.custom-dropdown.open .custom-dropdown__arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary);
}

.custom-dropdown__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: linear-gradient(145deg, rgba(21, 26, 35, 0.98), rgba(13, 18, 28, 0.98));
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-height: 280px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

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

.custom-dropdown__option {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 12px 16px;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.custom-dropdown__option:last-child {
    border-bottom: none;
}

.custom-dropdown__option:hover {
    background: rgba(14, 165, 233, 0.1);
}

.custom-dropdown__option.selected {
    background: rgba(14, 165, 233, 0.15);
    color: var(--primary);
}

.custom-dropdown__option-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.custom-dropdown__option.selected .custom-dropdown__option-icon {
    color: var(--primary);
}

.custom-dropdown__option-text {
    flex: 1;
}

.custom-dropdown__option-check {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.custom-dropdown__option.selected .custom-dropdown__option-check {
    opacity: 1;
}

/* Hidden native select for form submission */
.custom-dropdown__native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Scrollbar styling */
.custom-dropdown__menu::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown__menu::-webkit-scrollbar-track {
    background: transparent;
}

.custom-dropdown__menu::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 3px;
}

.custom-dropdown__menu::-webkit-scrollbar-thumb:hover {
    background: var(--border-secondary);
}

/* RTL Support */
[dir="rtl"] .custom-dropdown__trigger {
    padding-right: 16px;
    padding-left: 44px;
    text-align: end;
}

[dir="rtl"] .custom-dropdown__arrow {
    right: auto;
    left: 16px;
}

[dir="rtl"] .custom-dropdown__option {
    flex-direction: row-reverse;
}
