/* ==========================================================================
   Resource Schedule - Filter Bar & Multi-Select Dropdown Styles
   ========================================================================== */

/* --- Filter Bar Layout --- */
#filter-bar {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: 6px 12px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
}

.filter-dropdowns {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
}

.filter-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: center;
}

/* --- Multi-Select Dropdown Wrapper --- */
.filter-dropdown-wrapper {
    display: inline-block;
    position: relative;
}

/* View-specific filter slots are toggled by Filters.setView() — only the
   active view's pair (Employee/Job Title vs Project Path/Project Long Name)
   is shown at a time. */
.filter-dropdown-wrapper.filter-hidden {
    display: none !important;
}

/* --- Trigger Button --- */
.filter-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--gray-300);
    background: #fff;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--gray-700);
    cursor: pointer;
    min-width: 120px;
    white-space: nowrap;
    transition: border-color 0.1s;
}

.filter-dropdown-toggle:hover {
    border-color: var(--gray-400);
}

.filter-dropdown-wrapper.active .filter-dropdown-toggle {
    border-color: var(--primary);
}

.filter-label {
    flex: 1;
    text-align: left;
}

.filter-count {
    display: none;
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    margin-left: 4px;
    line-height: 1.3;
}

.filter-count.visible {
    display: inline-block;
}

.filter-arrow {
    flex-shrink: 0;
    transition: transform 0.15s;
    color: var(--gray-400);
}

.filter-dropdown-wrapper.active .filter-arrow {
    transform: rotate(180deg);
}

/* --- Dropdown Panel --- */
.filter-dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--gray-300);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    min-width: 200px;
    max-width: 300px;
}

.filter-dropdown-panel.hidden {
    display: none;
}

/* --- Search Within Dropdown --- */
.filter-panel-search {
    width: 100%;
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-bottom: 1px solid var(--gray-200);
    outline: none;
    color: var(--gray-800);
    background: #fff;
}

.filter-panel-search::placeholder {
    color: var(--gray-400);
}

/* --- Checkbox List --- */
.filter-panel-list {
    max-height: 250px;
    overflow-y: auto;
    padding: var(--sp-1) 0;
}

.filter-panel-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 11px;
    color: var(--gray-700);
    transition: background 0.05s;
}

.filter-panel-item:hover {
    background: var(--gray-50);
}

.filter-panel-item input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.filter-panel-item label {
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    user-select: none;
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

/* Muted secondary text (code / path) shown next to a filter option's
   primary name, so each option is recognizable by both code and name. */
.filter-item-sub {
    font-size: 9px;
    color: var(--gray-400);
    white-space: nowrap;
}

/* --- Select All / Clear Actions --- */
.filter-panel-actions {
    display: flex;
    gap: var(--sp-2);
    padding: 4px 8px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.filter-panel-action-btn {
    background: none;
    border: none;
    font-size: 10px;
    color: var(--gray-500);
    cursor: pointer;
    padding: 2px 4px;
    text-decoration: underline;
}

.filter-panel-action-btn:hover {
    color: var(--primary);
}

/* --- Org Tree Dropdown (wider panel) --- */
#filter-org .filter-dropdown-panel {
    min-width: 280px;
    max-width: 360px;
}

.filter-tree-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 11px;
    color: var(--gray-700);
}

.filter-tree-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 2px 8px;
    cursor: pointer;
}

.filter-tree-row:hover {
    background: var(--gray-50);
}

.filter-tree-toggle {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--gray-400);
    flex-shrink: 0;
    font-size: 9px;
}

.filter-tree-toggle:hover {
    color: var(--gray-700);
}

.filter-tree-toggle-spacer {
    width: 14px;
    flex-shrink: 0;
}

.filter-tree-children {
    width: 100%;
}

.filter-tree-children.collapsed {
    display: none;
}

.filter-tree-item input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.filter-tree-item label {
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    font-size: 11px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.filter-tree-path {
    font-size: 9px;
    color: var(--gray-400);
}

/* --- Group-By Toggle Button Group --- */
.btn-group {
    display: inline-flex;
    border: 1px solid var(--gray-300);
}

.btn-toggle {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-600);
    background: #fff;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}

.btn-toggle:not(:last-child) {
    border-right: 1px solid var(--gray-300);
}

.btn-toggle:hover {
    background: var(--gray-100);
}

.btn-toggle.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.btn-toggle.active:hover {
    background: var(--primary-dark);
}

/* --- Action Buttons in Filter Bar --- */
#btn-add-new {
    background: var(--success);
    color: #fff;
    border-color: var(--success-dark);
    font-weight: 600;
}

#btn-add-new:hover {
    background: var(--success-dark);
}

#btn-clear-filters,
#btn-expand-all,
#btn-collapse-all {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

#btn-clear-filters:hover,
#btn-expand-all:hover,
#btn-collapse-all:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}
