/* Filter Components */

.filter-menu {
    position: relative;
}

.filter-button {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    background: oklch(1 0 0);
    border: 1px solid oklch(0.85 0 0);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.filter-button:hover {
    background: oklch(0.98 0 0);
    border-color: oklch(0.75 0 0);
}

.filter-button:focus,
.filter-button:focus-visible {
    outline: 2px solid oklch(0.6 0.2 250);
    outline-offset: 2px;
}

.filter-button img {
    width: 20px;
    height: 20px;
    display: block;
}

.filter-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: oklch(0.5 0.2 20);
    color: white;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 4px;
    display: none; /* Hidden by default, shown when filters are active */
}

.filter-badge.active {
    display: flex;
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 350px;
    max-width: 450px;
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 16px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

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

.filter-checkbox-item label {
    cursor: pointer;
    user-select: none;
}

/* ============================================
   Prompt Table Column Filters
   ============================================ */

/* Active Filters Pills Container */
.prompt-active-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.prompt-active-filters-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.prompt-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.prompt-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    color: #4a5568;
}

.prompt-filter-pill-field {
    font-weight: 500;
    color: #2d3748;
}

.prompt-filter-pill-value {
    color: #4a5568;
}

.prompt-filter-pill-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #718096;
    transition: all 0.15s ease;
}

.prompt-filter-pill-remove:hover {
    background: #cbd5e0;
    color: #2d3748;
}

.prompt-clear-filters-btn {
    padding: 4px 10px;
    font-size: 12px;
    color: #667eea;
    background: transparent;
    border: 1px solid #667eea;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.prompt-clear-filters-btn:hover {
    background: #667eea;
    color: white;
}

/* Filter Dropdown */
.prompt-filter-dropdown {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    max-width: 300px;
    max-height: 350px;
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.prompt-filter-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}

.prompt-filter-dropdown-header span {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
}

.prompt-filter-dropdown-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #718096;
    line-height: 1;
    padding: 0;
}

.prompt-filter-dropdown-close:hover {
    color: #2d3748;
}

.prompt-filter-dropdown-search {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.prompt-filter-dropdown-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
}

.prompt-filter-dropdown-search input:focus {
    outline: none;
    border-color: #667eea;
}

.prompt-filter-dropdown-options {
    overflow-y: auto;
    max-height: 250px;
    padding: 4px 0;
}

.prompt-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #4a5568;
    transition: background 0.1s ease;
}

.prompt-filter-option:hover {
    background: #f7fafc;
}

.prompt-filter-option.selected {
    background: #edf2f7;
    color: #2d3748;
}

.prompt-filter-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.prompt-filter-option-label {
    flex: 1;
}

.prompt-filter-option-count {
    font-size: 11px;
    color: #a0aec0;
}

/* Clickable column headers for filtering */
.prompts-table-th.filterable {
    cursor: pointer;
}

.prompts-table-th.filterable:hover {
    background: #f7fafc;
}

.prompts-table-th .filter-icon {
    margin-left: 4px;
    opacity: 0.4;
    font-size: 10px;
}

.prompts-table-th.filterable:hover .filter-icon,
.prompts-table-th.has-filter .filter-icon {
    opacity: 1;
}

.prompts-table-th.has-filter {
    background: #edf2f7;
}

/* Client facing badge */
.client-facing-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
