/* ============================================
   CUSTOM DROPDOWN — Replaces native <select>
   Fully styled, searchable, premium design
   ============================================ */

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

/* ---- Trigger (replaces the <select> visible area) ---- */
.custom-dropdown-trigger {
    width: 100%;
    padding: 12px 42px 12px 14px;
    border-radius: 12px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    user-select: none;
}
.custom-dropdown-trigger:hover {
    border-color: rgba(124,58,237,0.4);
    background: rgba(124,58,237,0.06);
}
.custom-dropdown.open .custom-dropdown-trigger {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.15), 0 4px 12px rgba(124,58,237,0.1);
    background: rgba(124,58,237,0.08);
}

/* Chevron arrow */
.custom-dropdown-arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    transition: transform 0.25s ease;
    color: var(--text-tertiary);
}
.custom-dropdown.open .custom-dropdown-arrow {
    transform: rotate(180deg);
    color: #a78bfa;
}

/* Text label */
.custom-dropdown-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Options List ---- */
.custom-dropdown-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    border-radius: 14px;
    border: 1.5px solid transparent;
    background: var(--bg-secondary, #1a1a2e);
    z-index: 600;
    opacity: 0;
    transform: translateY(-6px);
    transition: all 0.2s ease;
    box-shadow: none;
}
.custom-dropdown.open .custom-dropdown-options {
    max-height: 300px;
    overflow-y: auto;
    border-color: rgba(124,58,237,0.2);
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,58,237,0.08);
}

/* Scrollbar */
.custom-dropdown-options::-webkit-scrollbar {
    width: 5px;
}
.custom-dropdown-options::-webkit-scrollbar-track {
    background: transparent;
    margin: 6px 0;
}
.custom-dropdown-options::-webkit-scrollbar-thumb {
    background: rgba(124,58,237,0.3);
    border-radius: 99px;
}
.custom-dropdown-options::-webkit-scrollbar-thumb:hover {
    background: rgba(124,58,237,0.5);
}

/* Search input inside dropdown */
.custom-dropdown-search {
    position: sticky;
    top: 0;
    padding: 10px 12px;
    background: var(--bg-secondary, #1a1a2e);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    z-index: 1;
}
.custom-dropdown-search input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.custom-dropdown-search input:focus {
    border-color: rgba(124,58,237,0.3);
}
.custom-dropdown-search input::placeholder {
    color: var(--text-tertiary);
}

/* ---- Individual Option ---- */
.custom-dropdown-option {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.custom-dropdown-option:last-child {
    border-bottom: none;
}
.custom-dropdown-option:hover {
    background: rgba(124,58,237,0.08);
    color: var(--text-primary);
}
.custom-dropdown-option.selected {
    background: rgba(124,58,237,0.12);
    color: #c4b5fd;
    font-weight: 600;
}
.custom-dropdown-option.selected::before {
    content: '✓';
    font-size: 11px;
    color: #7c3aed;
    font-weight: 700;
}

/* Warning badge for accounts */
.custom-dropdown-option .opt-warn {
    color: #f59e0b;
    font-size: 11px;
    flex-shrink: 0;
}

/* No results */
.custom-dropdown-empty {
    padding: 16px 14px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    font-style: italic;
}

/* ---- Light Mode ---- */
.light-mode .custom-dropdown-trigger {
    background: #f8fafc;
    border-color: rgba(0,0,0,0.12);
    color: #0f172a;
}
.light-mode .custom-dropdown-trigger:hover {
    background: rgba(124,58,237,0.03);
    border-color: rgba(124,58,237,0.3);
}
.light-mode .custom-dropdown.open .custom-dropdown-trigger {
    background: rgba(124,58,237,0.04);
}
.light-mode .custom-dropdown-options {
    background: #ffffff;
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
.light-mode .custom-dropdown-option:hover {
    background: rgba(124,58,237,0.05);
}
.light-mode .custom-dropdown-option.selected {
    background: rgba(124,58,237,0.08);
    color: #6d28d9;
}
.light-mode .custom-dropdown-search input {
    background: #f1f5f9;
    border-color: rgba(0,0,0,0.08);
    color: #0f172a;
}
