.select {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  font: inherit;
}

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

.select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: var(--text-base);
  line-height: 1.2;
  color: var(--color-text);
  text-align: left;
  min-block-size: var(--control-h);
  padding: 0 var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

@media (hover: hover) {
  .select__trigger:hover {
    border-color: var(--color-border-strong);
  }
}

.select__trigger:focus-visible {
  border-color: var(--color-accent);
}

.select__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select__chevron {
  flex: 0 0 auto;
  width: var(--icon-sm);
  height: var(--icon-sm);
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23999999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: transform 0.12s ease;
}

.select--open .select__chevron {
  transform: rotate(180deg);
}

.select--disabled .select__trigger,
.select__trigger:disabled {
  background-color: var(--color-surface-alt);
  color: var(--color-text-subtle);
  cursor: not-allowed;
}

.select__list {
  position: fixed;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 280px;
  overflow-y: auto;
}

.select--nav .select__list {
  max-height: 70dvh;
}

.select__option {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-xs);
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--color-text);
  cursor: pointer;
  white-space: normal;
}

@media (hover: hover) {
  .select__option:not(.select__option--active):hover {
    background-color: var(--color-surface-alt);
  }
}

.select__option--active {
  background-color: var(--color-accent-soft);
}

.select__option[aria-selected="true"] {
  background-color: var(--color-accent-soft);
  font-weight: var(--weight-semibold);
}

.select--small .select__trigger {
  min-block-size: var(--control-h-sm);
  font-size: var(--text-sm);
  padding: 0 var(--space-2);
}

@media (max-width: 768px) {
  .select__trigger {
    min-block-size: var(--control-h-touch);
  }

  .select--small .select__trigger {
    min-block-size: var(--control-h-touch-sm);
  }
}

.select--nav .select__trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.select--nav.select--open .select__trigger {
  border-color: var(--color-accent);
}

@media (hover: hover) {
  .select--nav .select__trigger:hover {
    border-color: var(--color-accent);
  }
}

.select--nav .select__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold, 700);
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  margin-block-end: var(--space-hair);
}

.select--nav .select__chevron {
  width: var(--icon-md);
  height: var(--icon-md);
}

.select--nav .select__list {
  width: clamp(260px, 100%, 340px);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
}

.select--nav .select__option {
  border-radius: var(--radius-xs);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.select--nav .select__option[aria-selected="true"] {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
}
