/**
 * Advanced Search Styles - Конструктор запросов
 */

/* Query Builder */
.query-builder {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.query-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.query-builder-header h4 {
  margin: 0;
  font-size: 16px;
  color: #1f2937;
}

.query-builder-actions {
  display: flex;
  gap: 8px;
}

.save-query-btn,
.load-query-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.save-query-btn:hover,
.load-query-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* Query Conditions */
.query-conditions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.query-condition-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.condition-field-select,
.condition-operator-select {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  cursor: pointer;
}

.condition-field-select:focus,
.condition-operator-select:focus {
  outline: none;
  border-color: #6f86cf;
  box-shadow: 0 0 0 3px rgba(111, 134, 207, 0.1);
}

.condition-value-input {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

.condition-value-input:focus {
  outline: none;
  border-color: #6f86cf;
  box-shadow: 0 0 0 3px rgba(111, 134, 207, 0.1);
}

.condition-value-input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.remove-condition-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s ease;
}

.remove-condition-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Query Builder Footer */
.query-builder-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.add-condition-btn {
  padding: 10px 16px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
  cursor: pointer;
  transition: all 0.15s ease;
  align-self: flex-start;
}

.add-condition-btn:hover {
  background: #dbeafe;
  border-color: #6f86cf;
}

.query-join-type {
  display: flex;
  align-items: center;
  gap: 12px;
}

.query-join-type span {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.query-join-type select {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  cursor: pointer;
}

.query-join-type select:focus {
  outline: none;
  border-color: #6f86cf;
}

.query-results-preview {
  padding: 12px 16px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  color: #6b7280;
}

.query-results-preview strong {
  color: #6f86cf;
  font-size: 16px;
}

.query-actions {
  display: flex;
  gap: 12px;
}

.apply-query-btn {
  flex: 1;
  padding: 10px 20px;
  background: #6f86cf;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: white;
  cursor: pointer;
  transition: all 0.15s ease;
}

.apply-query-btn:hover {
  background: #5671c0;
}

.clear-query-btn {
  padding: 10px 20px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.clear-query-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Saved Queries Dialog */
.saved-queries-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  background: transparent;
}

.saved-queries-list {
  background: white;
  border-radius: 12px;
  padding: 24px;
}

.saved-queries-list h4 {
  margin: 0 0 20px;
  font-size: 16px;
  color: #1f2937;
}

.saved-query-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
}

.saved-query-item span {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.saved-query-actions {
  display: flex;
  gap: 8px;
}

.saved-query-actions button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.saved-query-actions button:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.saved-query-actions button:first-child:hover {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #1e40af;
}

/* Dark Theme */
body.dark-theme .query-builder {
  background: #1e293b;
}

body.dark-theme .query-builder-header {
  border-bottom-color: #334155;
}

body.dark-theme .query-builder-header h4 {
  color: #e2e8f0;
}

body.dark-theme .save-query-btn,
body.dark-theme .load-query-btn {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .save-query-btn:hover,
body.dark-theme .load-query-btn:hover {
  background: #475569;
}

body.dark-theme .query-conditions {
  background: transparent;
}

body.dark-theme .query-condition-row {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .condition-field-select,
body.dark-theme .condition-operator-select {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .condition-field-select:focus,
body.dark-theme .condition-operator-select:focus {
  border-color: #6f86cf;
}

body.dark-theme .condition-value-input {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .condition-value-input:focus {
  border-color: #6f86cf;
}

body.dark-theme .remove-condition-btn:hover {
  background: #7f1d1d;
  color: #fca5a5;
}

body.dark-theme .query-builder-footer {
  border-top-color: #334155;
}

body.dark-theme .add-condition-btn {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

body.dark-theme .add-condition-btn:hover {
  background: #1e40af;
}

body.dark-theme .query-join-type span {
  color: #94a3b8;
}

body.dark-theme .query-join-type select {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .query-join-type select:focus {
  border-color: #6f86cf;
}

body.dark-theme .query-results-preview {
  background: #0f172a;
  color: #94a3b8;
}

body.dark-theme .query-results-preview strong {
  color: #6f86cf;
}

body.dark-theme .clear-query-btn {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .clear-query-btn:hover {
  background: #475569;
}

body.dark-theme .saved-queries-list {
  background: #1e293b;
}

body.dark-theme .saved-queries-list h4 {
  color: #e2e8f0;
}

body.dark-theme .saved-query-item {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .saved-query-item span {
  color: #e2e8f0;
}

body.dark-theme .saved-query-actions button {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .saved-query-actions button:hover {
  background: #475569;
}
