/*
 * EXP Select
 * Shared visual layer for the company, admin, and pharmacy portals.
 * This stylesheet intentionally inherits its host portal's typeface and does
 * not reset page-level controls or surrounding form layouts.
 */
.exp-select,
.exp-select-panel {
  --exp-select-navy: #285a55;
  --exp-select-cyan: #b4d5c7;
  --exp-select-ink: #243c3a;
  --exp-select-muted: #687d77;
  --exp-select-line: #dce8df;
  --exp-select-line-strong: #bdcec2;
  --exp-select-ice: #f2f7f1;
  --exp-select-cyan-wash: #e5f1e8;
  --exp-select-danger: #a9433b;
}

.exp-select {
  position: relative;
  display: inline-flex;
  flex: 1 1 auto;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  vertical-align: middle;
  color: var(--exp-select-ink);
  font: inherit;
  line-height: 1.35;
  isolation: isolate;
}

.exp-select,
.exp-select * {
  box-sizing: border-box;
}

/* Keep the original form control in the accessibility/form tree. */
.exp-select-native {
  position: absolute !important;
  inset-block-start: 0 !important;
  inset-inline-start: 0 !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
  border: 0 !important;
}

.exp-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: var(--exp-select-height, 36px);
  padding-block: 6px;
  padding-inline: 10px 9px;
  border: 1px solid var(--exp-select-line-strong);
  border-radius: 7px;
  background: #fbfcf7;
  color: var(--exp-select-ink);
  font: inherit;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 30 77 / 4%);
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.exp-select-trigger:hover {
  border-color: #9eb3cc;
  background-color: #fcfdff;
}

.exp-select-trigger:focus-visible {
  outline: 2px solid var(--exp-select-navy);
  outline-offset: 2px;
  border-color: #0784a6;
  box-shadow: 0 0 0 3px rgb(10 231 250 / 20%);
}

.exp-select-value {
  display: block;
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  color: inherit;
}

.exp-select-value:empty::before {
  content: attr(data-placeholder);
  color: var(--exp-select-muted);
}

.exp-select-chevron {
  display: inline-grid;
  flex: 0 0 16px;
  inline-size: 16px;
  block-size: 16px;
  place-items: center;
  margin-inline-start: auto;
  color: #536a85;
  pointer-events: none;
  transition: transform 150ms ease, color 150ms ease;
}

.exp-select-chevron svg {
  display: block;
  inline-size: 16px;
  block-size: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.exp-select-clear {
  position: absolute;
  inset-inline-end: 29px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  display: inline-grid;
  flex: 0 0 22px;
  inline-size: 24px;
  block-size: 24px;
  place-items: center;
  margin-inline-start: auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #687b94;
  cursor: pointer;
}

.exp-select:has(.exp-select-clear:not([hidden])) .exp-select-value {
  padding-inline-end: 26px;
}

.exp-select-clear:hover {
  background: var(--exp-select-ice);
  color: var(--exp-select-navy);
}

.exp-select-clear:focus-visible {
  outline: 2px solid #0784a6;
  outline-offset: 1px;
}

.exp-select-clear svg {
  inline-size: 14px;
  block-size: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.exp-select-clear[hidden],
.exp-select-panel[hidden] {
  display: none !important;
}

/* JS supplies the floating coordinates and sizing as inline styles. */
.exp-select-panel {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: var(--exp-select-z-index, 10000);
  display: flex;
  flex-direction: column;
  inline-size: max-content;
  min-inline-size: 0;
  max-inline-size: calc(100vw - 16px);
  max-block-size: min(340px, calc(100dvh - 16px));
  overflow: hidden;
  border: 1px solid #d5e0ec;
  border-radius: 9px;
  background: #fbfcf7;
  color: var(--exp-select-ink);
  box-shadow:
    0 12px 32px rgb(0 30 77 / 15%),
    0 2px 7px rgb(0 30 77 / 7%);
  direction: inherit;
  text-align: start;
  overscroll-behavior: contain;
  transform-origin: top center;
  animation: exp-select-panel-in 130ms cubic-bezier(.2, .7, .2, 1) both;
}

.exp-select-search {
  display: block;
  flex: 0 0 auto;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 38px;
  padding-block: 8px;
  padding-inline: 11px;
  border: 0;
  border-block-end: 1px solid #e7edf4;
  border-radius: 0;
  outline: 0;
  background: #f5f8f2;
  color: var(--exp-select-ink);
  font: inherit;
  text-align: start;
  direction: inherit;
}

.exp-select-search::placeholder {
  color: #7b899b;
  opacity: 1;
}

.exp-select-search:focus {
  box-shadow: inset 0 -2px 0 #0784a6;
}

.exp-select-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-block-size: 0;
  padding-block: 4px;
  padding-inline: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #b9c9dc transparent;
  scrollbar-width: thin;
}

.exp-select-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-block-start: 1px solid #e4ece4;
  background: #f7faf5;
  color: var(--exp-select-muted);
  font-size: .76em;
  line-height: 1.2;
}

