/* ========== ANALYTICS V2 MULTI-SELECT & EXCLUDE STYLES ========== */

/* Filter Mode Selector */
.filter-mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 4px;
    background: #f8fafc;
    border-radius: 8px;
}

.mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid transparent;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mode-btn:hover {
    background: #e2e8f0;
}

.mode-btn.active.include-mode {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.mode-btn.active.exclude-mode {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.mode-btn i {
    font-size: 12px;
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.bulk-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #6b7280;
}

.bulk-btn:hover {
    background: #f9fafb;
    border-color: #3b82f6;
    color: #3b82f6;
}

.bulk-btn i {
    font-size: 11px;
}

/* Legend Item States */
.legend-item {
    position: relative;
    padding-left: 32px !important; /* Space for checkbox */
}

.legend-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: white;
    transition: all 0.2s ease;
}

/* Included State (Green) */
.legend-item.selected.include-mode::before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.legend-item.selected.include-mode {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-left: 3px solid #10b981;
    font-weight: 600;
}

.legend-item.selected.include-mode .legend-item-count {
    color: #065f46;
}

/* Excluded State (Red) */
.legend-item.selected.exclude-mode::before {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #ef4444;
    content: '✕';
    color: white;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.legend-item.selected.exclude-mode {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-left: 3px solid #ef4444;
    font-weight: 600;
    text-decoration: line-through;
    opacity: 0.8;
}

.legend-item.selected.exclude-mode .legend-item-count {
    color: #991b1b;
    text-decoration: line-through;
}

/* Hover states */
.legend-item:hover::before {
    border-color: #3b82f6;
    transform: translateY(-50%) scale(1.1);
}

/* Selection Counter */
.selection-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
}

.selection-counter.include-mode {
    background: #d1fae5;
    color: #065f46;
}

.selection-counter.exclude-mode {
    background: #fee2e2;
    color: #991b1b;
}

.selection-counter-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.selection-counter-value {
    font-size: 14px;
}

/* Applied Filters Display Enhancement */
.filter-chip.include-mode {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-color: #10b981;
}

.filter-chip.exclude-mode {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-color: #ef4444;
    text-decoration: line-through;
}

.filter-chip.include-mode i {
    color: #10b981;
}

.filter-chip.exclude-mode i {
    color: #ef4444;
}

/* Mode Badge in Filter Chip */
.filter-mode-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 6px;
}

.filter-mode-badge.include {
    background: #10b981;
    color: white;
}

.filter-mode-badge.exclude {
    background: #ef4444;
    color: white;
}

/* Pending Selection Banner */
.pending-selection-banner {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    animation: slideDown 0.3s ease;
}

.pending-selection-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #1e40af;
    font-weight: 600;
    font-size: 13px;
}

.pending-selection-info i {
    color: #3b82f6;
    font-size: 16px;
}

.pending-selection-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.apply-mode-btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.apply-mode-btn.include {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.apply-mode-btn.include:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.apply-mode-btn.exclude {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.apply-mode-btn.exclude:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.cancel-selection-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

/* Pending Selection Item State */
.legend-item.pending-selection {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 3px solid #3b82f6;
    font-weight: 600;
    color: #1e40af;
}

.legend-item.pending-selection::before {
    background: #3b82f6;
    border-color: #3b82f6;
    content: '○';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.legend-item.pending-selection .legend-item-count {
    color: #1e40af;
}

/* Pending Reload Indicator */
.pending-reload-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pending-reload-indicator i {
    font-size: 16px;
}

.apply-now-btn {
    background: white;
    color: #3b82f6;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.apply-now-btn:hover {
    background: #f0f9ff;
    transform: scale(1.05);
}

/* Select All Search Results Button */
.select-all-search-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.select-all-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.select-all-search-btn i {
    font-size: 14px;
}

/* Search More Message */
.search-more-message {
    padding: 12px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.search-more-message i {
    color: #f59e0b;
}

/* Loading Message */
.loading-message {
    padding: 12px;
    background: #e0f2fe;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    color: #1e40af;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading-message i {
    color: #3b82f6;
    font-size: 16px;
}

/* Search & Exclude Button */
.search-exclude-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.legend-search-container:hover .search-exclude-btn {
    opacity: 1;
}

.search-exclude-btn:hover {
    background: #dc2626;
}

/* Empty State for No Selection */
.no-selection-message {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    font-size: 13px;
}

.no-selection-message i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
    color: #d1d5db;
}

/* Animation for mode switch */
@keyframes modeSwitch {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.legend-item.mode-switching {
    animation: modeSwitch 0.3s ease;
}

/* Tooltip for mode explanation */
.mode-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 8px;
    z-index: 1000;
}

.mode-btn:hover .mode-tooltip {
    opacity: 1;
}

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