@use './_theme';

.dropdown-field {
  align-items: center;
  column-gap: 15px;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  position: relative;
}

.dropdown-field-label {
  color: var(--text-color-ultra-dark);
  font-size: var(--text-size-label);
}

.dropdown-field-required .dropdown-field-label::after {
  color: var(--color-error);
  content: '*';
}

.dropdown-field-select {
  border: 1px solid var(--color-line);
  border-radius: var(--form-input-border-radius);
  color: var(--text-color-dark);
  font-size: var(--text-size-regular);
  height: 40px;
  padding: 0 15px;
  background-color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  @media (max-width: theme.$sm) {
    margin-top: 10px;
  }
}

.dropdown-field-invalid .dropdown-field-select {
  border-color: var(--color-error);
}

.dropdown-field-popover {
  position: absolute;
  pointer-events: auto;
  background-color: white;
  border: 1px solid var(--color-line);
  border-radius: var(--form-input-border-radius);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 3;
  width: var(--trigger-width);
}

.dropdown-field-option {
  color: var(--text-color-dark);
  cursor: pointer;
  font-size: var(--text-size-regular);
  padding: 12px 15px;
  &[data-focused] {
    background-color: var(--color-line);
  }
  &:hover,
  &:focus,
  &:focus-visible,
  &:focus-visible {
    outline-offset: -2px;
  }
}

.dropdown-field-error {
  color: var(--color-error);
  font-size: var(--text-size-fineprint);
  grid-column: 2;
  margin: 6px 0 0;
}

.dropdown-field-listbox {
  max-height: 300px;
}

