/* SPDX-License-Identifier: GPL-2.0-or-later
   Scoped additions to Joomla's Bootstrap 5 controls; no external framework. */
.vm-smartfilters {
    --vm-filter-accent: var(--bs-primary, #0d6efd);
    --vm-filter-border: var(--bs-border-color, #dce1e6);
    --vm-filter-muted: var(--bs-secondary-color, #5d6470);
    --vm-filter-surface: var(--bs-tertiary-bg, #f5f6f8);
    background: transparent;
    color: var(--bs-body-color, #212529);
    border: 0;
    border-bottom: 1px solid var(--vm-filter-border);
    border-radius: 0;
    box-shadow: none;
    margin-block: 1rem;
    overflow: visible;
}
.vm-smartfilters, .vm-smartfilters * { box-sizing: border-box; }
.vm-smartfilters .card-body { padding: 0 0 1rem; }
.vm-smartfilters .h5 { font-size: 1.05rem; line-height: 1.5; font-weight: 700; margin: 0; }
.vm-smartfilters .small { font-size: .8125rem; line-height: 1.5; }
.vm-smartfilters .text-muted { color: var(--vm-filter-muted) !important; }
.vm-smartfilters .badge { padding: .4em .7em; border-radius: 999px; color: #fff; background: var(--vm-filter-accent); font-size: .8rem; }
.vm-smartfilters-controls { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .625rem; }
.vm-smartfilters .vm-filter-item { min-width: 0; width: 100%; }
.vm-smartfilters .form-label { display: block; font-size: .875rem; line-height: 1.5; font-weight: 600; margin-bottom: .5rem; }
.vm-smartfilters :is(.form-select, .form-control) { width: 100%; min-height: 2.75rem; padding: .625rem .75rem; border: 1px solid var(--vm-filter-border); border-radius: .5rem; background-color: var(--bs-body-bg, #fff); color: inherit; font: inherit; font-size: .875rem; }
.vm-smartfilters .form-select { padding-inline-end: 2.25rem; }
.vm-smartfilters .form-control::placeholder { color: var(--vm-filter-muted); opacity: 1; }
.vm-smartfilters .border-primary { border-color: var(--vm-filter-accent); }
.vm-smartfilters :is(.form-select, .form-control, .btn):focus-visible { outline: 3px solid var(--vm-filter-accent); outline-offset: 3px; box-shadow: none; }
.vm-smartfilters .btn { display: inline-flex; justify-content: center; align-items: center; gap: .65rem; min-height: 2.75rem; padding: .65rem 1.125rem; border: 1px solid var(--vm-filter-border); border-radius: 999px; font: inherit; font-size: .875rem; line-height: 1.4; font-weight: 600; text-decoration: none; cursor: pointer; }
.vm-smartfilters .btn-primary { background: var(--vm-filter-accent); border-color: var(--vm-filter-accent); color: #fff; }
.vm-smartfilters .btn-primary:hover { filter: brightness(.9); }
.vm-smartfilters .btn-outline-secondary { color: inherit; background: var(--bs-body-bg, #fff); }
.vm-smartfilters .btn-outline-secondary:hover { background: var(--vm-filter-surface); border-color: currentColor; }
.vm-smartfilters [aria-busy="true"] { opacity: .7; }
.vm-smartfilters [hidden] { display: none !important; }
.vm-smartfilters .vm-property-range { min-width: 0; margin: 0; padding: 0; border: 0; }
.vm-smartfilters .vm-property-range legend { float: none; width: auto; }
.vm-smartfilters .vm-property-bounds { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.vm-smartfilters .vm-property-bounds label { display: block; margin-bottom: .375rem; }
.vm-smartfilters-vertical .vm-smartfilters-controls { gap: 1.25rem; }
.vm-smartfilters-horizontal .vm-filter-item { width: auto; max-width: 100%; }
.vm-filter-dropdown { position: relative; }
.vm-smartfilters .vm-filter-dropdown > summary { text-align: start; list-style: none; min-height: 2.875rem; }
.vm-filter-dropdown > summary::-webkit-details-marker { display: none; }
.vm-filter-dropdown > summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.vm-filter-unit { font-weight: 400; color: var(--vm-filter-muted); white-space: nowrap; }
.vm-filter-chevron { display: block; width: .45rem; height: .45rem; border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -.2rem .125rem 0 .375rem; flex-shrink: 0; }
.vm-filter-dropdown[open] .vm-filter-chevron { transform: rotate(225deg); margin-top: .2rem; }
.vm-smartfilters .vm-filter-dropdown[open] > summary { background: var(--vm-filter-surface); border-color: currentColor; }
.vm-smartfilters .vm-filter-active > summary { border-color: var(--vm-filter-accent); box-shadow: inset 0 0 0 1px var(--vm-filter-accent); }
.vm-filter-value { display: block; color: var(--vm-filter-accent); font-size: .75rem; margin-top: .125rem; overflow-wrap: anywhere; }
.vm-smartfilters .vm-filter-panel { position: absolute; inset-inline-start: 0; top: calc(100% + .5rem); z-index: 20; width: 19rem; max-width: calc(100vw - 2rem); padding: 1.125rem; background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #212529); border: 1px solid var(--vm-filter-border); border-radius: .875rem; box-shadow: 0 .75rem 2rem rgb(0 0 0 / 12%); }
.vm-smartfilters .vm-filter-panel.vm-filter-panel-end { inset-inline-start: auto; inset-inline-end: 0; }
.vm-smartfilters .vm-filter-panel-apply { width: 100%; margin-top: 1rem; }
@media (max-width: 575.98px) {
    .vm-smartfilters .card-body { padding: 0 0 1rem; }
    .vm-smartfilters-horizontal .vm-filter-item { width: 100%; }
    .vm-smartfilters .vm-filter-dropdown > summary { width: 100%; justify-content: space-between; }
    .vm-smartfilters .vm-filter-panel { position: static; width: 100%; max-width: none; margin-top: .5rem; box-shadow: none; background: var(--vm-filter-surface); }
}
@media (prefers-reduced-motion: reduce) {
    .vm-smartfilters * { transition: none !important; }
}

/* Individual clear actions sit outside summary, avoiding nested interactive controls. */
.vm-smartfilters .vm-filter-item { position: relative; }
.vm-smartfilters-horizontal .vm-filter-item { display: flex; align-items: flex-start; gap: .25rem; }
.vm-smartfilters-horizontal .vm-filter-dropdown { flex: 1; min-width: 0; }
.vm-smartfilters .vm-filter-clear { width: 2.75rem; height: 2.75rem; min-height: 2.75rem; flex: 0 0 2.75rem; padding: 0; margin-top: .0625rem; }
.vm-smartfilters .vm-filter-clear span { font-size: 1.5rem; line-height: 1; font-weight: 400; }
.vm-smartfilters-vertical .vm-filter-clear { position: absolute; inset-inline-end: 0; top: -.375rem; }
.vm-smartfilters-vertical .vm-filter-item:has(.vm-filter-clear:not([hidden])) > .form-label,
.vm-smartfilters-vertical .vm-filter-item:has(.vm-filter-clear:not([hidden])) legend { padding-inline-end: 3rem; min-height: 2rem; }


.vm-smartfilters-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .625rem; }
.vm-filter-icon { display: inline-flex; align-items: center; min-height: 2.75rem; }
.vm-smartfilters .vm-filter-clear-all { width: 2.75rem; height: 2.75rem; padding: 0; border: 0; color: inherit; background: transparent; }
.vm-smartfilters .vm-filter-clear-all:hover { background: var(--vm-filter-surface); }
.vm-smartfilters .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
