/* ========================================
   EXCEL-LIKE TABLE FILTERS - FIXED VERSION
   table-filters.css
   ======================================== */

/* Ensure table headers support positioning */
.customer-table thead th {
    position: relative;
    padding-right: 30px !important; /* Make room for filter button */
}

/* Filter Button in Header */
.filter-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #f3f4f6;
    border: 1px solid #cbd5e1;
    color: #64748b;
    cursor: pointer;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
}

.filter-btn:hover {
    background: #e2e8f0;
    color: #3b82f6;
    border-color: #3b82f6;
}

.filter-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #2563eb;
    font-weight: bold;
}

/* Filter Menu Dropdown - INCREASED Z-INDEX */
.filter-menu {
    position: absolute;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 9999 !important; /* CRITICAL: Very high z-index */
    min-width: 250px;
    max-width: 350px;
    margin-top: 4px;
    display: block !important; /* Force display */
    visibility: visible !important;
}

/* Filter Header (Search area) */
.filter-menu .filter-header {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #f9fafb;
    border-radius: 6px 6px 0 0;
}

.filter-menu .filter-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.filter-search {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.filter-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-clear {
    padding: 6px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    color: #6b7280;
    white-space: nowrap;
}

.filter-clear:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* Filter Options List */
.filter-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: white;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.15s;
    user-select: none;
    margin-bottom: 2px;
}

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

.filter-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

.filter-option span {
    flex: 1;
    color: #374151;
}

/* First option (Select All) styling */
.filter-option:first-child {
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 4px;
}

/* Filter Divider */
.filter-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

/* Filter Footer (Action Buttons) */
.filter-footer {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    background: #f9fafb;
    border-radius: 0 0 6px 6px;
}

.filter-footer button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-apply {
    background: #3b82f6;
    color: white;
}

.btn-apply:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-cancel {
    background: #e5e7eb;
    color: #374151;
}

.btn-cancel:hover {
    background: #d1d5db;
}

.btn-clear {
    background: #ef4444;
    color: white;
}

.btn-clear:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

/* Number Range Filter */
.filter-number-range {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: white;
}

.filter-number-range label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.filter-number-range input {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.filter-number-range input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Scrollbar Styling */
.filter-options::-webkit-scrollbar {
    width: 8px;
}

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

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

.filter-options::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Ensure parent containers don't clip */
.customer-table {
    position: relative;
    overflow: visible !important;
}

.customer-table thead {
    position: relative;
    overflow: visible !important;
}

.customer-table thead tr {
    position: relative;
    overflow: visible !important;
}
