/* Advanced Filter Features CSS */

/* ==================== Filter Presets ==================== */
.filter-presets {
  padding: 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 16px;
  margin-bottom: 20px;
  border: 2px solid #bfdbfe;
}

.presets-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e40af;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.presets-title i {
  font-size: 16px;
  color: #2563eb;
}

.presets-grid {
  display: grid;
  gap: 8px;
}

.preset-btn {
  padding: 12px 16px;
  background: #ffffff;
  border: 2px solid #e0e7ff;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  position: relative;
  overflow: hidden;
}

.preset-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
  transition: left 0.5s ease;
}

.preset-btn:hover::before {
  left: 100%;
}

.preset-btn:hover {
  border-color: #2563eb;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.preset-btn.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: #ffffff;
}

.preset-btn i {
  font-size: 16px;
  color: #2563eb;
  transition: color 0.3s ease;
}

.preset-btn.active i {
  color: #ffffff;
}

/* ==================== Saved Filters ==================== */
.saved-filters-section {
  padding: 0 0 20px 0;
  border-bottom: 2px solid #f1f5f9;
  margin-bottom: 20px;
}

.saved-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.saved-filters-header .filter-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-save-current {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-save-current:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.saved-filters-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.no-saved-filters {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin: 0;
}

.saved-filter-item {
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.saved-filter-item:hover {
  background: #eff6ff;
  border-color: #2563eb;
  transform: translateX(-3px);
}

.saved-filter-name {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  flex: 1;
}

.saved-filter-actions {
  display: flex;
  gap: 4px;
}

.btn-delete-filter {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.btn-delete-filter:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* ==================== Price Histogram ==================== */
.price-histogram {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 80px;
  gap: 4px;
  padding: 0 4px 12px 4px;
  margin-bottom: 16px;
  background: #f8fafc;
  border-radius: 12px;
  position: relative;
}

.price-histogram::after {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 4px;
  right: 4px;
  height: 1px;
  background: #e2e8f0;
}

.histogram-bar {
  flex: 1;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 8px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.histogram-bar:hover {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
  transform: scaleY(1.05);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.histogram-bar::before {
  content: attr(data-range);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #64748b;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.histogram-bar:hover::before {
  opacity: 1;
}

/* ==================== Location & Condition Filters ==================== */
.filter-section .filter-option label i {
  font-size: 14px;
  margin-left: 4px;
}

/* ==================== Animations ==================== */
@keyframes filterSlideIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.saved-filter-item {
  animation: filterSlideIn 0.3s ease;
}

/* ==================== Mobile Responsive ==================== */
@media (max-width: 768px) {
  .filter-presets {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .presets-title {
    font-size: 14px;
  }
  
  .preset-btn {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .saved-filters-section {
    padding: 0 0 16px 0;
    margin-bottom: 16px;
  }
  
  .price-histogram {
    height: 60px;
  }
  
  .histogram-bar::before {
    font-size: 8px;
  }
}

/* ==================== Save Filter Modal ==================== */
.save-filter-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.save-filter-modal.active {
  display: flex;
}

.save-filter-content {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.save-filter-content h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 16px 0;
}

.save-filter-content input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.save-filter-content input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.save-filter-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.save-filter-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-confirm-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.btn-confirm-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-cancel-save {
  background: #f1f5f9;
  color: #64748b;
}

.btn-cancel-save:hover {
  background: #e2e8f0;
}

/* ==================== Filter Summary ==================== */
.filter-summary {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #fbbf24;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  animation: slideDown 0.4s ease;
}

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

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
}

.summary-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #78350f;
}

.summary-title i {
  font-size: 16px;
  color: #d97706;
}

.btn-clear-all-filters {
  padding: 8px 16px;
  background: #ffffff;
  border: 2px solid #fbbf24;
  border-radius: 10px;
  color: #d97706;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-clear-all-filters:hover {
  background: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
  transform: scale(1.05);
}

.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 2px solid #fbbf24;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #78350f;
  animation: tagPopIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tagPopIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.summary-tag-label {
  color: #92400e;
  font-weight: 500;
}

.summary-tag-value {
  color: #78350f;
  font-weight: 700;
}

.summary-tag-remove {
  width: 20px;
  height: 20px;
  background: #fef3c7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 10px;
  color: #d97706;
  border: none;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.summary-tag-remove:hover {
  background: #ef4444;
  color: #ffffff;
  transform: rotate(90deg);
}

/* Mobile Responsive for Summary */
@media (max-width: 768px) {
  .filter-summary {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .summary-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .btn-clear-all-filters {
    justify-content: center;
  }
  
  .summary-tags {
    gap: 6px;
  }
  
  .summary-tag {
    font-size: 12px;
    padding: 6px 10px;
  }
}
