/**
 * The shared filter dropdown (core/class-cda-dropdown.php), in the style of
 * SimGrid's filter toggles: outline button, muted name, bold value,
 * chevron. Colours read the page's --cda-* tokens where it sets them (the
 * setups archive does), else the kit's greys.
 *
 * Selectors carry two classes so a page's link styles cannot beat them.
 */


.cda-dd {
    position: relative;
}

.cda-dd,
.cda-dd *,
.cda-dd *::before,
.cda-dd *::after {
    box-sizing: border-box;
}

.cda-dd .cda-dd__menu,
.cda-dd .cda-dd__menu li {
    margin: 0;
    list-style: none;
}

.cda-dd .cda-dd__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--cda-line, #322f4c);
    border-radius: 4px;
    color: var(--e-global-color-33569c2, #e9ecef); /* Grey 200 */
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.cda-dd .cda-dd__toggle::-webkit-details-marker {
    display: none;
}

.cda-dd .cda-dd__toggle:hover,
.cda-dd[open] .cda-dd__toggle {
    border-color: var(--cda-line-strong, #5d6486);
}

.cda-dd .cda-dd__toggle:focus-visible {
    outline: 2px solid var(--cda-strong, #ffffff);
    outline-offset: 2px;
}

.cda-dd .cda-dd__name {
    color: var(--cda-muted, #868f98);
}

.cda-dd .cda-dd__value {
    overflow: hidden;
    max-width: 180px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.cda-dd .cda-dd__chevron {
    color: var(--cda-muted, #868f98);
    transition: transform 0.15s;
}

.cda-dd[open] .cda-dd__chevron {
    transform: rotate(180deg);
}

.cda-dd .cda-dd__menu {
    position: absolute;
    z-index: 50;
    top: 100%;
    left: 0;
    min-width: 180px;
    max-width: calc(100vw - 32px);
    max-height: 320px;
    margin-top: 4px;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--cda-raised, #322f4c);
    box-shadow: 0 0 60px rgba(16, 15, 26, 0.7);
    scrollbar-width: thin;
}

.cda-dd.cda-dd--end .cda-dd__menu {
    right: 0;
    left: auto;
}

.cda-dd .cda-dd__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 4px;
    color: var(--cda-text, #cdd2d7);
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
}

.cda-dd .cda-dd__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cda-strong, #ffffff);
}

.cda-dd .cda-dd__label {
    flex: 1;
}

.cda-dd .cda-dd__count {
    color: var(--cda-muted, #868f98);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* The tick on the current option: CSS, not an SVG per option. */
.cda-dd .cda-dd__item::after {
    content: "";
    flex: none;
    width: 12px;
    height: 9px;
}

.cda-dd .cda-dd__item[aria-current="true"] {
    color: var(--cda-strong, #ffffff);
}

.cda-dd .cda-dd__item[aria-current="true"]::after {
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='9' viewBox='0 0 12 9'%3E%3Cpath d='M1 4.5l3.5 3.5L11 1.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='9' viewBox='0 0 12 9'%3E%3Cpath d='M1 4.5l3.5 3.5L11 1.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
}
