/* long-select.css
   Enhanced select for options with long text.
   Closed state: one line, truncated, with the full text shown underneath.
   Open state: a capped-width popup where options wrap. */

.ls {
  --ls-border: #c9ced6;
  --ls-border-hover: #9aa3b0;
  --ls-accent: #1a73e8;
  --ls-active-bg: #e8f0fe;
  --ls-radius: 4px;
  --ls-min-height: 38px;
  position: relative;
  display: block;
  width: 100%;
}

/* The real <select> stays in the DOM (value, validation, form submit)
   but is invisible and not clickable. */
.ls__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Closed control ---------- */

.ls__button {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ls-min-height);
  padding: 6px 10px;
  font: inherit;
  color: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid var(--ls-border);
  border-radius: var(--ls-radius);
  cursor: pointer;
}

.ls__button:hover:not(:disabled) {
  border-color: var(--ls-border-hover);
}

.ls__button:focus-visible,
.ls__button[aria-expanded="true"] {
  outline: 2px solid var(--ls-accent);
  outline-offset: 0;
  border-color: var(--ls-accent);
}

.ls__button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f3f4f6;
}

.ls__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ls--placeholder .ls__label {
  color: #7a8290;
}

.ls__arrow {
  flex: none;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  opacity: 0.7;
  transition: transform 0.12s ease;
}

.ls__button[aria-expanded="true"] .ls__arrow {
  transform: rotate(180deg);
}

/* Full text of the current selection, only shown when the label is truncated */
.ls__full {
  margin-top: 4px;
  font-size: 0.85em;
  line-height: 1.35;
  color: #4b5563;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ls__full[hidden] {
  display: none;
}

.ls--invalid .ls__button {
  border-color: #c0392b;
}

/* ---------- Popup list ---------- */

.ls__list {
  position: fixed;
  z-index: 10000;
  box-sizing: border-box;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  line-height: 1.4;
  background: #fff;
  border: 1px solid var(--ls-border, #c9ced6);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.ls__option {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ls__option--active {
  background: var(--ls-active-bg, #e8f0fe);
}

.ls__option[aria-selected="true"] {
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ls-accent, #1a73e8);
}

.ls__option--placeholder {
  color: #7a8290;
}

.ls__option--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ls__group {
  padding: 8px 10px 4px;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}
