/**
 * Custom dropdown — site-wide replacement for the native <select>.
 *
 * Usage: any <select> the page renders gets auto-wrapped by dropdown.js
 * with .x-dd markup that this stylesheet themes. The original <select>
 * stays in the DOM (synced both ways) so existing handlers like
 *   $('#bank_select').on('change', ...)
 * keep working without changes. Opt out per-element with `data-x-dd="off"`
 * or `class="no-x-dd"` — useful for jQuery plugins (Select2, intl-tel-input,
 * Bootstrap DualListbox) that already manage their own widget.
 */

/* Hide the native control completely once it's enhanced — visually-hidden
   for a11y instead of display:none so screen readers still see it. */
.x-dd-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.x-dd {
    position: relative;
    display: block;
    width: 100%;
    color: #d1d4dc;
    font-size: 0.95rem;
    font-family: inherit;
}

.x-dd-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #131722;
    color: #d1d4dc;
    border: 1px solid rgba(38, 166, 154, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-align: left;
    transition:
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}
.x-dd-button:hover { border-color: rgba(38, 166, 154, 0.55); }
.x-dd-button:focus,
.x-dd.is-open .x-dd-button {
    outline: none;
    border-color: #26a69a;
    box-shadow: 0 0 0 3px rgba(38, 166, 154, 0.2);
}
.x-dd-button:disabled,
.x-dd.is-disabled .x-dd-button {
    opacity: 0.55;
    cursor: not-allowed;
    background: #1a1f2b;
}

.x-dd-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.x-dd-placeholder { color: #6c7280; font-weight: 400; }

.x-dd-chevron {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-right: 2px solid #26a69a;
    border-bottom: 2px solid #26a69a;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.18s ease;
}
.x-dd.is-open .x-dd-chevron {
    transform: translateY(2px) rotate(-135deg);
}

.x-dd-panel {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #1e222d;
    border: 1px solid rgba(38, 166, 154, 0.35);
    border-radius: 10px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
    padding: 6px;
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
    pointer-events: none;
    transition:
        opacity 0.14s ease,
        transform 0.14s ease;
}
.x-dd.is-open .x-dd-panel {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.x-dd-panel.x-dd-above {
    top: auto;
    bottom: calc(100% + 6px);
}

/* Scrollbar — minimal, matches the dark theme. */
.x-dd-panel::-webkit-scrollbar { width: 8px; }
.x-dd-panel::-webkit-scrollbar-track { background: transparent; }
.x-dd-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}
.x-dd-panel::-webkit-scrollbar-thumb:hover { background: rgba(38, 166, 154, 0.4); }

.x-dd-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #d1d4dc;
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.35;
    user-select: none;
    transition:
        background 0.1s ease,
        color 0.1s ease;
}
.x-dd-option:hover,
.x-dd-option.is-active {
    background: rgba(38, 166, 154, 0.12);
    color: #fff;
}
.x-dd-option.is-selected {
    color: #26a69a;
    font-weight: 600;
}
.x-dd-option.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.x-dd-option .x-dd-check {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0;
    color: #26a69a;
}
.x-dd-option.is-selected .x-dd-check { opacity: 1; }

.x-dd-empty {
    padding: 14px;
    text-align: center;
    color: #6c7280;
    font-size: 0.9rem;
}
