/* Horizontal filter bar shown above changelist results (replaces sidebar). */

/* Reclaim the space the default filter sidebar would have used. */
#changelist.filtered {
    margin-right: 0 !important;
}
#changelist.filtered #changelist-filter {
    display: none !important;
}

.top-filter-bar {
    margin: 0 0 16px;
    padding: 0;
}

.top-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--hairline-color, #e3e6ec);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.top-filter-form .tfb-field {
    display: flex;
    align-items: center;
    height: 38px;
    box-sizing: border-box;
}

.top-filter-form input[type="text"],
.top-filter-form input[type="date"],
.top-filter-form select {
    height: 38px;
    box-sizing: border-box;
    border: 1px solid var(--border-color, #d5d9e0);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: var(--body-fg, #333);
    font-size: 13px;
    outline: none;
}

.top-filter-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 16px 16px;
    cursor: pointer;
}

.top-filter-form input[type="text"]:focus,
.top-filter-form input[type="date"]:focus,
.top-filter-form select:focus {
    border-color: #2a5fad;
    box-shadow: 0 0 0 2px rgba(42, 95, 173, 0.15);
}

/* Search field with leading icon */
.tfb-search {
    position: relative;
    flex: 0 0 280px;
    flex-shrink: 0;
    max-width: 320px;
    min-width: 200px;
}
.tfb-search .tfb-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    opacity: 0.55;
    pointer-events: none;
}
.tfb-search input[type="text"] {
    width: 100%;
    padding-left: 38px;
}

.tfb-select select {
    min-width: 190px;
    cursor: pointer;
    /* leave room for native arrow */
    padding-right: 28px;
}

.tfb-daterange {
    gap: 6px;
    flex-wrap: nowrap;
}
.tfb-daterange .tfb-daterange-field {
    min-width: 180px;
    cursor: pointer;
}
.tfb-daterange-label {
    font-size: 13px;
    color: var(--body-quiet-color, #667085);
    white-space: nowrap;
}
.tfb-dash {
    color: var(--body-quiet-color, #98a2b3);
}

.tfb-apply {
    margin-left: auto;
    height: 38px;
    padding: 0 22px;
    border: none;
    border-radius: 8px;
    background: #2a5fad;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.tfb-apply:hover {
    background: #234e8f;
}

/* Reset filters link */
.tfb-reset {
    height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border: 1px solid var(--border-color, #d5d9e0);
    border-radius: 8px;
    background: #fff;
    color: var(--body-fg, #475467);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.tfb-reset:hover {
    background: #f3f5f8;
    color: var(--body-fg, #333);
}

/* --- Multi-select dropdown control --- */
.tfb-multiselect {
    position: relative;
    height: 38px;
}
.tfb-ms-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    min-width: 190px;
    box-sizing: border-box;
    border: 1px solid var(--border-color, #d5d9e0);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: var(--body-fg, #333);
    font-size: 13px;
    cursor: pointer;
    text-transform: none;
}
.tfb-ms-toggle:hover {
    border-color: #2a5fad;
}
.tfb-ms-label {
    flex: 1 1 auto;
    text-align: left;
    white-space: nowrap;
}
.tfb-ms-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #2a5fad;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}
.tfb-ms-caret {
    color: var(--body-quiet-color, #667085);
    font-size: 17px;
    line-height: 1;
    margin-left: 2px;
}

.tfb-hidden {
    display: none !important;
}
.tfb-ms-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 60;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border-color, #d5d9e0);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
    white-space: nowrap;
}
.tfb-multiselect.open .tfb-ms-panel {
    display: block;
}
.tfb-ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400 !important;
    cursor: pointer;
}
.tfb-ms-option:hover {
    background: #f3f5f8;
}
.tfb-ms-option input {
    margin: 0;
}
.tfb-ms-empty {
    display: block;
    padding: 6px 8px;
    color: var(--body-quiet-color, #98a2b3);
}

@media (max-width: 1024px) {
    .tfb-apply {
        margin-left: 0;
    }
}
