.ydn-custom-select {
    --ydn-select-bg: var(--bg-tertiary, var(--bg-secondary, var(--card-bg, #ffffff)));
    --ydn-select-bg-elevated: var(--bg-secondary, var(--card-bg, #ffffff));
    --ydn-select-text: var(--text-primary, var(--text-color, #0f172a));
    --ydn-select-muted: var(--text-muted, var(--text-secondary, #64748b));
    --ydn-select-border: var(--border-color, rgba(15, 23, 42, 0.12));
    --ydn-select-accent: var(--primary, var(--cta-color, #0369a1));
    --ydn-select-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    position: relative;
    display: block;
    width: 100%;
}

[data-theme="dark"] .ydn-custom-select {
    --ydn-select-shadow: 0 22px 48px rgba(2, 6, 23, 0.52);
}

.ydn-custom-select--inline {
    display: inline-block;
    width: auto;
    vertical-align: middle;
}

.ydn-custom-select__native {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ydn-custom-select__trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 32px !important;
    padding: 0 24px 0 12px !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 2px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    color: #333333 !important;
    font: inherit;
    font-size: 12px !important;
    line-height: 30px !important;
    text-align: left;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

[data-theme="dark"] .ydn-custom-select__trigger {
    background: var(--ydn-select-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
    color: #e2e2e2 !important;
}

.ydn-custom-select__trigger:hover {
    border-color: var(--ydn-select-accent) !important;
    box-shadow: none !important;
}

.ydn-custom-select__trigger:focus-visible,
.ydn-custom-select.is-open .ydn-custom-select__trigger,
.ydn-custom-select:focus-within .ydn-custom-select__trigger {
    border-color: var(--ydn-select-accent) !important;
    box-shadow: none !important;
    outline: none;
    background: #ffffff !important;
}

.ydn-custom-select.is-invalid .ydn-custom-select__trigger {
    border-color: #ff4d4f !important;
    box-shadow: none !important;
}

.ydn-custom-select.is-disabled .ydn-custom-select__trigger {
    opacity: 0.72;
    cursor: not-allowed;
    box-shadow: none !important;
    background: #f5f5f5 !important;
}

.ydn-custom-select__label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

.ydn-custom-select.is-placeholder .ydn-custom-select__label {
    color: var(--ydn-select-muted);
}

.ydn-custom-select__icon {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 8px;
    height: 8px;
    margin-top: -5px;
    border-right: 1px solid #666;
    border-bottom: 1px solid #666;
    transform: rotate(45deg);
    color: transparent;
    transition: transform 0.2s ease, margin-top 0.2s ease;
    pointer-events: none;
}

.ydn-custom-select.is-open .ydn-custom-select__icon {
    margin-top: -1px;
    transform: rotate(-135deg);
    border-color: var(--ydn-select-accent);
}

.ydn-custom-select__dropdown {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 5000;
    display: none;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
    border: 1px solid #dcdcdc;
    border-radius: 2px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .ydn-custom-select__dropdown {
    background: var(--ydn-select-bg);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.ydn-custom-select__dropdown.is-open {
    display: block;
}

.ydn-custom-select__option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 6px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #333333;
    font: inherit;
    font-size: 12px;
    line-height: 20px;
    text-align: left;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.ydn-custom-select__option:hover,
.ydn-custom-select__option:focus-visible {
    background: rgba(3, 105, 161, 0.08);
    color: var(--ydn-select-accent);
    outline: none;
}

[data-theme="dark"] .ydn-custom-select__option:hover,
[data-theme="dark"] .ydn-custom-select__option:focus-visible {
    background: rgba(59, 130, 246, 0.14);
}

[data-theme="dark"] .ydn-custom-select__option {
    color: #e2e2e2;
}

.ydn-custom-select__option.is-selected {
    background: rgba(3, 105, 161, 0.12);
    color: var(--ydn-select-accent);
    font-weight: 600;
}

[data-theme="dark"] .ydn-custom-select__option.is-selected {
    background: rgba(59, 130, 246, 0.18);
}

.ydn-custom-select__option.is-disabled {
    color: var(--ydn-select-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.ydn-custom-select__option.is-disabled:hover,
.ydn-custom-select__option.is-disabled:focus-visible {
    background: transparent;
    color: var(--ydn-select-muted);
}

.ydn-custom-select--sm .ydn-custom-select__trigger {
    min-height: 28px !important;
    padding: 0 20px 0 8px !important;
    border-radius: 2px !important;
    font-size: 12px !important;
    line-height: 26px !important;
}

.ydn-custom-select--sm .ydn-custom-select__icon {
    right: 0.75rem;
    width: 8px;
    height: 8px;
}

.ydn-custom-select__dropdown::-webkit-scrollbar {
    width: 8px;
}

.ydn-custom-select__dropdown::-webkit-scrollbar-thumb {
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.6);
}
