.dropdown {
  position: relative;
  width: 100%;
}

.trigger {
  width: 100%;
  background: var(--vscode-input-background);
  color: var(--vscode-input-foreground);
  border: 1px solid var(--vscode-input-border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--vscode-font-family);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: all 0.2s ease;
  outline: none;
}

.trigger:hover {
  background: var(--vscode-input-background);
  border-color: var(--vscode-inputOption-hoverBackground);
}

.trigger:focus,
.trigger.open {
  border-color: var(--vscode-focusBorder);
  box-shadow: 0 0 0 1px var(--vscode-focusBorder);
}

.trigger.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.trigger:not(.disabled):not([disabled]) .value:empty::before {
  content: attr(data-placeholder);
  color: var(--vscode-input-placeholderForeground);
}

.chevron {
  flex-shrink: 0;
  color: var(--vscode-foreground);
  transition: transform 0.2s ease;
  opacity: 0.8;
}

.chevron.rotated {
  transform: rotate(180deg);
}

.menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--vscode-dropdown-background);
  border: 1px solid var(--vscode-dropdown-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 2px;
  max-height: 200px;
  overflow-y: auto;
  animation: fadeInDown 0.15s ease-out;
}

.option {
  width: 100%;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--vscode-font-family);
  color: var(--vscode-dropdown-foreground);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background-color 0.1s ease;
  outline: none;
}

.option:hover {
  background: var(--vscode-list-hoverBackground);
}

.option:focus {
  background: var(--vscode-list-focusBackground);
  outline: 1px solid var(--vscode-focusBorder);
  outline-offset: -1px;
}

.option.selected {
  background: var(--vscode-list-activeSelectionBackground);
  color: var(--vscode-list-activeSelectionForeground);
}

.option.selected:hover {
  background: var(--vscode-list-activeSelectionBackground);
}

.checkmark {
  flex-shrink: 0;
  color: var(--vscode-list-activeSelectionIconForeground, currentColor);
  opacity: 0.9;
}

.disabled {
  pointer-events: none;
}

.dropdownError .trigger {
  border-color: var(--vscode-inputValidation-errorBorder) !important;
}

.dropdownError .trigger:focus,
.dropdownError .trigger.open {
  border-color: var(--vscode-inputValidation-errorBorder) !important;
  box-shadow: 0 0 0 1px var(--vscode-inputValidation-errorBorder) !important;
}

/* Custom scrollbar for the dropdown menu */
.menu::-webkit-scrollbar {
  width: 8px;
}

.menu::-webkit-scrollbar-track {
  background: var(--vscode-scrollbarSlider-background);
}

.menu::-webkit-scrollbar-thumb {
  background: var(--vscode-scrollbarSlider-background);
  border-radius: 4px;
}

.menu::-webkit-scrollbar-thumb:hover {
  background: var(--vscode-scrollbarSlider-hoverBackground);
}

.menu::-webkit-scrollbar-thumb:active {
  background: var(--vscode-scrollbarSlider-activeBackground);
}

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

/* Focus styles for accessibility */
.dropdown:focus-within .trigger {
  border-color: var(--vscode-focusBorder);
  box-shadow: 0 0 0 1px var(--vscode-focusBorder);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .trigger {
    border-width: 2px;
  }

  .menu {
    border-width: 2px;
  }

  .option.selected {
    outline: 2px solid var(--vscode-contrastActiveBorder);
    outline-offset: -2px;
  }
}
