/* <Dropdown /> — default styling, lm-dropdown-* convention (v5 chrome) */
.lm-dropdown {
    user-select: none;
    cursor: pointer;
    box-sizing: border-box;
    vertical-align: top;
    font: 13.5px/1.4 system-ui, sans-serif;
    color: var(--lm-font-color, #18181b);
    position: relative;
}

.lm-dropdown[data-disabled='true'] {
    opacity: 0.5;
    pointer-events: none;
}

.lm-dropdown-header {
    display: flex;
    align-items: center;
    position: relative;
}

.lm-dropdown-input {
    padding: 7px 28px 7px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
    min-height: 34px;
    background: var(--lm-background-color, #fff);
    border: 1px solid var(--lm-border-input, #ccc);
    border-radius: var(--lm-radius-input, 4px);
    position: relative;
    display: flex;
    align-items: center;
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lm-dropdown-input:hover {
    border-color: var(--lm-border-color-highlight, #bbb);
}

.lm-dropdown-input[contenteditable='true'] {
    cursor: text;
}

/* Open state — neutral border bump (the panel below is the real "open" cue).
   FOCUS is intentionally left to the central :focus-visible ring so the
   dropdown focuses identically to every other input — no custom blue. */
.lm-dropdown[data-state='true'] .lm-dropdown-input {
    border-color: var(--lm-border-color-highlight, #bbb);
}

.lm-dropdown-input > br {
    display: none;
}

/* The arrow — the same solid caret the quickmenu uses, rotating while open
   (shared so selects/dropdowns/quickmenus look identical) */
.lm-dropdown-input::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    top: calc(50% - 12px);
    right: 2px;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath d='M7 10l5 5 5-5H7z' fill='gray'/%3E%3C/svg%3E");
    transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lm-dropdown[data-state='true'] .lm-dropdown-input::after {
    transform: rotate(-180deg);
}

.lm-dropdown-input:empty::before {
    content: attr(placeholder);
    color: var(--lm-font-grayout, #a1a1aa);
}

/* Insert (+) button, visible while open with insert enabled (v5) */
.lm-dropdown-add {
    position: absolute;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    right: 28px;
    top: calc(50% - 9px);
    width: 18px;
    height: 18px;
    line-height: 1;
}

.lm-dropdown-add::after {
    content: '+';
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    color: var(--lm-font-color, #18181b);
}

.lm-dropdown[data-insert='true'] .lm-dropdown-input {
    padding-right: 46px;
}

/* The panel is a CSS-anchored Modal (position absolute): placed under
   the input by the browser itself, so it follows any scrolling natively */
.lm-dropdown .lm-modal-root[data-position='absolute'] {
    top: calc(100% + 1px);
    left: 0;
}

/* The panel is a Modal: flush, list-ready. The WIDTH comes from the
   width prop (>= the input width, computed at open) — min-width:100%
   would resolve against the viewport on a fixed-position panel. */
.lm-dropdown .lm-modal {
    padding: 0;
    min-width: 0;
    min-height: 5px;
    border: 1px solid var(--lm-border-color, #e4e4e7);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    animation: lm-dropdown-in 0.14s ease-out;
}

@keyframes lm-dropdown-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lm-dropdown .lm-modal {
        animation: none;
    }
}

.lm-dropdown .lm-modal-content {
    padding: 0;
}

/* Virtualized list (datagrid pattern) */
.lm-dropdown-lazy {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    box-sizing: border-box;
}

.lm-dropdown-canvas {
    position: relative;
}

.lm-dropdown-window {
    will-change: transform;
}

.lm-dropdown-item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 36px 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    cursor: pointer;
    transition: background-color 0.1s;
}

.lm-dropdown-item:hover,
.lm-dropdown-item[data-cursor='true'] {
    background-color: var(--lm-background-color-highlight, #f4f4f5);
}

/* selected: solid dodger blue + white, the native-select look (Paul:
   #1e90ff — the accent token read too purple, system Highlight varies
   by platform) */
.lm-dropdown-item[data-selected='true'] {
    background-color: var(--lm-dropdown-selected, #1e90ff);
    color: var(--lm-dropdown-selected-text, #fff);
    font-weight: 500;
}

.lm-dropdown-item[data-selected='true']::after {
    content: '';
    position: absolute;
    right: 12px;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2714%27 height=%2714%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23fff%27 stroke-width=%273%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M20 6L9 17l-5-5%27/%3E%3C/svg%3E") center no-repeat;
}

.lm-dropdown-item[data-selected='true']:hover,
.lm-dropdown-item[data-cursor='true'][data-selected='true'] {
    background-color: color-mix(in srgb, var(--lm-dropdown-selected, #1e90ff) 88%, #000);
}

.lm-dropdown-item[data-disabled='true'] {
    opacity: 0.5;
    pointer-events: none;
}

.lm-dropdown-item > img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.lm-dropdown-group {
    box-sizing: border-box;
    display: flex;
    align-items: flex-end;
    padding: 0 12px 4px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--lm-font-grayout, #71717a);
    background: transparent;
}

.lm-dropdown-empty {
    padding: 14px;
    text-align: center;
    color: var(--lm-font-grayout, #a1a1aa);
}

/* Done/Reset controls — sheet modes only (v5) */
.lm-dropdown-header-controls {
    display: none;
}

.lm-dropdown-header-controls button {
    background: transparent;
    text-transform: uppercase;
    cursor: pointer;
    padding: 14px;
    font-weight: 700;
    border: 0;
    color: var(--lm-main-color, #2563eb);
    font: inherit;
}

/* Loading spinner replaces the chevron (v5) */
.lm-dropdown-loading .lm-dropdown-input::after {
    width: 12px;
    height: 12px;
    top: calc(50% - 7px);
    right: 8px;
    border: 1px solid var(--lm-font-grayout, #888);
    border-top-color: transparent;
    border-radius: 50%;
    background-image: none;
    animation: lm-dropdown-spin 0.8s linear infinite;
}

@keyframes lm-dropdown-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Picker: bottom sheet (v5) */
.lm-dropdown[data-type='picker'] .lm-modal {
    width: 100% !important;
    border-radius: 12px 12px 0 0;
    border: 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}

.lm-dropdown[data-type='picker'][data-state='true'] .lm-dropdown-header-controls,
.lm-dropdown[data-type='searchbar'][data-state='true'] .lm-dropdown-header-controls {
    display: flex;
}

.lm-dropdown[data-type='picker'] .lm-dropdown-item,
.lm-dropdown[data-type='searchbar'] .lm-dropdown-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    font-size: 1.05em;
}

/* Searchbar: fullscreen take-over (v5) */
.lm-dropdown[data-type='searchbar'][data-state='true'] {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
    background: var(--lm-background-color, #fff);
    z-index: 60;
}

.lm-dropdown[data-type='searchbar'][data-state='true'] .lm-dropdown-input {
    font-size: 1.4em;
    border: 0;
    border-bottom: 1px solid var(--lm-border-color, #e4e4e7);
    border-radius: 0;
    height: 56px;
    flex: 1;
}

.lm-dropdown[data-type='searchbar'][data-state='true'] .lm-dropdown-input::after {
    background: none;
}

.lm-dropdown[data-type='searchbar'] .lm-modal {
    width: 100% !important;
    height: calc(100% - 56px) !important;
    border: 0;
    box-shadow: none;
}
