/**
 * Product Filters Stylesheet
 */

/* Dashboard Card Animation */
.dashboard-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
    width: 100%;
}

.dashboard-card.expanded {
    width: 100%;
    margin-left: 10px;
    margin-right: 10px;
}

.dashboard-card.expanded .table-wrapper {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-filters {
    padding: 20px;
    background: #f9fafb;
    border-bottom: 1px solid #dddfe0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-bottom-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
}

.product-filters.visible {
    max-height: 2000px;
    opacity: 1;
    padding-top: 20px;
    padding-bottom: 20px;
    border-bottom-color: #dddfe0;
}

.filters-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.filters-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #dddfe0;
    border-radius: 8px;
    overflow: hidden;
}

.filter-group-stacked {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 180px;
}

.filter-group-stacked .filter-group {
    margin: 0;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
    padding: 4px 10px 4px 10px;
    background: white;
}

/* Multi-select Filter Boxes */
.filter-search-box {
    padding: 3px 12px;
    border: none;
    border-top: 1px solid #dddfe0;
    border-bottom: 1px solid #dddfe0;
    border-radius: 0;
    font-size: 11px;
    background: white;
    width: 100%;
}

.filter-search-box:focus {
    outline: none;
    box-shadow: var(--shadow-focus-glow);
    border-color: transparent;
    position: relative;
    z-index: 1;
}

.filter-multiselect {
    border: none;
    border-radius: 0;
    background: white;
    height: 145px; /* Fixed height for exactly 5 items */
    overflow-y: auto;
    padding: 2px;
}

/* Custom scrollbar styling */
.filter-multiselect::-webkit-scrollbar {
    width: 8px;
}

.filter-multiselect::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.filter-multiselect::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.filter-multiselect::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 1px 5px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
    font-size: 11px;
    line-height: 1.4;
    color: #4a5568;
    user-select: none;
    position: relative;
}

.filter-option:hover {
    background: #f3f4f6;
}

.filter-option.selected {
    background: #f0f7ff;
    color: black;
    font-weight: 500;
    border: 1px solid #dddfe0
}

.filter-option.selected:hover {
    background: #cbd5df;
}

/* Drag-select visual feedback */
.filter-multiselect.drag-selecting {
    cursor: grabbing;
    user-select: none;
}

.filter-option.drag-hover {
    background: #d6ebf5;
    border: 1px solid #2d8998;
    color: black;
    font-weight: 500;
}

/* Tooltip for multiselect hints */
.filter-option-tooltip {
    position: fixed;
    background: #1f2937;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    z-index: 10000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateY(-100%) translateY(-8px);
}

.filter-option-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
}

.filter-option.show-tooltip .filter-option-tooltip {
    opacity: 1;
}

/* Hide checkboxes if they exist */
.filter-option input[type="checkbox"] {
    display: none;
}

.filter-option label {
    cursor: pointer;
    margin: 0;
    padding: 0;
    font-size: 11px;
    font-weight: inherit;
    color: inherit;
    background: transparent;
    flex: 1;
    pointer-events: none;
}

.filter-select, .filter-input {
    padding: 8px 12px;
    border-top: 1px solid #dddfe0;
    border-left: 0px;
    border-right: 0px;
    border-bottom: 0px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-size: 12px;
    background: white;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    box-shadow: var(--shadow-focus-glow);
    border-color: transparent;
}

.filter-checkbox-container {
    background: white;
    border: 1px solid #dddfe0;
    border-radius: 8px;
    padding: 12px 16px;
    flex: 2;
}

.filter-checkbox-header {
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.filter-checkbox-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    color: #4a5568;
}

.filter-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.filter-search-group {
    flex: 1;
    min-width: 250px;
}

.filter-more-btn {
    padding: 8px 16px;
    border: 1px solid #dddfe0;
    border-radius: 6px;
    background: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 32px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-more-btn:hover {
    background: #f3f4f6;
}

.filter-apply-btn, .filter-clear-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 32px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-apply-btn {
    background: #2d8998;
    color: white;
}

.filter-apply-btn:hover {
    background: #246b78;
}

.filter-clear-btn {
    background: #e5e7eb;
    color: #4a4a4a;
}

.filter-clear-btn:hover {
    background: #d1d5db;
}

/* Filter Buttons Row */
.filter-buttons-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

/* Active Filter Chips */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.filter-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #e0f2f7;
    border: 1px solid #2d8998;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    color: #1e5661;
    white-space: nowrap;
}

.filter-badge[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #f5f5f0;
    color: #1e5661;
    border: 1px solid #2d8998;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 500;
    white-space: pre-line;
    text-align: left;
    line-height: 1.5;
    min-width: 120px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(45, 137, 152, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    pointer-events: none;
}

/* Date badge tooltips should be single line */
.filter-badge[data-filter-type="date"][data-tooltip]:hover::before {
    white-space: nowrap;
    max-width: none;
    width: auto;
}

.filter-badge[data-tooltip]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 6px solid transparent;
    border-top-color: #f5f5f0;
    z-index: 1000;
    pointer-events: none;
}

