.dsgn-tax-dropdown,
.dsgn-tax-dropdown * {
    box-sizing: border-box;
}

.dsgn-tax-dropdown {
    --dsgn-tax-columns: 2;
    --dsgn-tax-column-gap: 40px;
    --dsgn-tax-root-gap: 10px;
    --dsgn-tax-item-gap: 6px;
    --dsgn-tax-indent: 24px;
    --dsgn-tax-icon-size: 12px;
    --dsgn-tax-custom-icon-rotation: 180deg;
    width: 100%;
}

.dsgn-tax-dropdown__list,
.dsgn-tax-dropdown__column {
    list-style: none;
    margin: 0;
    padding: 0;
}

/*
 * Each visible column is a real, independent list. Opening a dropdown in one
 * column therefore never changes the vertical flow of a neighbouring column.
 */
.dsgn-tax-dropdown__columns {
    display: grid;
    grid-template-columns: repeat(var(--dsgn-tax-columns, 2), minmax(0, 1fr));
    column-gap: var(--dsgn-tax-column-gap, 40px);
    align-items: start;
    width: 100%;
    min-width: 0;
}

.dsgn-tax-dropdown__column {
    display: block;
    min-width: 0;
    align-self: start;
}

.dsgn-tax-dropdown__column > .dsgn-tax-dropdown__item--root + .dsgn-tax-dropdown__item--root {
    margin-top: var(--dsgn-tax-root-gap, 10px);
}

.dsgn-tax-dropdown__item {
    min-width: 0;
    margin: 0;
    padding: 0;
}

.dsgn-tax-dropdown__list:not(.dsgn-tax-dropdown__list--root) > .dsgn-tax-dropdown__item + .dsgn-tax-dropdown__item {
    margin-top: var(--dsgn-tax-item-gap);
}

.dsgn-tax-dropdown__item--root {
    break-inside: avoid;
    min-width: 0;
}

.dsgn-tax-dropdown__row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
    background-color: transparent;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.dsgn-tax-dropdown__item:not(.dsgn-tax-dropdown__item--root) > .dsgn-tax-dropdown__row {
    padding-inline-start: calc(var(--dsgn-tax-depth, 0) * var(--dsgn-tax-indent));
}

/*
 * Text link states are deliberately reset. Themes and Elementor global link
 * hover styles therefore cannot inject a background into a label. Row colors
 * are controlled exclusively by the widget controls.
 */
.dsgn-tax-dropdown .dsgn-tax-dropdown__label,
.dsgn-tax-dropdown a.dsgn-tax-dropdown__label,
.dsgn-tax-dropdown a.dsgn-tax-dropdown__label:link,
.dsgn-tax-dropdown a.dsgn-tax-dropdown__label:visited,
.dsgn-tax-dropdown a.dsgn-tax-dropdown__label:hover,
.dsgn-tax-dropdown a.dsgn-tax-dropdown__label:focus,
.dsgn-tax-dropdown a.dsgn-tax-dropdown__label:active {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline-offset: 2px;
    color: inherit !important;
    background: transparent !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-shadow: none !important;
    overflow-wrap: anywhere;
    line-height: inherit;
    -webkit-tap-highlight-color: transparent;
}

.dsgn-tax-dropdown .dsgn-tax-dropdown__label::before,
.dsgn-tax-dropdown .dsgn-tax-dropdown__label::after {
    content: none !important;
    display: none !important;
}

button.dsgn-tax-dropdown__label {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
}

.dsgn-tax-dropdown__count {
    opacity: .7;
    white-space: nowrap;
}

.dsgn-tax-dropdown__toggle {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border-style: solid;
    border-width: 0;
    border-color: transparent;
    background-color: transparent;
    background-image: none;
    color: inherit;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    text-shadow: none;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.dsgn-tax-dropdown__toggle:hover,
.dsgn-tax-dropdown__toggle:focus,
.dsgn-tax-dropdown__toggle:active {
    background-image: none;
    box-shadow: none;
    text-shadow: none;
}

.dsgn-tax-dropdown__toggle:focus-visible,
.dsgn-tax-dropdown__label--toggle:focus-visible,
a.dsgn-tax-dropdown__label:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.dsgn-tax-dropdown__custom-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--dsgn-tax-icon-size);
    height: var(--dsgn-tax-icon-size);
    font-size: var(--dsgn-tax-icon-size);
    line-height: 1;
    color: inherit;
    pointer-events: none;
    transform-origin: center;
    transition: transform .22s ease, opacity .18s ease;
}

.dsgn-tax-dropdown__custom-icon i,
.dsgn-tax-dropdown__custom-icon svg {
    display: block;
    width: 1em;
    height: 1em;
    margin: 0;
    padding: 0;
    font-size: inherit;
    line-height: 1;
    color: inherit;
    fill: currentColor;
}

/* PHP renders the toggle only for terms with visible direct children. */
.dsgn-tax-dropdown__item:not(.dsgn-tax-dropdown__item--parent) > .dsgn-tax-dropdown__row > .dsgn-tax-dropdown__toggle {
    display: none !important;
}

.dsgn-tax-dropdown--custom-icon-rotate .dsgn-tax-dropdown__toggle[aria-expanded="true"] .dsgn-tax-dropdown__custom-icon--closed {
    transform: rotate(var(--dsgn-tax-custom-icon-rotation));
}

.dsgn-tax-dropdown--custom-icons-pair .dsgn-tax-dropdown__custom-icon--open {
    display: none;
}

.dsgn-tax-dropdown--custom-icons-pair .dsgn-tax-dropdown__toggle[aria-expanded="true"] .dsgn-tax-dropdown__custom-icon--closed {
    display: none;
}

.dsgn-tax-dropdown--custom-icons-pair .dsgn-tax-dropdown__toggle[aria-expanded="true"] .dsgn-tax-dropdown__custom-icon--open {
    display: inline-flex;
}

.dsgn-tax-dropdown__children {
    margin-top: var(--dsgn-tax-item-gap);
}

.dsgn-tax-dropdown__children[hidden] {
    display: none !important;
}

.dsgn-tax-dropdown--divider-yes .dsgn-tax-dropdown__item:not(.dsgn-tax-dropdown__item--root) > .dsgn-tax-dropdown__row {
    border-bottom-style: solid;
    border-bottom-width: 1px;
}

.dsgn-tax-dropdown__empty {
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .dsgn-tax-dropdown__row,
    .dsgn-tax-dropdown__toggle,
    .dsgn-tax-dropdown__custom-icon {
        transition: none !important;
    }
}
