/* ============================================================================
   dc-select — progressive-enhancement custom dropdown for native <select>.

   The native <select> stays in the DOM but hidden (so form submission, the
   `change` event, and the disabled state keep working); a <button> trigger
   that COPIES the select's own classes replaces it visually, so it looks
   identical in every context. Only the opened option list is custom — a
   rounded panel instead of the OS-drawn popup, which CSS cannot round.

   Enhancement is done by js/misc/dc-select.js.
   ============================================================================ */

.dc-select {
    position: relative;
}

/* Keep the real control for value / submit / change events, out of sight. */
.dc-select > select {
    display: none !important;
}

/* The trigger inherits its border/padding/background/arrow/font from the
   select classes copied onto it — so DON'T set those here, or the copied
   classes (which give each context its look) would be overridden. Only the
   bits a <button> needs to read like a select's text box live here. */
.dc-select-trigger {
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
    cursor: pointer;
}
.dc-select.is-disabled .dc-select-trigger,
.dc-select-trigger:disabled {
    cursor: not-allowed;
}

/* The rounded option list — this is the part the native popup can't do. */
.dc-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1000;
    /* Border-box so the panel's own padding + border count inside min-width:
       100%, keeping it flush with the trigger's width instead of ~14px wider.
       min-width (not width) is kept so a longer option can still grow it. */
    box-sizing: border-box;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 12px 30px -8px rgba(15, 23, 42, 0.22);
    display: none;
    /* Slim, rounded scrollbar (Firefox). */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.dc-select.open .dc-select-panel {
    display: block;
}
/* Slim, rounded scrollbar (WebKit/Blink). The transparent border + padding-box
   clip insets the thumb so it reads as a thin pill rather than a fat bar. */
.dc-select-panel::-webkit-scrollbar {
    width: 11px;
}
.dc-select-panel::-webkit-scrollbar-track {
    background: transparent;
}
.dc-select-panel::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
.dc-select-panel::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Opt-in filter box (data-dc-search) — pinned to the top of the panel while
   the options below scroll. The negative top/side margins bleed over the
   panel's 6px padding, and `top: -6px` cancels that padding so the box sticks
   flush to the panel's border (not 6px down). Its white background + bottom
   border then fully cover the top, so no option scrolls through above it. */
.dc-select-search {
    position: sticky;
    top: -6px;
    z-index: 1;
    background: #fff;
    margin: -6px -6px 4px;
    padding: 8px 8px 8px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px 12px 0 0;
}
.dc-select-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--dc-dark-blue, #1f2d3d);
    outline: none;
}
.dc-select-search-input:focus {
    border-color: var(--dc-blue, #193e82);
}
.dc-select-no-results {
    padding: 8px 12px;
    font-size: 0.875rem;
    color: #a0aab8;
}

.dc-select-option {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--dc-dark-blue, #1f2d3d);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dc-select-option:hover,
.dc-select-option.active {
    background: #f1f5f9;
}
.dc-select-option.selected {
    background: rgba(var(--dc-primary-rgb, 25, 62, 130), 0.1);
    font-weight: 600;
}
.dc-select-option.disabled {
    color: #a0aab8;
    cursor: not-allowed;
}
