/* Mirrors the react-select control in SelectField so a multi-select sits flush
   with the LabelField/SelectField inputs beside it in a form row. */
.mc-multiselect {
    position: relative;
    width: 100%;
}

.mc-multiselect-toggle {
    /* Drives both the control height and the label's line box below, so the
       two can't drift apart. Matches SelectField's 34px .h-sm control. */
    --mc-multiselect-h: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: var(--mc-multiselect-h);
    /* The global sheets don't set a universal border-box, so without this the
       15px+8px padding and the border are added ON TOP of width:100% and the
       row overflows its own button — which the legacy
       `.genre-star > div > button { overflow: hidden }` rule then hides. */
    box-sizing: border-box;
    /* ZoomableImage.css carries an unscoped `button { margin-bottom: 5px }`;
       this toggle is a <button>, so without the reset it sat 5px taller than
       the react-select control and pushed the field's error line away. */
    margin: 0;
    padding: 0 8px 0 15px;
    border: 1px solid var(--deepBorder);
    border-radius: 4px;
    background-color: var(--field-bg);
    color: var(--textColor);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.36 !important;
    text-align: left;
    cursor: pointer;
}

.mc-multiselect-toggle:hover {
    border-color: var(--deepBorder);
}

.mc-multiselect-toggle:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.mc-multiselect-toggle.is-placeholder .mc-multiselect-toggle-label {
    color: var(--placeholderColor);
}

/* Measured in the browser: this span had the correct width, colour and opacity
   but a height of 0, and its own `overflow: hidden` then clipped the text away
   completely — the control looked empty while "4 selected" sat in the DOM the
   whole time. The button's `align-items: center` sizes this item to its own
   content height, so anything that zeroes that height (an inherited
   line-height of 0) silently erases the label.
   Two independent guards, because either alone can be defeated:
     - align-self: stretch  -> height comes from the row, not from content, so
                               it can never compute to 0;
     - explicit line-height -> a line box that also centres the text, immune to
                               whatever is inherited (the -2px is the border).
   flex/min-width keep the label claiming the free space and ellipsising when
   the value is too long; the label growing is also what pushes the arrow to
   the right edge, replacing justify-content:space-between on the button.
   Selector is doubled up (0,2,0) so it outranks the rule that was winning. */
.mc-multiselect-toggle .mc-multiselect-toggle-label {
    flex: 1 1 auto;
    min-width: 0;
    align-self: stretch;
    line-height: calc(var(--mc-multiselect-h) - 2px) !important;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--textColor);
}

.mc-multiselect-toggle-arrow {
    display: flex;
    flex: 0 0 auto;
    color: var(--placeholderColor);
}

.mc-multiselect-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    min-width: 240px;
    z-index: 3;
    border-radius: 4px;
    background-color: var(--field-bg);
    box-shadow: 0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1);
}

.mc-multiselect-menu.is-right-aligned {
    left: auto;
    right: 0;
}