.exp-select-footer-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-inline-size: 0;
  white-space: nowrap;
}

.exp-select-footer-count {
  color: var(--exp-select-ink);
  font-variant-numeric: tabular-nums;
}

.exp-select-spacer {
  flex: 0 0 auto;
  pointer-events: none;
}

.exp-select-option {
  display: flex;
  align-items: center;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 34px;
  padding-block: 7px;
  padding-inline: 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #263951;
  font: inherit;
  line-height: 1.4;
  text-align: start;
  overflow-wrap: anywhere;
  white-space: normal;
  cursor: pointer;
}

.exp-select-option:hover,
.exp-select-option[data-active="true"] {
  background: #f0f7fc;
  color: var(--exp-select-navy);
}

.exp-select-option[aria-selected="true"] {
  background: var(--exp-select-cyan-wash);
  color: var(--exp-select-navy);
  font-weight: 600;
}

.exp-select-option[aria-selected="true"]::after {
  content: "";
  flex: 0 0 7px;
  inline-size: 7px;
  block-size: 7px;
  margin-inline-start: auto;
  border-radius: 50%;
  background: #0784a6;
}

.exp-select-option[data-active="true"][aria-selected="true"] {
  background: #d9f8fb;
}

.exp-select-option[aria-disabled="true"] {
  color: #98a5b4;
  cursor: not-allowed;
  opacity: .72;
}

.exp-select-option[aria-disabled="true"]:hover,
.exp-select-option[aria-disabled="true"][data-active="true"] {
  background: transparent;
  color: #98a5b4;
}

.exp-select-group {
  padding-block: 8px 4px;
  padding-inline: 9px;
  color: var(--exp-select-muted);
  font-size: .84em;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.exp-select-group:not(:first-child) {
  margin-block-start: 3px;
  border-block-start: 1px solid #edf1f6;
}

.exp-select-empty {
  padding-block: 13px;
  padding-inline: 10px;
  color: var(--exp-select-muted);
  font-size: .92em;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
}

.exp-select.is-open {
  z-index: var(--exp-select-z-index, 1000);
}

.exp-select.is-open .exp-select-trigger {
  border-color: #0784a6;
  box-shadow: 0 0 0 3px rgb(10 231 250 / 17%);
}

.exp-select.is-open .exp-select-chevron {
  color: #0784a6;
  transform: rotate(180deg);
}

.exp-select.is-disabled .exp-select-trigger,
.exp-select-trigger:disabled {
  border-color: #e1e7ee;
  background: #f3f6f9;
  color: #8794a4;
  box-shadow: none;
  cursor: not-allowed;
}

.exp-select.is-disabled .exp-select-chevron {
  color: #a2adba;
}

.exp-select.is-invalid .exp-select-trigger,
.exp-select[aria-invalid="true"] .exp-select-trigger {
  border-color: var(--exp-select-danger);
}

.exp-select.is-invalid .exp-select-trigger:focus-visible,
.exp-select[aria-invalid="true"] .exp-select-trigger:focus-visible {
  outline-color: var(--exp-select-danger);
  border-color: var(--exp-select-danger);
  box-shadow: 0 0 0 3px rgb(180 35 24 / 12%);
}

.exp-select.is-multiple .exp-select-value {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Keep panel content and option alignment correct in either writing direction. */
.exp-select:dir(rtl),
.exp-select-panel:dir(rtl),
.exp-select-search:dir(rtl),
.exp-select-option:dir(rtl) {
  direction: rtl;
}

@keyframes exp-select-panel-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 480px) {
  .exp-select-panel {
    min-inline-size: min(150px, calc(100vw - 16px));
    max-inline-size: calc(100vw - 16px);
    max-block-size: min(300px, calc(100dvh - 16px));
    border-radius: 8px;
  }

  .exp-select-option {
    min-block-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .exp-select-trigger,
  .exp-select-chevron {
    transition: none;
  }

  .exp-select-panel {
    animation: none;
  }
}

@media print {
  .exp-select {
    display: inline-flex !important;
    inline-size: auto !important;
    max-inline-size: 100% !important;
  }

  .exp-select .exp-select-trigger,
  .exp-select .exp-select-clear,
  .exp-select-panel {
    display: none !important;
  }

  .exp-select .exp-select-native {
    position: static !important;
    display: inline-block !important;
    inline-size: auto !important;
    block-size: auto !important;
    max-inline-size: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    appearance: auto !important;
    border: revert !important;
    background: transparent !important;
    color: inherit !important;
  }
}
