/* ═══════════════════════════════════════════════════════════════════════════
   HISTORIAL DE BÚSQUEDAS - Estilo Apple
   ═══════════════════════════════════════════════════════════════════════════ */

.historial-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.historial-header {
  margin-bottom: 2rem;
}

.historial-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.historial-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -0.02em;
}

.historial-config-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: #f5f5f7;
  border: none;
  border-radius: 980px;
  color: #1d1d1f;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.historial-config-btn:hover {
  background: #e8e8ed;
}

.historial-config-btn svg {
  color: #86868b;
}

/* Config Panel */
.historial-config-panel {
  background: #f5f5f7;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-top: 1rem;
  animation: slideDown 0.3s ease;
}

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

.config-panel-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.config-row label {
  color: #1d1d1f;
  font-size: 0.9375rem;
  font-weight: 500;
}

.config-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.config-input-group span {
  color: #86868b;
  font-size: 0.875rem;
}

.config-input {
  width: 70px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d2d2d7;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  text-align: center;
  background: #fff;
  transition: all 0.2s ease;
}

.config-input:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.config-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.btn-config-save {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 980px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-config-save:hover {
  background: #0077ed;
}

.btn-config-danger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  color: #ff3b30;
  border: 1px solid #ff3b30;
  border-radius: 980px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-config-danger:hover {
  background: #ff3b30;
  color: #fff;
}

.config-status {
  color: #86868b;
  font-size: 0.8125rem;
}

/* Filtros */
.historial-filters {
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

.filter-section {
  margin-bottom: 1.5rem;
}

.filter-section:last-of-type {
  margin-bottom: 0;
}

.filter-section-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.filter-label-small {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #86868b;
  margin-bottom: 0.5rem;
}

/* Filter Chips */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: #f5f5f7;
  border: 2px solid transparent;
  border-radius: 980px;
  color: #1d1d1f;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  background: #e8e8ed;
}

.filter-chip.active {
  background: #e1f0ff;
  border-color: #0071e3;
  color: #0071e3;
}

.chip-icon {
  font-size: 1rem;
}

/* Quick Date Options */
.quick-date-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-date-btn {
  padding: 0.625rem 1.25rem;
  background: #f5f5f7;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  color: #1d1d1f;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-date-btn:hover {
  background: #e8e8ed;
}

.quick-date-btn.active {
  background: #e1f0ff;
  border-color: #0071e3;
  color: #0071e3;
}

.quick-date-btn.custom {
  background: transparent;
  border: 2px dashed #d2d2d7;
  color: #86868b;
}

.quick-date-btn.custom:hover {
  border-color: #0071e3;
  color: #0071e3;
}

.quick-date-btn.custom.active {
  background: #fff;
  border-style: solid;
}

/* Custom Date Inputs */
.custom-date-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 1rem;
  background: #f5f5f7;
  border-radius: 0.75rem;
}

.custom-date-inputs.hidden {
  display: none;
}

.date-input {
  padding: 0.625rem 1rem;
  border: 1px solid #d2d2d7;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  background: #fff;
  color: #1d1d1f;
  transition: all 0.2s ease;
}

.date-input:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.date-separator {
  color: #86868b;
  font-weight: 500;
}

/* Filter Inputs */
.filter-input-group {
  flex: 1;
  min-width: 200px;
}

.filter-input-small {
  flex: 0 0 150px;
  min-width: 120px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg,
.input-with-icon .input-icon-text {
  position: absolute;
  left: 1rem;
  color: #86868b;
  pointer-events: none;
}

.input-icon-text {
  font-size: 0.9375rem;
  font-weight: 600;
}

.filter-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 1px solid #d2d2d7;
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  background: #f5f5f7;
  color: #1d1d1f;
  transition: all 0.2s ease;
}

.filter-input:focus {
  outline: none;
  background: #fff;
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.filter-input::placeholder {
  color: #86868b;
}

/* Actions */
.historial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f5f5f7;
  margin-top: 1.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 980px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #0077ed;
  transform: scale(1.02);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #f5f5f7;
  color: #1d1d1f;
  border: none;
  border-radius: 980px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e8e8ed;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: #ff3b30;
  border: 1px solid #ff3b30;
  border-radius: 980px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: #ff3b30;
  color: #fff;
}

/* Results Info */
.results-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid #f5f5f7;
}

.results-info.hidden {
  display: none;
}

#historialResultsCount {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1d1d1f;
}

#historialResultsImporte {
  font-size: 0.875rem;
  color: #86868b;
}

/* Results Container */
.historial-results {
  display: grid;
  gap: 1rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state.hidden {
  display: none;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9375rem;
  color: #86868b;
  max-width: 300px;
}

/* Loading State */
.historial-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.historial-loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid #f5f5f7;
  border-top-color: #0071e3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

  .historial-title {
    font-size: 1.5rem;
  }

  .historial-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .config-panel-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .config-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-section-row {
    flex-direction: column;
  }

  .filter-input-group,
  .filter-input-small {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .historial-actions {
    flex-direction: column;
  }

  .historial-actions button {
    width: 100%;
    justify-content: center;
  }

  .quick-date-options {
    flex-direction: column;
  }

  .quick-date-btn {
    width: 100%;
    text-align: center;
  }
}
