/* Custom Dropdown Base */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.custom-dropdown-button {
    width: 80px;
    background: var(--control-bg);
    border: none;
    color: var(--text-secondary);
    padding: 0 6px;
    font-size: 9px;
    font-family: "Noto Sans", monospace;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 20px;
    line-height: 16px;
    display: block;
}

.custom-dropdown-button-text-wrapper {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

.custom-dropdown-button-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dropdown.open .custom-dropdown-button {
    background: var(--control-bg);
    color: var(--text-secondary);
}

.custom-dropdown-arrow {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7em;
    color: var(--text-secondary);
    pointer-events: none;
    transition: transform 0.2s ease;
}

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

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(28, 28, 28, 0.95);
    list-style: none;
    padding: 4px 0;
    margin: 0;
    z-index: var(--z-floating);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.custom-dropdown-menu::-webkit-scrollbar {
    display: none;
}

/* Floating Dropdowns */
.floating-dropdown .custom-dropdown-menu {
    position: fixed;
    z-index: var(--z-floating-high);
}

.custom-dropdown-scroll-container {
    background:rgba(28, 28, 28, 0.1);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 1px;
    display: flex;
    align-items: flex-start;
    z-index: var(--z-floating);
}

.custom-dropdown-scroll-container .custom-dropdown-menu {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin: 0;
    flex: 1;
    display: block;
}

/* Menu/Scrollbar wrapper for when search is present */
.custom-dropdown-menu-scroll-wrapper {
    display: flex;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.custom-dropdown-menu-scroll-wrapper .custom-dropdown-menu {
    flex: 1;
    min-height: 0;
    max-height: 200px;
}

/* Dropdown Items */
.custom-dropdown-item {
    padding: 6px 9px;
    font-size: var(--text-2xs);
    font-family: "Noto Sans", monospace;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
    user-select: none;
    text-align: left;
}

.custom-dropdown-item:hover,
.custom-dropdown-item:focus {
    background: #3c3c45;
}

.custom-dropdown-item.selected {
    background: var(--text-secondary);
    color: #181820;
    font-weight: bold;
}

/* Category Headers */
.custom-dropdown-category {
    padding: 8px 9px 4px 9px;
    font-size: var(--text-2xs);
    font-family: "Noto Sans", monospace;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    text-transform: uppercase;
    user-select: none;
    background: rgba(60, 60, 69, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 4px;
    pointer-events: none;
}

.custom-dropdown-category:first-child {
    margin-top: 0;
}

/* LFO Shape Dropdown */
.lfo-section .lfo-shape-group .custom-dropdown {
    flex: 0 0 auto;
}

/* Warp Mode Dropdown */
[data-knob-id="warp"] {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

[data-knob-id="warp"] .knob-label {
    display: none;
}

[data-knob-id="warp"] .knob-container {
    order: 1;
}

[data-knob-id="warp"] .warp-dropdown-container {
    order: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px;
}

[data-knob-id="warp"] select,
[data-knob-id="warp"] .custom-dropdown {
    position: relative;
    width: 60px;
    max-width: 60px;
    min-width: 60px;
    margin: 0;
    display: inline-block;
    flex-shrink: 0;
}

/* Warp navigation arrow buttons */
.warp-nav-arrow {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: bold;
    width: 10px;
    height: 10px;
    padding: 0;
    margin: 0;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}

.warp-nav-arrow:hover {
    color: var(--text-primary);
}

.warp-nav-arrow:active {
    transform: scale(0.95);
}

[data-knob-id="warp"] .custom-dropdown-button {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60px;
    height: 15px;
    margin-top: 4px;
    background: #1a1a1a;
    font-family: "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, Monaco, "Courier New", monospace;
    font-size: var(--text-2xs);
    font-weight: 500;
    letter-spacing: 1.7px;
    text-transform: uppercase;
}

[data-knob-id="warp"] .custom-dropdown-menu,
[data-knob-id="warp"] .custom-dropdown-item {
    font-family: "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, Monaco, "Courier New", monospace;
    font-weight: 500;
    letter-spacing: 1.7px;
    text-transform: uppercase;
}

[data-knob-id="warp"] .custom-dropdown-menu {
    min-width: 140px;
    width: 140px;
}

[data-knob-id="warp"] .custom-dropdown-button-text-wrapper {
    display: inline-block;
    /* Visible text window inside 60px button, leaving space for arrow and padding */
    max-width: 36px;
    overflow: hidden;
    vertical-align: middle;
    pointer-events: none;
}

[data-knob-id="warp"] .custom-dropdown-button-text {
    display: inline-block;
    will-change: transform;
    transform: translateX(0);
}

@keyframes dropdown-text-scroll {
    to { transform: translateX(var(--scroll-distance)); }
}

/* Auto-trigger scroll whenever overflow exists */
[data-knob-id="warp"] .custom-dropdown-button.has-scrolling-text .custom-dropdown-button-text {
    animation: dropdown-text-scroll var(--scroll-duration, 2200ms) ease-in-out var(--scroll-delay, 400ms) infinite alternate;
}

[data-knob-id="warp"] .custom-dropdown-scroll-container {
    width: 140px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 1px;
}

/* Warp Mode Search */
.custom-dropdown-search-container {
    padding: 6px;
    background: rgba(28, 28, 28, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-dropdown-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-dropdown-search-input {
    width: 100%;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    padding: 4px 28px 4px 8px;
    font-size: var(--text-2xs);
    font-family: "Noto Sans", monospace;
    font-weight: 500;
    letter-spacing: 0.5px;
    outline: none;
    transition: all 0.15s ease;
    box-sizing: border-box;
    height: 24px;
    line-height: 16px;
}

.custom-dropdown-search-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(50, 50, 50, 0.9);
}

.custom-dropdown-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.custom-dropdown-search-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0.6;
    width: 20px;
    height: 20px;
}

.custom-dropdown-search-clear:hover {
    opacity: 1;
    color: var(--text-primary);
}

.custom-dropdown-search-clear:focus {
    outline: 1px solid rgba(255, 255, 255, 0.3);
    outline-offset: -1px;
    border-radius: 2px;
}

/* Warp Mode Tooltip */
.warp-mode-tooltip {
    position: fixed;
    z-index: 10000;
    background: rgba(28, 28, 28, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 12px;
    width: 480px;
    max-height: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    pointer-events: none;
    display: none;
    box-sizing: border-box;
}

.warp-tooltip-content {
    display: flex;
    flex-direction: row;
    gap: 12px;
    height: auto;
    min-height: 0;
}

.warp-tooltip-text-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-width: 0;
    max-height: 296px; /* 320px - 24px padding */
}

.warp-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.warp-tooltip-header strong {
    color: var(--text-primary, #fff);
    font-size: 14px;
    font-weight: 600;
}

.warp-tooltip-category {
    background: var(--accent-color, rgba(201, 201, 201, 0.2));
    color: var(--accent-color, #c9c9c9);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.warp-tooltip-subcategory {
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-size: 11px;
    font-style: italic;
    margin-top: -4px;
    flex-shrink: 0;
    max-height: 20px;
    overflow: hidden;
}

.warp-tooltip-description {
    color: var(--text-secondary, rgba(255, 255, 255, 0.8));
    font-size: 12px;
    line-height: 1.4;
    margin: 4px 0;
    flex-shrink: 0;
}

.warp-tooltip-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0;
    flex-shrink: 0;
}

.warp-tooltip-control {
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    font-size: 11px;
    line-height: 1.3;
}

.warp-tooltip-control strong {
    color: var(--text-primary, rgba(255, 255, 255, 0.9));
    font-weight: 600;
}

.warp-tooltip-viz-section {
    flex-shrink: 0;
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.warp-tooltip-viz-label {
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.warp-tooltip-viz-description {
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    font-size: 10px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.warp-tooltip-visualization {
    width: 200px;
    height: 120px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

