/* Query Editor Container */
.query-editor-container {
  position: relative;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
}

/* Shared styles for perfect alignment */
.query-editor-textarea,
.query-editor-highlight {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: 0;
  width: 100%;
  font-family: monospace;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  word-spacing: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  tab-size: 4;
  -moz-tab-size: 4;
  box-sizing: border-box;
  font-variant-ligatures: none;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
  text-rendering: auto;
}

/* Textarea specific */
.query-editor-textarea {
  position: relative;
  z-index: 2;
  background: transparent;
  color: transparent;
  caret-color: #000;
  resize: none;
  border-color: #c8c8c8;
  overflow: hidden;
  min-height: 120px;
}

/* Dark mode support for cursor */
@media (prefers-color-scheme: dark) {
  .query-editor-textarea {
    caret-color: #fff;
  }
}

.query-editor-textarea:focus {
  border-color: #0645ad;
  box-shadow: none;
  outline: none;
}

/* Syntax Highlighting Overlay */
.query-editor-highlight {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  min-height: 120px;
}

/* Syntax Highlighting Colors - Light Mode */
.query-highlight-keyword {
  color: #0066cc;
  font-weight: bold;
}

.query-highlight-operator {
  color: #aa5d00;
}

.query-highlight-function {
  color: #aa3731;
  font-weight: 600;
}

.query-highlight-builtin {
  color: #008000;
  font-weight: 600;
}

.query-highlight-string {
  color: #008000;
}

.query-highlight-number {
  color: #09885a;
}

.query-highlight-time_unit {
  color: #09885a;
  font-weight: 600;
}

.query-highlight-pipe {
  color: #999999;
  font-weight: bold;
}

.query-highlight-sort_order {
  color: #0066cc;
}

.query-highlight-punctuation {
  color: #333333;
}

.query-highlight-identifier {
  color: #333333;
}

.query-highlight-whitespace {
  color: transparent;
}

.query-highlight-unknown {
  color: #cc0000;
}

/* Syntax Highlighting Colors - Dark Mode */
@media (prefers-color-scheme: dark) {
  .query-highlight-keyword {
    color: #6cb6ff;
  }

  .query-highlight-operator {
    color: #ff9d5c;
  }

  .query-highlight-function {
    color: #ff6b6b;
  }

  .query-highlight-builtin {
    color: #4ade80;
  }

  .query-highlight-string {
    color: #4ade80;
  }

  .query-highlight-number {
    color: #5fd4b4;
  }

  .query-highlight-time_unit {
    color: #5fd4b4;
  }

  .query-highlight-pipe {
    color: #a0a0a0;
  }

  .query-highlight-sort_order {
    color: #6cb6ff;
  }

  .query-highlight-punctuation {
    color: #d4d4d4;
  }

  .query-highlight-identifier {
    color: #e5e5e5;
  }

  .query-highlight-unknown {
    color: #ff6b6b;
  }
}

/* Autocomplete Dropdown */
.query-autocomplete {
  position: absolute;
  z-index: 1000;
  background: white;
  border: 1px solid #c8c8c8;
  border-radius: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  max-height: 300px;
  overflow-y: auto;
  min-width: 250px;
  max-width: 400px;
}

.query-autocomplete.is-hidden {
  display: none;
}

.query-autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e8e8e8;
}

.query-autocomplete-item:last-child {
  border-bottom: none;
}

.query-autocomplete-item:hover,
.query-autocomplete-item.is-selected {
  background: rgba(0, 0, 0, 0.02);
}

.query-autocomplete-item .autocomplete-text {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.query-autocomplete-item .autocomplete-description {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Help text styling for kbd elements */
kbd {
  background-color: rgba(0, 0, 0, 0.03);
  border: 1px solid #c8c8c8;
  border-radius: 0;
  padding: 2px 6px;
  font-size: 0.85em;
  font-family: monospace;
}
