/**
 * Filter Panel Styles
 * 
 * Styles for the multi-select filter UI with four filter categories.
 * Mobile-first responsive design with touch-friendly interactions.
 */

.filter-panel {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.filter-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.filter-panel__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.filter-panel__clear-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-panel__clear-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

.filter-panel__clear-btn:active {
  transform: scale(0.98);
}

.filter-panel__clear-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.filter-panel__count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f0f9ff;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #0369a1;
}

.filter-panel__count-number {
  font-weight: 700;
  font-size: 1.125rem;
}

.filter-panel__categories {
  display: grid;
  gap: 1.5rem;
}

/* Filter Category */
.filter-category {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
}

.filter-category:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.filter-category__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
}

.filter-category__title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.filter-category__toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.filter-category--expanded .filter-category__toggle {
  transform: rotate(180deg);
}

.filter-category__options {
  display: none;
  padding-top: 0.75rem;
  gap: 0.5rem;
  flex-direction: column;
}

.filter-category--expanded .filter-category__options {
  display: flex;
}

/* Filter Option (Checkbox) */
.filter-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 44px; /* Touch-friendly */
}

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

.filter-option__checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.filter-option__checkbox--checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.filter-option__checkbox--checked::after {
  content: "✓";
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.filter-option__label {
  flex: 1;
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.4;
}

.filter-option__count {
  font-size: 0.75rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
}

/* Active Filters Summary */
.filter-panel__active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #dbeafe;
  color: #1e40af;
  padding: 0.375rem 0.75rem;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
}

.filter-tag__remove {
  background: transparent;
  border: none;
  color: #1e40af;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.filter-tag__remove:hover {
  background: rgba(30, 64, 175, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .filter-panel {
    padding: 1rem;
  }

  .filter-panel__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .filter-panel__clear-btn {
    width: 100%;
  }

  .filter-category__header {
    padding: 0.75rem 0;
  }

  .filter-option {
    padding: 0.75rem;
  }
}

/* Mobile Bottom Sheet (for small screens) */
@media (max-width: 640px) {
  .filter-panel--mobile-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .filter-panel--mobile-sheet.active {
    transform: translateY(0);
  }

  .filter-panel__mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .filter-panel__mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Loading State */
.filter-panel--loading {
  opacity: 0.6;
  pointer-events: none;
}

.filter-panel__loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Accessibility */
.filter-option:focus-within {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.filter-category__header:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Print Styles */
@media print {
  .filter-panel {
    display: none;
  }
}
