/* ========================================
   GreenStep Hub - Table Column Filters
   ======================================== */

/* Filter Header Container */
.th-filter {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    position: relative;
}

/* Center filter in centered columns */
th[style*="text-align:center"] .th-filter,
th[style*="text-align: center"] .th-filter,
.notes-header .th-filter,
.actions-header .th-filter {
    justify-content: center;
}

/* Filter Button in Header */
.column-filter-btn {
    background: rgba(100, 116, 139, 0.1);
    border: 1px solid rgba(100, 116, 139, 0.2);
    cursor: pointer;
    padding: 0.1rem 0.2rem;
    font-size: 0.55rem;
    opacity: 0.7;
    transition: all 0.2s;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.column-filter-btn:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.column-filter-btn.active {
    opacity: 1;
    color: var(--blue);
    background: rgba(41, 171, 226, 0.15);
}

/* Filter Dropdown */
.column-filter-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    max-width: 250px;
    max-height: 300px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.column-filter-dropdown.show {
    display: flex;
}

/* Filter Search Input */
.filter-dropdown-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.filter-dropdown-search input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--bg2);
}

.filter-dropdown-search input:focus {
    outline: none;
    border-color: var(--blue);
    background: white;
}

/* Filter Options List */
.filter-dropdown-options {
    overflow-y: auto;
    max-height: 200px;
    padding: 0.25rem 0;
}

.filter-option {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-option:hover {
    background: var(--bg2);
}

.filter-option.selected {
    background: rgba(41, 171, 226, 0.1);
    color: var(--blue);
    font-weight: 600;
}

.filter-option-all {
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text2);
}

/* Multi-select checkbox options */
.filter-option-multi {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-option-multi input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--blue);
}

.filter-option-multi span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Filter Actions */
.filter-dropdown-actions {
    padding: 0.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
}

.filter-dropdown-actions button {
    flex: 1;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.filter-apply-btn {
    background: var(--blue);
    color: white;
}

.filter-apply-btn:hover {
    background: #1e90c7;
}

.filter-clear-btn {
    background: var(--bg2);
    color: var(--text2);
}

.filter-clear-btn:hover {
    background: var(--border);
}

/* Active Filter Indicator */
th.has-filter {
    background: rgba(41, 171, 226, 0.08) !important;
}

/* Filter Badge */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--blue);
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    margin-right: 0.25rem;
}

/* No Results Message */
.filter-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text3);
    font-size: 0.85rem;
}

/* Form Filter Custom Dropdown */
.column-filter-dropdown.form-filter-wide {
    max-width: 320px;
    max-height: 450px;
}

.form-filter-container {
    width: 300px;
}

.form-filter-header {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--green, #006838);
}

.form-filter-questions {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.form-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.75rem;
    gap: 0.5rem;
}

.form-filter-row:hover {
    background: var(--bg2);
}

.form-filter-label {
    font-size: 0.8rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-filter-select {
    padding: 0.2rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    min-width: 80px;
}

.form-filter-select:focus {
    outline: none;
    border-color: var(--blue);
}

.form-filter-select option[value="כן"] { color: #16a34a; }
.form-filter-select option[value="לא"] { color: #dc2626; }