.badge-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 2px;
    border-radius: var(--radius-sm, 6px);
    background: transparent;
    color: #2d8998;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-remove:hover {
    background: rgba(45, 137, 152, 0.2);
    color: #1e5661;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #e0f2f7;
    border: 1px solid #2d8998;
    border-radius: 16px;
    font-size: 11px;
    color: #2d8998;
    font-weight: 500;
}

.filter-chip-remove {
    background: none;
    border: none;
    color: #2d8998;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm, 6px);
    transition: background 0.2s;
}

.filter-chip-remove:hover {
    background: rgba(45, 137, 152, 0.2);
}

/* Products Count Display */
.table-footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.products-count-display,
.firmware-count-display,
.pcb-count-display {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    margin-right: 12px;
}

/* Extended Filters Section */
.extended-filters {
    margin-top: 16px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.extended-filters.visible {
    max-height: 2000px;
    opacity: 1;
    margin-top: 16px;
}

.filters-separator {
    height: 1px;
    background: #dddfe0;
    margin: 16px 0;
}

/* Filter Section Containers */
.filter-section-container {
    background: white;
    border: 1px solid #dddfe0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.filter-section-header {
    font-size: 11px;
    font-weight: 1000;
    color: #2d8998;
    margin-bottom: 16px;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-section-container .filters-row {
    margin-bottom: 12px;
}

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

/* Date Range Inputs */
.filter-daterange {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #dddfe0;
    border-radius: 6px;
    flex-wrap: wrap;
}

.filter-date-input {
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 11px;
    background: #fafafa;
    flex: 1;
    min-width: 145px;
    font-family: inherit;
    transition: all 0.2s;
    color: #374151;
}

.filter-date-input:hover {
    border-color: #9ca3af;
    background: white;
}

.filter-date-input:focus {
    outline: none;
    box-shadow: var(--shadow-focus-glow);
    border-color: transparent;
    background: white;
}

.date-separator {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    padding: 0 4px;
}

/* Inline Checkbox (for single checkboxes like Secure Boot) */
.filter-checkbox-inline {
    padding: 10px 0;
}

.filter-checkbox-inline label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    color: #4a5568;
}

.filter-checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Pre-filter Result Count */
.prefilter-count {
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    text-align: center;
}

.prefilter-count strong {
    color: #2d8998;
    font-weight: 700;
}

@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-checkbox-group {
        flex-direction: column !important;
    }
}

