/* Shared by the Astro, React and Vanilla Select variants. */

.exo-select {
  position: relative;
  display: inline-flex;
  min-width: 0;
  color: var(--exo-color-text, #333333);
}

.exo-select--full {
  display: flex;
  width: 100%;
}

.exo-select__control {
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--exo-font-family-sans, system-ui, sans-serif);
  line-height: var(--exo-font-line-height-snug, 1.25);
  color: inherit;
  background: var(--exo-color-bg, #ffffff);
  border: var(--exo-border-width-1, 1px) solid var(--exo-color-border-strong, #cccccc);
  border-radius: var(--exo-radius-3, 6px);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* Sizes: the same heights as Button's, with room on the right for the caret. */
.exo-select--md .exo-select__control {
  padding: var(--exo-space-2, 6px) calc(var(--exo-space-3, 8px) + 15px + var(--exo-space-2, 6px)) var(--exo-space-2, 6px)
    var(--exo-space-3, 8px);
  font-size: var(--exo-font-size-sm, 14px);
}

.exo-select--sm .exo-select__control {
  padding: var(--exo-space-1, 4px) calc(var(--exo-space-2, 6px) + 15px + var(--exo-space-1, 4px)) var(--exo-space-1, 4px)
    var(--exo-space-2, 6px);
  font-size: var(--exo-font-size-xs, 12px);
}

/* The caret: Radix's chevron-down, drawn in the text color. */
.exo-select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--exo-space-3, 8px);
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15'%3E%3Cpath d='M3.135 6.158a.5.5 0 0 1 .707-.023L7.5 9.565l3.658-3.43a.5.5 0 0 1 .684.73l-4 3.75a.5.5 0 0 1-.684 0l-4-3.75a.5.5 0 0 1-.023-.707Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15'%3E%3Cpath d='M3.135 6.158a.5.5 0 0 1 .707-.023L7.5 9.565l3.658-3.43a.5.5 0 0 1 .684.73l-4 3.75a.5.5 0 0 1-.684 0l-4-3.75a.5.5 0 0 1-.023-.707Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  pointer-events: none;
}

.exo-select--sm::after {
  right: var(--exo-space-2, 6px);
}

/* States */
.exo-select__control:hover:not(:disabled, :focus-visible, [aria-invalid="true"]) {
  border-color: var(--exo-color-text-muted, #666666);
}

.exo-select__control:focus-visible {
  outline: var(--exo-border-width-2, 2px) solid var(--exo-color-accent, #2f5fdb);
  outline-offset: var(--exo-border-width-2, 2px);
}

.exo-select__control[aria-invalid="true"] {
  border-color: var(--exo-color-danger, #b3261e);
}

.exo-select:has(> .exo-select__control:disabled) {
  opacity: 0.5;
}

.exo-select__control:disabled {
  cursor: not-allowed;
}
