.admin-smart-filter {
    display: grid;
    gap: 12px;
    margin-bottom: var(--evosoft-admin-page-gap);
}

.admin-smart-filter__command-bar {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    min-width: 0;
}

.admin-smart-filter__command-bar--search-only {
    justify-content: flex-start;
}

.admin-smart-filter__command-bar--search-only .admin-smart-filter__commands {
    display: none;
}

.admin-smart-filter__command-bar--search-only .admin-smart-filter__search {
    margin-left: 0;
}

.admin-smart-filter__commands,
.admin-smart-filter__quick-filters {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.admin-smart-filter__command-separator {
    align-self: center;
    background: var(--evosoft-admin-border);
    flex: 0 0 1px;
    height: 24px;
    margin: 0 4px;
    width: 1px;
}

.admin-smart-filter__search {
    flex: 0 1 340px;
    margin-left: auto;
    max-width: 340px;
    min-width: 240px;
    position: relative;
}

.admin-smart-filter__search > .e-control-wrapper,
.admin-smart-filter__search > .e-input-group {
    box-shadow: none;
    width: 100%;
}

.admin-smart-filter__search > .e-control-wrapper.e-input-focus,
.admin-smart-filter__search > .e-input-group.e-input-focus,
.admin-smart-filter__search > .e-control-wrapper:focus-within,
.admin-smart-filter__search > .e-input-group:focus-within {
    box-shadow: none;
}

.admin-smart-filter__search-icon {
    align-items: center;
    color: var(--evosoft-admin-text-secondary);
    display: inline-flex;
    height: 100%;
    justify-content: center;
    line-height: 1;
    padding: 0;
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 36px;
    z-index: 2;
}

.admin-smart-filter__search :is(.e-input-group, .e-control-wrapper) input.e-input {
    padding-left: 36px !important;
    text-indent: 0 !important;
}

.admin-smart-filter__quick-button.e-btn,
.admin-smart-filter__add-button.e-btn,
.admin-smart-filter__clear-button.e-btn,
.admin-smart-filter__apply-button.e-btn {
    white-space: nowrap;
}

.admin-smart-filter__add-button.e-btn {
    align-items: center;
    background-color: var(--evosoft-admin-info-soft) !important;
    border-color: var(--evosoft-admin-primary) !important;
    color: var(--evosoft-admin-primary) !important;
    display: inline-flex;
    font-weight: 600;
    gap: 6px;
    justify-content: center;
    line-height: 20px;
    margin-left: 0;
    padding-left: 10px;
    padding-right: 10px;
    position: relative;
}

.admin-smart-filter__add-button.e-btn[data-filter-count] {
    padding-left: 10px;
    padding-right: 10px;
}

.admin-smart-filter__add-button.e-btn:hover,
.admin-smart-filter__add-button.e-btn:focus,
.admin-smart-filter__add-button.e-btn:focus-visible,
.admin-smart-filter__add-button.e-btn:active,
.admin-smart-filter__add-button.e-btn.e-active,
.admin-smart-filter__add-button.e-btn.e-focused,
.admin-smart-filter__add-button.e-btn.e-focus,
.admin-smart-filter__add-button.e-btn[aria-expanded="true"] {
    background-color: var(--evosoft-admin-info-soft) !important;
    border-color: var(--evosoft-admin-primary) !important;
    box-shadow: none !important;
    color: var(--evosoft-admin-primary) !important;
    outline: none !important;
}

.admin-smart-filter__add-button.e-btn > .e-btn-icon {
    align-items: center;
    display: inline-flex;
    flex: 0 0 14px;
    font-size: 12px;
    height: 14px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: static;
    width: 14px;
}

.admin-smart-filter__add-button.e-btn > .e-caret,
.admin-smart-filter__add-button.e-btn > .e-caret-down {
    flex-basis: 12px;
    font-size: 10px;
    height: 12px;
    order: 4;
    width: 12px;
}

.admin-smart-filter__add-button.e-btn .e-ripple-element {
    background: transparent !important;
    opacity: 0 !important;
}

.admin-smart-filter__add-button.e-btn[data-filter-count]::after {
    background: var(--evosoft-admin-primary);
    border-radius: 50%;
    box-sizing: border-box;
    color: #ffffff;
    content: attr(data-filter-count);
    display: inline-grid;
    font-feature-settings: "tnum";
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    height: 20px;
    line-height: 20px;
    min-width: 20px;
    order: 3;
    padding: 0;
    place-items: center;
    position: static;
    text-align: center;
    text-indent: 0;
    transform: none;
    width: 20px;
}

.admin-smart-filter__conditions {
    display: grid;
    gap: 16px 20px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-smart-filter__field {
    background: #f5f6f7;
    border: 0;
    border-radius: var(--evosoft-admin-radius);
    box-shadow: none;
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 10px 12px 12px;
    position: relative;
}

.admin-smart-filter__field-header {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-height: var(--evosoft-admin-icon-button-size);
}

.admin-smart-filter__field-header label {
    color: var(--evosoft-admin-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    margin: 0;
}

.admin-smart-filter__field .admin-smart-filter__remove-button.e-btn.e-icon-btn {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--evosoft-admin-border);
    border-radius: 50%;
    box-shadow: none;
    box-sizing: border-box;
    display: inline-flex;
    font-size: 0;
    height: 20px;
    justify-content: center;
    line-height: 1;
    min-height: 20px;
    min-width: 20px;
    padding: 0;
    position: absolute;
    right: 0;
    top: 0;
    transform: translate(50%, -50%);
    width: 20px;
    z-index: 1;
}

.admin-smart-filter__field .admin-smart-filter__remove-button.e-btn.e-icon-btn:hover,
.admin-smart-filter__field .admin-smart-filter__remove-button.e-btn.e-icon-btn:focus {
    background: var(--evosoft-admin-info-soft);
    border-color: var(--evosoft-admin-field-border);
    box-shadow: none;
    color: var(--evosoft-admin-primary);
}

.admin-smart-filter__field .admin-smart-filter__remove-button.e-btn.e-icon-btn .e-btn-icon {
    align-items: center;
    display: inline-flex;
    font-size: 10px;
    height: 10px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    width: 10px;
}

.admin-smart-filter__field .admin-smart-filter__remove-button.e-btn.e-icon-btn .e-btn-icon::before {
    display: block;
    line-height: 1;
}

.admin-smart-filter__field-control,
.admin-smart-filter__field-control > .e-control-wrapper,
.admin-smart-filter__field-control > .e-input-group {
    min-width: 0;
    width: 100%;
}

.admin-smart-filter__field-control :is(input.e-input, select, .form-control, .form-select) {
    font-size: 14px !important;
    font-weight: 400 !important;
}

.admin-smart-filter__field-control input.e-input[placeholder="Tất cả"]::placeholder {
    color: var(--evosoft-admin-text) !important;
}

.admin-smart-filter__search :is(.e-control-wrapper, .e-input-group, input, select, .form-control, .form-select),
.admin-smart-filter__field-control :is(
    .e-control-wrapper,
    .e-input-group,
    .e-ddl,
    .e-dropdownlist,
    .e-date-wrapper,
    .e-time-wrapper,
    .e-datetime-wrapper,
    .e-numeric,
    .e-multiselect,
    input,
    select,
    .form-control,
    .form-select
) {
    box-shadow: none !important;
}

.admin-smart-filter__search :is(
    .e-control-wrapper,
    .e-input-group,
    .e-ddl,
    .e-dropdownlist,
    .e-date-wrapper,
    .e-time-wrapper,
    .e-datetime-wrapper,
    .e-numeric,
    .e-multiselect
):not(.e-input-focus):not(.e-focused):not(:focus-within),
.admin-smart-filter__field-control :is(
    .e-control-wrapper,
    .e-input-group,
    .e-ddl,
    .e-dropdownlist,
    .e-date-wrapper,
    .e-time-wrapper,
    .e-datetime-wrapper,
    .e-numeric,
    .e-multiselect
):not(.e-input-focus):not(.e-focused):not(:focus-within),
.admin-smart-filter__search :is(input, select, .form-control, .form-select):not(:focus),
.admin-smart-filter__field-control :is(input, select, .form-control, .form-select):not(:focus) {
    border-color: #e9ecf0 !important;
}

.admin-smart-filter__search :is(.e-control-wrapper, .e-input-group)::before,
.admin-smart-filter__search :is(.e-control-wrapper, .e-input-group)::after,
.admin-smart-filter__field-control :is(.e-control-wrapper, .e-input-group)::before,
.admin-smart-filter__field-control :is(.e-control-wrapper, .e-input-group)::after {
    box-shadow: none !important;
}

.admin-smart-filter__range {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.admin-smart-filter__range > span {
    color: var(--evosoft-admin-text-secondary);
    font-size: 13px;
}

.admin-smart-filter__range > .e-control-wrapper,
.admin-smart-filter__range > .e-input-group {
    min-width: 0;
    width: 100%;
}

body:has(.admin-layout) .e-dropdown-popup:has(.admin-smart-filter__menu-item) {
    max-width: calc(100vw - 24px);
    min-width: min(240px, calc(100vw - 24px));
}

body:has(.admin-layout) .e-dropdown-popup:has(.admin-smart-filter__menu-item) .e-menu-parent,
body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item {
    min-width: 100%;
    width: 100%;
}

body:has(.admin-layout) .e-dropdown-popup:has(.admin-smart-filter__menu-item) .e-menu-parent {
    padding-bottom: 10px;
    padding-top: 10px;
}

body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--all {
    align-items: center;
    background: transparent;
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    padding-bottom: 8px;
    position: relative;
}

body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--all::before {
    background: var(--evosoft-admin-border);
    bottom: 0;
    content: "";
    height: 1px;
    left: 12px;
    position: absolute;
    right: 12px;
}

body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--all::after {
    align-items: center;
    background: var(--evosoft-admin-primary);
    border-radius: 50%;
    color: #ffffff;
    content: attr(data-filter-count);
    display: inline-flex;
    flex: 0 0 20px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    height: 20px;
    justify-content: center;
    line-height: 1;
    margin-left: auto;
    width: 20px;
}

body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--all:not(.e-disabled):hover,
body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--all:not(.e-disabled):focus {
    background: #f3f4f6;
}

body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--selected {
    padding-right: 40px;
    position: relative;
}

body:has(.admin-layout) .e-dropdown-popup .admin-smart-filter__menu-item--selected::after {
    align-items: center;
    color: inherit;
    content: "✓";
    display: inline-flex;
    font-size: 14px;
    font-weight: 600;
    height: 18px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
}

@media (max-width: 1199.98px) {
    .admin-smart-filter__conditions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .admin-smart-filter__command-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-smart-filter__commands,
    .admin-smart-filter__quick-filters {
        align-items: stretch;
    }

    .admin-smart-filter__command-separator {
        display: none;
    }

    .admin-smart-filter__search {
        flex-basis: auto;
        margin-left: 0;
        max-width: none;
        min-width: 0;
        width: 100%;
    }

    .admin-smart-filter__conditions {
        grid-template-columns: 1fr;
    }

    .admin-smart-filter__range {
        grid-template-columns: 1fr;
    }

    .admin-smart-filter__range > span {
        display: none;
    }
}
