/* Filters, one look for the whole cabinet.

   .seg      segmented control: a set of mutually exclusive options (period, yes/no/any, sort)
   .chips    a row of pill toggles, for long or user-defined lists (categories, payment methods)
   .fchip    a single pill toggle or dropdown trigger outside of a .chips row
   .fbar     wrapping row of filter groups; .fgroup + .flabel put a small caption above a control

   The options stay ordinary theme buttons — "btn btn-sm btn-primary" when selected, "btn-light"
   otherwise — so a template only has to name the container. The theme sets button colours and
   paddings with !important and a long :not() chain, hence the !important here. */

.fbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.5rem;
}

.fgroup {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 0;
}

.flabel {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--kt-gray-600);
    white-space: nowrap;
}

.flabel > i {
    font-size: .85rem;
    margin-right: .3rem;
    color: inherit;
}

/* ---- Segmented control ---- */

.seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--kt-gray-200);
    max-width: 100%;
}

.seg > .btn {
    padding: .4rem .85rem !important;
    border: 0 !important;
    border-radius: 8px !important;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    color: var(--kt-gray-700) !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.seg > .btn i {
    color: inherit !important;
}

.seg > .btn:hover {
    color: var(--kt-gray-900) !important;
    background: rgba(125, 130, 153, .14) !important;
}

.seg > .btn.btn-primary,
.seg > .btn.active,
.seg > .btn-check:checked + .btn {
    color: var(--kt-primary) !important;
    font-weight: 600;
    background: var(--kt-card-bg) !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .12), 0 0 0 1px rgba(16, 24, 40, .04) !important;
}

.seg > .btn:focus-visible,
.chips > .btn:focus-visible,
.btn.fchip:focus-visible {
    outline: 2px solid var(--kt-primary);
    outline-offset: 1px;
}

/* ---- Pill toggles ---- */

.chips > .btn.btn-light,
.chips > .btn.btn-primary,
.btn.fchip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: calc(.4rem + 3px) .9rem !important; /* same height as a .seg */
    border: 0 !important;
    border-radius: 999px !important;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    color: var(--kt-gray-700) !important;
    background: var(--kt-card-bg) !important;
    box-shadow: inset 0 0 0 1px var(--kt-gray-300) !important;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.chips > .btn.btn-light i:not([class*="text-"]),
.chips > .btn.btn-primary i:not([class*="text-"]),
.btn.fchip i:not([class*="text-"]) {
    padding: 0;
    margin: 0 !important;
    color: inherit !important;
}

.chips > .btn.btn-light:hover,
.btn.fchip.btn-light:hover {
    color: var(--kt-gray-900) !important;
    background: var(--kt-gray-200) !important;
}

.chips > .btn.btn-primary,
.btn.fchip.btn-primary {
    color: var(--kt-primary) !important;
    font-weight: 600;
    background: var(--kt-primary-light) !important;
    box-shadow: inset 0 0 0 1px var(--kt-primary) !important;
}

/* Small screens: a long control scrolls sideways instead of stacking into a block of rows. */
@media (max-width: 575.98px) {
    .fgroup {
        width: 100%;
    }

    .seg {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .seg::-webkit-scrollbar {
        display: none;
    }
}
