/**
 * Sophia STARS - Advanced Filtering System Styles
 * Styles for multi-select filters, date ranges, and filter presets
 * Version: 2026.1
 */

/* Filter Toggle Button */
.advanced-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: white;
  color: #003057;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.75rem;
}

.advanced-filter-toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 48, 87, 0.08);
}

.advanced-filter-toggle svg {
  flex-shrink: 0;
}

.advanced-filter-toggle.has-filters {
  background: linear-gradient(135deg, #003057 0%, #0066cc 100%);
  color: white;
  border-color: #003057;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Filter Panel */
.advanced-filter-panel {
  position: relative;
  margin-top: 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 48, 87, 0.08);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Filter Panel Header */
.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.filter-panel-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #003057;
}

.filter-panel-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-panel-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-panel-actions button:hover {
  background: #f8fafc;
  color: #003057;
  border-color: #cbd5e1;
}

/* Filter Panel Content */
.filter-panel-content {
  padding: 1.5rem;
  max-height: 500px;
  overflow-y: auto;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

/* Date Range Filter */
.date-range-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.date-preset {
  padding: 0.5rem 0.875rem;
  background: white;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.date-preset:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.date-preset.active {
  background: #003057;
  color: white;
  border-color: #003057;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.date-inputs input[type="date"] {
  flex: 1;
  padding: 0.625rem 0.875rem;
  background: white;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.date-inputs input[type="date"]:focus {
  outline: none;
  border-color: #003057;
  box-shadow: 0 0 0 3px rgba(0, 48, 87, 0.1);
}

.date-inputs span {
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Multi-Select Container */
.multi-select-container {
  position: relative;
}

.multi-select-search {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: white;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.multi-select-search:focus {
  outline: none;
  border-color: #003057;
  box-shadow: 0 0 0 3px rgba(0, 48, 87, 0.1);
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 200px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 48, 87, 0.12);
  overflow-y: auto;
  z-index: 100;
}

.multi-select-options {
  padding: 0.5rem;
}

.multi-select-options.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.checkbox-label:hover {
  background: #f8fafc;
}

.multi-select-options.inline .checkbox-label {
  padding: 0.5rem 0.875rem;
  background: white;
  border: 1px solid #e2e8f0;
}

.multi-select-options.inline .checkbox-label:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.multi-select-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.multi-select-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: #f1f5f9;
  color: #475569;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.multi-select-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 50%;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.multi-select-tag-remove:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #334155;
}

/* Filter Panel Footer */
.filter-panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
}

.filter-reset-btn,
.filter-apply-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-reset-btn {
  background: white;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.filter-reset-btn:hover {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

.filter-apply-btn {
  background: linear-gradient(135deg, #003057 0%, #0066cc 100%);
  color: white;
  border: none;
}

.filter-apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 48, 87, 0.2);
}

/* Dark Mode Support */
[data-theme="dark"] .advanced-filter-toggle {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

[data-theme="dark"] .advanced-filter-toggle:hover {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .advanced-filter-panel {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .filter-panel-header {
  border-color: #334155;
}

[data-theme="dark"] .filter-panel-header h3 {
  color: #f1f5f9;
}

[data-theme="dark"] .filter-panel-actions button {
  background: transparent;
  color: #94a3b8;
  border-color: #334155;
}

[data-theme="dark"] .filter-panel-actions button:hover {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

[data-theme="dark"] .filter-label {
  color: #e2e8f0;
}

[data-theme="dark"] .date-preset {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}

[data-theme="dark"] .date-preset:hover {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

[data-theme="dark"] .date-preset.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

[data-theme="dark"] .date-inputs input[type="date"],
[data-theme="dark"] .multi-select-search {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
}

[data-theme="dark"] .date-inputs input[type="date"]:focus,
[data-theme="dark"] .multi-select-search:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .multi-select-dropdown {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .checkbox-label:hover {
  background: #334155;
}

[data-theme="dark"] .multi-select-options.inline .checkbox-label {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .multi-select-options.inline .checkbox-label:hover {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .multi-select-tag {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .filter-panel-footer {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .filter-reset-btn {
  background: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}

[data-theme="dark"] .filter-reset-btn:hover {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

/* Responsive Design */
@media (max-width: 768px) {
  .filter-panel-header,
  .filter-panel-content,
  .filter-panel-footer {
    padding: 1rem;
  }
  
  .date-presets {
    gap: 0.375rem;
  }
  
  .date-preset {
    padding: 0.4375rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .date-inputs {
    flex-direction: column;
    align-items: stretch;
  }
  
  .date-inputs span {
    display: none;
  }
  
  .filter-panel-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .filter-reset-btn,
  .filter-apply-btn {
    width: 100%;
  }
}

/* Accessibility */
.advanced-filter-toggle:focus,
.date-preset:focus,
.checkbox-label:focus-within,
.filter-reset-btn:focus,
.filter-apply-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .advanced-filter-toggle,
  .advanced-filter-panel {
    display: none !important;
  }
}
