/* ColumnDropdown — caret in a table header plus the dropdown it opens.
   Menu shape follows the map dropdown so both read as the same component. */

.sd-col-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
    vertical-align: middle;
    cursor: pointer;
}

/* caret drawn from borders in currentColor, so it follows the header's theme colour */
.sd-col-dropdown::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.65;
}

/* The funnel says "this column is filtered" without the menu having to be open; Material
   Symbols is already loaded for the map's action icons. Two classes are needed because
   google-icons.css loads later and sets .material-symbols-outlined to inline-block. */
.sd-col-dropdown .sd-col-dropdown-funnel {
    display: none;
    font-size: 15px;
    line-height: 1;
    /* dark gray in light theme, light gray in dark -- same token as the search focus ring */
    color: var(--sd-neutral-600);
}

.sd-col-dropdown.has-filters .sd-col-dropdown-funnel {
    display: inline-block;
}

/* no accent colour on an active filter: the caret stays the header's own, just at
   full strength -- same as on hover */
.sd-col-dropdown:hover::after,
.sd-col-dropdown.has-filters::after {
    opacity: 1;
}

/* The dropdown owns this header, so DataTables' sort icon must not show and the whole
   cell -- not just the caret -- has to read as clickable. `orderable: false` already
   stopped DataTables binding click-to-sort there. */
/* the second selector has to out-specify .sd-table.sd-table-v2 thead .sorting_desc,
   which sets the icon with !important once the column becomes the active sort */
table.dataTable thead th.sd-col-dropdown-host,
.sd-table.sd-table-v2 thead th.sd-col-dropdown-host {
    background-image: none !important;
    padding-right: 10px;
    cursor: pointer;
}

.sd-col-dropdown-menu {
    position: fixed;
    z-index: 1060; /* above .modal-backdrop (1040) and DataTables headers */
    background: var(--common-background);
    border: 1px solid var(--dsb-border);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 200px;
    max-width: 320px;
    box-shadow: 0 -4px 15px rgba(51, 51, 51, 0.04), 0 11px 25px -5px rgba(51, 51, 51, 0.07);
    font-weight: 400;
}

.sd-col-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--common-foreground);
    cursor: pointer;
    white-space: nowrap;
}

.sd-col-dropdown-item:hover {
    background: var(--sd-neutral-200);
}

.sd-col-dropdown-divider {
    height: 1px;
    margin: 4px 0;
    background: var(--dsb-border);
}

.sd-col-dropdown-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px 0;
    font-size: 12px;
    color: var(--sd-neutral-600);
}

.sd-col-dropdown-summary [data-clear] {
    /* the primary text colour, a shade darker than the count beside it, and the weight
       is what marks it as the actionable half of the row rather than an accent colour */
    color: var(--common-foreground);
    font-weight: 500;
    cursor: pointer;
}

.sd-col-dropdown-search {
    display: block;
    margin: 12px;                  /* the menu's inset, on all four sides */
    width: calc(100% - 24px);        /* 100% minus the two horizontal margins */
    padding: 5px 8px;
    font-size: 13px;
    color: var(--common-foreground);
    background: var(--common-background);
    border: 1px solid var(--dsb-border);
    border-radius: 6px;
}

.sd-col-dropdown-search:focus {
    outline: none;
    /* dark gray in light theme, light gray in dark -- same token as the summary text */
    border-color: var(--sd-neutral-600);
}

/* the option list scrolls; the sort rows, search box and summary stay put */
.sd-col-dropdown-list {
    max-height: 240px;
    overflow-y: auto;
}

.sd-col-dropdown-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid var(--sd-neutral-400);
    border-radius: 4px;
    position: relative;
}

.sd-col-dropdown-option.is-selected .sd-col-dropdown-check {
    background: var(--theme-color-bright);
    border-color: var(--theme-color-bright);
}

.sd-col-dropdown-option.is-selected .sd-col-dropdown-check::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: 2px solid var(--sd-neutral-100);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.sd-col-dropdown-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-col-dropdown-empty {
    padding: 12px;
    font-size: 13px;
    text-align: center;
    /* muted in both themes -- #b4b4b4 on white, #969696 on #121212. The 500 step is
       #D3D3D3 once the palette flips, which reads as primary text, not as a hint. */
    color: var(--sd-neutral-450);
}
