/* Dropdown native: nâng cấp bằng CSS khi trình duyệt hỗ trợ base-select. */

select:not([multiple]) {
  appearance: auto;
  -webkit-appearance: menulist;
  min-height: 46px;
  padding: 11px 36px 11px 14px;
  border: 1px solid #ccddd6;
  border-radius: 12px;
  background-color: #f6fbf8;
  color: #25483b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  transform: none;
  box-shadow: none;
}
select:not([multiple]):hover {
  border-color: #72ac96;
  background-color: #edf7f1;
}
select:not([multiple]):focus-visible {
  outline: 2px solid #31876d;
  outline-offset: 2px;
  box-shadow: none;
  transform: none;
}
select:not([multiple]):disabled {
  color: #657770;
  background-color: #f0f4f2;
  cursor: not-allowed;
}
@media (min-width: 761px) and (hover: hover) and (pointer: fine) {
 @supports (appearance: base-select) {
  select:not([multiple]),
  select:not([multiple])::picker(select) {
    appearance: base-select;
  }
  select:not([multiple]) {
    padding-right: 14px;
    gap: 12px;
  }
  select:not([multiple])::picker-icon {
    color: #31876d;
    transform: rotate(-90deg);
    transition: transform 200ms ease;
  }
  select:not([multiple]):open::picker-icon {
    transform: rotate(0);
  }
  select:not([multiple])::picker(select) {
    padding: 6px;
    margin-block: 6px;
    border: 1px solid #d8e8df;
    border-radius: 14px;
    background: #fff;
    color: #25483b;
    box-shadow: 0 10px 26px rgba(24, 67, 48, 0.12);
    max-block-size: min(340px, 60dvh);
    max-inline-size: calc(100vw - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 1;
    transform: none;
  }
  select:not([multiple]) option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #25483b;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  select:not([multiple]) option:hover,
  select:not([multiple]) option:focus {
    background: #eaf6ef;
    outline: none;
  }
  select:not([multiple]) option:checked {
    background: #dcefe3;
    color: #175c43;
    font-weight: 700;
  }
  select:not([multiple]) option::checkmark {
    color: #187452;
  }
  select:not([multiple]) option:disabled {
    color: #82958b;
    cursor: not-allowed;
  }
 }
}

.searchable-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  align-items: end;
}

.searchable-select > label {
  min-width: 0;
  margin-bottom: 0;
}

.import-packaging > .searchable-select {
  margin-bottom: 16px;
}

.select-search-toggle {
  min-width: 44px;
  min-height: 54px;
  padding: 8px 12px;
  border: 1px solid #ccddd6;
  border-radius: 10px;
  background: #edf7f1;
  color: #175c43;
  font-weight: 600;
}

.select-search-toggle[aria-expanded='true'] {
  background: #dcefe3;
}

.select-search-tools {
  grid-column: 1 / -1;
  min-width: 0;
  position: relative;
}

.searchable-select.is-searching > label {
  pointer-events: none;
}

.select-search-tools[hidden] {
  display: none;
}

.select-search-tools input {
  min-height: 44px;
  width: 100%;
  margin: 0;
  font-size: 16px;
  border-radius: 10px;
  box-shadow: none;
}

.select-search-status {
  display: block;
  min-height: 20px;
  margin-top: 4px;
  color: #536c63;
  font-size: 13px;
}
.toolbar .search-control {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  flex: 1;
  min-width: 0;
  max-width: 560px;
}
.toolbar .search-control > input {
  width: 100%;
  max-width: none;
}
.search-suggestions {
  position: absolute;
  inset: 100% 0 auto;
  z-index: 30;
  margin-top: 6px;
  padding: 4px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  border: 1px solid #d4e7df;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(24, 67, 48, 0.15);
}
.search-empty {
  padding: 10px 12px;
  margin: 0;
  color: #657770;
}
.search-suggestions[hidden] {
  display: none;
}
.search-suggestions button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: #25483b;
  font-size: 14px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.search-suggestions button:hover,
.search-suggestions button:focus-visible {
  background: #edf7f1;
}
.search-suggestions small {
  display: block;
  margin-top: 4px;
  color: #657770;
}

@media (max-width: 760px), (hover: none), (pointer: coarse) {
  select:not([multiple]),
  label.floating-field.fixed-caption > select:not([multiple]) {
    appearance: auto;
    -webkit-appearance: menulist;
    display: block;
    font-size: 16px;
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  select:not([multiple]),
  select:not([multiple])::picker-icon,
  select:not([multiple])::picker(select) {
    transition: none;
  }
}