/* ==================== DARK MODE ==================== */
@media (prefers-color-scheme: dark) {
    .product-filters {
        background: #0f1113;
        border-bottom-color: transparent;
    }
    
    .product-filters.visible {
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-group {
        background: #1a1d20;
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-group label {
        color: #e5e7eb;
        background: #1a1d20;
    }
    
    .filter-select, .filter-input {
        background: #1a1d20;
        color: #e5e7eb;
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-select:focus, .filter-input:focus {
        box-shadow: var(--shadow-focus-glow);
        border-color: transparent;
    }
    
    .filter-search-box {
        background: #1a1d20;
        color: #e5e7eb;
        border-top-color: rgba(255, 255, 255, 0.12);
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-search-box:focus {
        box-shadow: var(--shadow-focus-glow);
        border-color: transparent;
    }
    
    .filter-multiselect {
        background: #1a1d20;
    }
    
    .filter-multiselect::-webkit-scrollbar-track {
        background: #0f1113;
    }
    
    .filter-multiselect::-webkit-scrollbar-thumb {
        background: #3a3d40;
    }
    
    .filter-multiselect::-webkit-scrollbar-thumb:hover {
        background: #4a4d50;
    }
    
    .filter-option {
        color: #9ca3af;
    }
    
    .filter-option:hover {
        background: #2a2d30;
    }
    
    .filter-option.selected {
        background: #2d8998;
        color: white;
    }
    
    .filter-option.selected:hover {
        background: #3a9faf;
    }
    
    .filter-option label {
        color: inherit;
        background: transparent;
        padding: 0;
    }
    
    /* Drag-select visual feedback in dark mode */
    .filter-multiselect.drag-selecting {
        cursor: grabbing;
    }
    
    .filter-option.drag-hover {
        background: #3a9faf;
        border: 1px solid #4fb3c5;
        color: white;
    }
    
    /* Tooltip in dark mode */
    .filter-option-tooltip {
        background: #374151;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15);
    }
    
    .filter-option-tooltip::after {
        border-top-color: #374151;
    }
    
    .filter-checkbox-container {
        background: #1a1d20;
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-checkbox-header {
        color: #e5e7eb;
    }
    
    .filter-checkbox-group label {
        color: #9ca3af;
    }
    
    .filter-checkbox-inline label {
        color: #9ca3af;
    }
    
    .filter-more-btn {
        background: #1a1d20;
        color: #e5e7eb;
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-more-btn:hover {
        background: #2a2d30;
    }
    
    .filter-clear-btn {
        background: #2a2d30;
        color: #e5e7eb;
    }
    
    .filter-clear-btn:hover {
        background: #3a3d40;
    }
    
    .filter-badge {
        background: rgba(45, 137, 152, 0.2);
        border-color: #2d8998;
        color: #4fb3c5;
    }
    
    .filter-badge[data-tooltip]:hover::before {
        background: #2a2d30;
        color: #e5e7eb;
        border-color: #2d8998;
        box-shadow: 0 4px 12px rgba(45, 137, 152, 0.3), 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .filter-badge[data-tooltip]:hover::after {
        border-top-color: #2a2d30;
    }
    
    /* Date badge tooltips should be single line in dark mode too */
    .filter-badge[data-filter-type="date"][data-tooltip]:hover::before {
        white-space: nowrap;
        max-width: none;
        width: auto;
    }
    
    .badge-remove {
        color: #4fb3c5;
    }
    
    .badge-remove:hover {
        background: rgba(45, 137, 152, 0.3);
        color: #6fd5e7;
    }
    
    .filter-chip {
        background: rgba(45, 137, 152, 0.2);
        border-color: #2d8998;
        color: #4fb3c5;
    }
    
    .filter-chip-remove {
        color: #4fb3c5;
    }
    
    .filter-chip-remove:hover {
        background: rgba(45, 137, 152, 0.3);
    }
    
    .products-count-display,
    .firmware-count-display,
    .pcb-count-display {
        color: #9ca3af;
    }
    
    .filters-separator {
        background: rgba(255, 255, 255, 0.12);
    }
    
    .filter-section-container {
        background: #1a1d20;
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-section-header {
        color: #e5e7eb;
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-daterange {
        background: #0f1113;
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .filter-date-input {
        background: #1a1d20;
        color: #e5e7eb;
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .filter-date-input:hover {
        background: #2a2d30;
        border-color: rgba(255, 255, 255, 0.25);
    }
    
    .filter-date-input:focus {
        border-color: transparent;
        background: #2a2d30;
        box-shadow: var(--shadow-focus-glow);
    }
    
    .date-separator {
        color: #9ca3af;
    }
    
    .prefilter-count {
        background: #1a1d20;
        color: #9ca3af;
    }
    
    .prefilter-count strong {
        color: #4fb3c5;
    }
}

/* ==================== PCB DASHBOARD FILTER HEIGHT ADJUSTMENTS ==================== */
/* Reduce height of Created Date and Status filters so they can stack vertically */
/* and match the height of FilterItemSelector components */

/* Ensure Created Date and Status filters have the same width */
#pcbFilters #filterPcbCreatedDateContainer,
#pcbFilters #filterPcbStatusContainer {
    width: 100%;
    min-width: 180px;
}

#pcbFilters #filterPcbCreatedDateContainer .filter-group,
#pcbFilters #filterPcbStatusContainer .filter-group {
    width: 100%;
}

/* Created Date Filter (FilterDatePicker) */
#pcbFilters #filterPcbCreatedDateContainer .filter-group {
    padding: 2px 5px;
}

#pcbFilters #filterPcbCreatedDateContainer .filter-group label {
    padding: 2px 10px;
    font-size: 11px;
}

#pcbFilters #filterPcbCreatedDateContainer .date-range-input {
    padding: 2px 20px;
    font-size: 11px;
    line-height: 1.2;
}

/* Status Filter (FilterDropdown) */
#pcbFilters #filterPcbStatusContainer .filter-group {
    padding: 2px 5px;
}

#pcbFilters #filterPcbStatusContainer .filter-group label {
    padding: 2px 10px;
    font-size: 11px;
}

#pcbFilters #filterPcbStatusContainer .filter-dropdown-trigger {
    padding: 2px 12px !important;
    min-height: 24px !important;
    font-size: 11px !important;
    width: 100% !important;
}

#pcbFilters #filterPcbStatusContainer .filter-dropdown-text {
    font-size: 11px !important;
    line-height: 1.2 !important;
}

/* FilterItemSelector components in PCB Dashboard - match other filter font sizes */
#pcbFilters .filter-group:has(.filter-multiselect) {
    padding: 2px 5px;
}

#pcbFilters .filter-group:has(.filter-multiselect) label {
    padding: 2px 10px;
    font-size: 11px;
}

#pcbFilters .filter-group:has(.filter-multiselect) .filter-search-box {
    padding: 3px 12px;
    font-size: 11px;
    line-height: 1.4;
}

#pcbFilters .filter-group:has(.filter-multiselect) .filter-option {
    padding: 1px 5px;
    font-size: 11px;
    line-height: 1.4;
    color: #4a5568;
}

#pcbFilters .filter-group:has(.filter-multiselect) .filter-option label {
    font-size: 11px;
    line-height: 1.4;
}
