:host {
  --pds-select-background: var(--pine-color-background-container);
  --pds-select-border: var(--pine-border);
  --pds-select-border-radius: var(--pine-dimension-125);
  --pds-select-border-radius-start-end: var(--pine-dimension-125);
  --pds-select-border-radius-start-start: var(--pine-dimension-125);
  --pds-select-border-radius-end-end: var(--pine-dimension-125);
  --pds-select-border-radius-end-start: var(--pine-dimension-125);
  --pds-select-min-height: 36px;
  --box-shadow-focus: 0 0 0 1px var(--pine-color-background-container), 0 0 0 3px var(--pine-color-focus-ring);
  --box-shadow-focus-error: 0 0 0 1px var(--pine-color-background-container), 0 0 0 3px var(--pine-color-focus-ring-danger);
}
:host .hidden,
:host :host([hidden]) {
  display: none;
}

.pds-select {
  color: var(--pine-color-text);
  display: grid;
  flex-direction: column;
  grid-template-areas: "label label" "field field" "message message";
  grid-template-columns: 1fr minmax(2rem, min-content);
  grid-template-rows: min-content min-content min-content;
  position: relative;
  width: 100%;
}

.pds-select__label-wrapper {
  align-items: center;
  display: flex;
  grid-area: label;
  justify-content: space-between;
  margin-block-end: var(--pine-dimension-2xs);
}

.pds-select__action {
  align-items: center;
  display: flex;
  gap: var(--pine-dimension-xs);
  margin-inline-start: var(--pine-dimension-xs);
}

label {
  margin-block-end: var(--pine-dimension-2xs);
}

.pds-select__label-wrapper label {
  margin-block-end: 0;
}

select {
  appearance: none;
  background-color: var(--pds-select-background);
  border: var(--pds-select-border);
  border-end-end-radius: var(--pds-select-border-radius-end-end, var(--pds-select-border-radius));
  border-end-start-radius: var(--pds-select-border-radius-end-start, var(--pds-select-border-radius));
  border-start-end-radius: var(--pds-select-border-radius-start-end, var(--pds-select-border-radius));
  border-start-start-radius: var(--pds-select-border-radius-start-start, var(--pds-select-border-radius));
  color: var(--pine-color-text);
  font: var(--pine-typography-body);
  grid-area: field;
  letter-spacing: var(--pine-letter-spacing);
  min-height: var(--pds-select-min-height);
  padding: calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-150);
  padding-inline-end: var(--pine-dimension-450);
  position: relative;
}
select:hover {
  border-color: var(--pine-color-border-hover);
  cursor: pointer;
}
select:focus-visible {
  border-color: var(--pine-color-border-active);
  outline: var(--pine-outline-focus);
  outline-offset: var(--pine-border-width);
}
select:disabled {
  background-color: var(--pine-color-background-container-disabled);
  border-color: var(--pine-color-border-disabled);
  color: var(--pine-color-text-disabled);
  cursor: not-allowed;
}
select:has(~ .pds-select__message .pds-select__error-message) {
  background-color: var(--pine-select-color-background-danger);
  border-color: var(--pine-color-border-danger);
}
:host-context([data-theme=dark]) select:has(~ .pds-select__message .pds-select__error-message) {
  background-color: var(--pine-color-red-950);
}
select:has(~ .pds-select__message .pds-select__error-message):focus-visible {
  outline-color: var(--pine-color-focus-ring-danger);
}

:host(.is-disabled) .pds-select__select-icon {
  color: var(--pine-color-text-disabled);
}

:host(.is-invalid) select {
  background-color: var(--pine-select-color-background-danger);
  border-color: var(--pine-color-border-danger);
}
:host-context([data-theme=dark]) :host(.is-invalid) select {
  background-color: var(--pine-color-red-950);
}
:host(.is-invalid) select:focus-visible {
  outline-color: var(--pine-color-focus-ring-danger);
}

:host([highlight]:not(.is-disabled):not(.is-invalid)) select {
  background-color: var(--pine-color-accent-disabled);
  border-color: var(--pine-color-accent);
  color: var(--pine-color-text-accent);
}
:host([highlight]:not(.is-disabled):not(.is-invalid)) select:hover:not(:disabled) {
  border-color: var(--pine-color-accent-hover);
}
:host([highlight]:not(.is-disabled):not(.is-invalid)) select:focus-visible {
  outline-color: var(--pine-color-focus-ring);
}
:host([highlight]:not(.is-disabled):not(.is-invalid)) .pds-select__select-icon {
  color: var(--pine-color-text-accent);
}

.pds-select__error-message,
.pds-select__helper-message {
  color: var(--pine-color-text-message);
  font: var(--pine-typography-body-sm-medium);
  margin-block-end: 0;
  margin-block-start: var(--pine-dimension-2xs);
}

.pds-select__error-message {
  color: var(--pine-color-text-message-danger);
  display: flex;
  gap: var(--pine-dimension-2xs);
}
.pds-select__error-message pds-icon {
  margin-block-start: var(--pine-dimension-025);
}

.pds-select__message {
  grid-area: message;
}

.pds-select__select-icon {
  align-items: center;
  display: flex;
  grid-column: -1/-2;
  grid-row: 2/3;
  height: var(--pds-select-min-height);
  pointer-events: none;
  position: relative;
  z-index: var(--pine-z-index-raised);
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: polygon(0 0, 0 0, 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}