/* ==========================================================================
   Nice select

   Progressive enhancement over any <select>. The native element stays in the
   DOM and stays the source of truth for form submission - this only replaces
   what the user sees and clicks.

   One look for every dropdown on the site: the deal room's teal and easing,
   a 12px radius, and the same shallow elevation as the profile cards. Written
   with literal brand values rather than the --dr-* custom properties, because
   these appear on the publish page and inside the edit modal too, neither of
   which sits under .dr-page.

   Options carrying data-icon get a Material Symbol chip. Category dropdowns
   use it - ten sectors read as ten shapes far faster than as ten strings - and
   dropdowns without icons render compact instead, so a currency list does not
   grow a column of empty squares.
   ========================================================================== */

.nsel {
  position: relative;
  width: 100%;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* The native control is kept for form submission and for anything already
   listening to its change event. Hidden this way rather than display:none so
   browser validation can still focus it if it is ever made required. */
.nsel-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.nsel-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid rgba(14, 20, 23, 0.16);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: #123240;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.nsel-trigger:hover {
  border-color: rgba(2, 98, 130, 0.42);
}

.nsel-trigger:focus-visible,
.nsel.is-open .nsel-trigger {
  outline: none;
  border-color: #026282;
  box-shadow: 0 0 0 3px rgba(2, 98, 130, 0.14);
}

.nsel-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #e6f1f4;
  color: #026282;
}

.nsel-icon .material-symbols-outlined {
  font-size: 17px;
  line-height: 1;
}

/* No selection yet - the chip stays but goes neutral, so the control does not
   jump in height the moment something is picked. */
.nsel.is-empty .nsel-icon {
  background: #f1f4f5;
  color: #a3adb2;
}

.nsel.is-empty .nsel-value {
  color: #8a959b;
}

.nsel-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.nsel-chevron {
  flex-shrink: 0;
  color: #8a959b;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.nsel.is-open .nsel-chevron {
  transform: rotate(180deg);
}

/* ---- panel ---- */

.nsel-panel {
  position: absolute;
  z-index: 60;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  flex-direction: column;
  max-height: 320px;
  background: #fff;
  border: 1px solid rgba(14, 20, 23, 0.12);
  border-radius: 14px;
  box-shadow:
    0 2px 6px rgba(14, 20, 23, 0.05),
    0 20px 40px -22px rgba(14, 20, 23, 0.45);
  overflow: hidden;
}

.nsel.is-open .nsel-panel {
  display: flex;
  animation: nsel-in 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes nsel-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nsel.is-open .nsel-panel {
    animation: none;
  }

  .nsel-chevron {
    transition: none;
  }
}

/* Flipped above the trigger when there is no room below - the edit modal is a
   scroll container, so a panel that always opened downward would be cut off
   for the fields near its bottom. */
.nsel.is-flipped .nsel-panel {
  top: auto;
  bottom: calc(100% + 6px);
}

.nsel-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-bottom: 1px solid rgba(14, 20, 23, 0.08);
  color: #8a959b;
  flex-shrink: 0;
}

.nsel-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  color: #123240;
}

.nsel-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nsel-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: #123240;
  cursor: pointer;
}

/* Without icons the rows tighten up - a currency list should not be as tall
   as a category list. */
.nsel-plain .nsel-option {
  padding: 8px 10px;
}

.nsel-option .nsel-icon {
  width: 26px;
  height: 26px;
}

.nsel-option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hover and keyboard focus share one highlight, so arrowing through the list
   and moving the mouse never show two different "current" rows. */
.nsel-option.is-active {
  background: #f2f7f9;
}

.nsel-option.is-selected {
  color: #026282;
  font-weight: 600;
}

.nsel-check {
  flex-shrink: 0;
  color: #026282;
  opacity: 0;
}

.nsel-option.is-selected .nsel-check {
  opacity: 1;
}

.nsel-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: #8a959b;
}

@media (max-width: 480px) {
  .nsel-panel {
    max-height: 260px;
  }
}