/**
 * Ultimate Filter System Styles
 * Modern, responsive design with accessibility and performance in mind
 */

/* ===== CORE FILTER LAYOUT ===== */
.filter-offcanvas {
  width: 400px !important;
  max-width: 95vw;
  border: none;
  box-shadow: -2px 0 15px rgba(0, 0, 0, 0.1);
}

.filter-sidebar {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.filter-sidebar:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* ===== FILTER SECTIONS ===== */
.filter-section {
  position: relative;
  transition: all 0.2s ease;
}

.filter-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid #dee2e6;
}

.filter-content {
  background: #ffffff;
}

/* ===== STATUS AND INDICATORS ===== */
.filter-status-bar {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  border-bottom: 1px solid #e1bee7;
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-count-badge {
  animation: filterBadgePulse 0.6s ease-in-out;
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  border: none;
  color: white;
  font-weight: 600;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
}

@keyframes filterBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== FILTER TAGS CLOUD ===== */
.active-filters-cloud {
  background: linear-gradient(135deg, #fff3e0 0%, #fce4ec 100%);
  border-bottom: 1px solid #f8bbd9;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  animation: filterTagSlide 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
  transition: all 0.2s ease;
}

.filter-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.filter-tag .btn-close {
  --bs-btn-close-color: rgba(255, 255, 255, 0.8);
  --bs-btn-close-hover-color: white;
  font-size: 0.7rem;
  margin-left: 0.5rem;
  padding: 0.1rem;
  background-size: 0.75em;
}

@keyframes filterTagSlide {
  from {
    opacity: 0;
    transform: translateX(-30px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ===== QUICK FILTERS ===== */
.quick-filters {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.quick-filter-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quick-filter-btn:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.quick-filter-btn:hover:before {
  left: 100%;
}

.quick-filter-btn.active {
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  border-color: transparent;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.quick-filter-btn:focus {
  box-shadow: 0 0 0 0.25rem rgba(25, 118, 210, 0.25);
}

/* ===== PRICE SLIDER ===== */
.price-slider-container {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.price-slider {
  height: 10px;
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  border-radius: 5px;
  position: relative;
  margin: 1.5rem 0;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.price-range-display {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

/* ===== COLOR SWATCHES ===== */
.color-swatch,
.color-indicator {
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
}

.color-swatch:hover,
.color-indicator:hover {
  transform: scale(1.3);
  box-shadow: 0 0 0 2px #1976d2, 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-group {
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid transparent;
  background-clip: padding-box;
  position: relative;
}

.color-group:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  border-radius: 0 4px 4px 0;
}

.color-group-header {
  font-weight: 600;
  color: #424242;
}

/* ===== FORM CONTROLS ===== */
.form-check {
  padding: 0.75rem 0.5rem;
  margin: 0;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.form-check:hover {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  transform: translateX(4px);
}

.form-check-input {
  margin-top: 0.125em;
  transition: all 0.2s ease;
}

.form-check-input:checked {
  background-color: #1976d2;
  border-color: #1976d2;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 0.25rem rgba(25, 118, 210, 0.25);
}

.form-check-label {
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  color: #424242;
  transition: color 0.2s ease;
  width: 100%;
}

.form-check:hover .form-check-label {
  color: #1976d2;
}

/* ===== SEARCH INPUTS ===== */
.filter-search-input {
  border: 2px solid #e9ecef;
  border-radius: 20px;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.filter-search-input:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 0.25rem rgba(25, 118, 210, 0.15);
  transform: scale(1.02);
}

/* ===== ACCORDION STYLING ===== */
.accordion-button {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: none;
  font-weight: 600;
  padding: 1rem 1.25rem;
  color: #424242;
  transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.accordion-button:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 0.25rem rgba(25, 118, 210, 0.25);
}

.accordion-body {
  padding: 1.25rem;
  background: #ffffff;
}

/* ===== ACTION BUTTONS ===== */
.filter-actions {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  border-top: 1px solid #e1bee7;
}

.apply-filters-btn {
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  border: none;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
  position: relative;
  overflow: hidden;
}

.apply-filters-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
}

.apply-filters-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.clear-filters-btn {
  border: 2px solid #dee2e6;
  color: #6c757d;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 25px;
  transition: all 0.3s ease;
}

.clear-filters-btn:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: linear-gradient(135deg, #fff5f5 0%, #fdecea 100%);
  transform: translateY(-1px);
}

/* ===== LOADING STATES ===== */
.filter-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.filter-loading:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 10;
}

.apply-filters-btn .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 0.125em;
}

/* ===== UTILITY CLASSES ===== */
.max-height-300 {
  max-height: 300px;
}

.overflow-auto {
  overflow-y: auto;
  scroll-behavior: smooth;
}

.overflow-auto::-webkit-scrollbar {
  width: 6px;
}

.overflow-auto::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.overflow-auto::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #1976d2 0%, #7b1fa2 100%);
  border-radius: 3px;
}

.overflow-auto::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #1565c0 0%, #6a1b9a 100%);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 991.98px) {
  .filter-sidebar {
    display: none !important;
  }
  
  .filter-offcanvas {
    width: 350px !important;
  }
}

@media (max-width: 575.98px) {
  .filter-offcanvas {
    width: 100vw !important;
  }
  
  .filter-tags {
    gap: 0.25rem;
  }
  
  .filter-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  
  .quick-filter-btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}

@media (min-width: 992px) {
  .filter-offcanvas {
    display: none !important;
  }
  
  .filter-sidebar {
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 140px);
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators for keyboard navigation */
.filter-sidebar:focus-within {
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.3);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .filter-tag,
  .quick-filter-btn.active,
  .apply-filters-btn {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
  }
  
  .form-check-input:checked {
    background-color: #000000 !important;
    border-color: #000000 !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .filter-sidebar,
  .filter-content,
  .accordion-body {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border-color: #333333 !important;
  }
  
  .filter-section {
    border-color: #333333 !important;
  }
  
  .form-check-label {
    color: #e0e0e0 !important;
  }
  
  .color-group {
    background: #2a2a2a !important;
  }
}