/* Series Typeahead Component */
.typeahead-container {
  position: relative;
  width: 100%;
}

.series-typeahead {
  position: relative;
}

.series-typeahead__input {
  width: 100%;
  padding: var(--size-2) var(--size-3);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-2);
  font-size: var(--font-size-1);
  background: var(--surface-1);
  color: var(--text-1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.series-typeahead__input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary), 0.1);
}

.series-typeahead__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-4);
  color: var(--on-surface-4);
  border: 1px solid var(--surface-3);
  border-top: none;
  border-radius: 0 0 var(--radius-2) var(--radius-2);
  box-shadow: var(--shadow-3);
  z-index: var(--layer-4);
  max-height: 200px;
  overflow-y: auto;
}

.series-typeahead__results {
  background: var(--surface-4);
  color: var(--on-surface-4);
}

.series-typeahead__result {
  display: block;
  width: 100%;
  padding: var(--size-2) var(--size-3);
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: var(--font-size-1);
  color: var(--on-surface-4);
}

.series-typeahead__result:hover {
  background: var(--surface-3);
}

.series-typeahead__result:focus {
  outline: none;
  background: var(--surface-3);
}

.series-typeahead__result-title {
  font-weight: var(--font-weight-5);
}

.series-typeahead__create {
  border-top: 1px solid var(--surface-3);
}

.series-typeahead__create-btn {
  display: block;
  width: 100%;
  padding: var(--size-2) var(--size-3);
  border: none;
  background: var(--surface-4);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: var(--font-size-1);
  color: var(--brand-primary);
  font-weight: var(--font-weight-5);
  opacity: 1;
}

.series-typeahead__create-btn:hover {
  background: var(--surface-3);
}

.series-typeahead__create-btn:focus {
  outline: none;
  background: var(--surface-3);
}

.series-typeahead__selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--size-2) var(--size-3);
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-2);
  font-size: var(--font-size-1);
  color: var(--text-1);
}

.series-typeahead__selected-text {
  flex: 1;
  font-weight: var(--font-weight-5);
}

.series-typeahead__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-1);
  color: var(--text-2);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.series-typeahead__remove:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.series-typeahead__remove:focus {
  outline: none;
  background: var(--surface-3);
  color: var(--text-1);
}

.series-typeahead__remove svg {
  width: 16px;
  height: 16px;
}

/* Loading state */
.series-typeahead--loading .series-typeahead__input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 11-6.219-8.56'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--size-2) center;
  background-size: 16px;
  animation: spin 1s linear infinite;
}

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

/* Dark theme adjustments */
[data-theme="dark"] .series-typeahead__dropdown {
  box-shadow: var(--shadow-4);
}

[data-theme="dark"] .series-typeahead__input:focus {
  box-shadow: 0 0 0 3px rgba(var(--brand-primary), 0.2);
}