/* Custom dropdown (.lf-select) — visual layer for public/js/lidfly-ui-select.js.
   The native <select> is hidden; a styled trigger + role=listbox panel is drawn
   on top. Tokens only (font, colors, radii, shadows) so it inherits the theme.
   See docs/DESIGN-SYSTEM.md and the rule in AGENTS.md. */

.lf-select-native {
  display: none !important;
}

.lf-select {
  position: relative;
  width: 100%;
  max-width: 100%;
  font-family: var(--font-sans);
}

.lf-select--inline {
  width: auto;
  min-width: 220px;
  max-width: 100%;
}

.lf-select__trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-element);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lf-select__trigger:hover:not([disabled]),
.lf-select.open .lf-select__trigger {
  border-color: color-mix(in srgb, var(--color-brand-text) 34%, var(--color-border));
}

.lf-select__trigger:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-brand-text) 35%, transparent);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px var(--color-brand-text);
}

.lf-select__trigger[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.lf-select__trigger.is-placeholder .lf-select__value {
  color: var(--color-text-muted);
}

.lf-select__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lf-select__chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

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

.lf-select__panel {
  position: absolute;
  z-index: 120;
  top: calc(100% + 6px);
  left: 0;
  display: none;
  min-width: 100%;
  width: max-content;
  max-width: min(560px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-element);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-card);
}

.lf-select.open .lf-select__panel {
  display: block;
}

.lf-select__search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
}

.lf-select__search {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-md);
}

.lf-select__search:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-brand-text) 30%, transparent);
  outline-offset: 1px;
  border-color: var(--color-brand-text);
}

.lf-select__options {
  max-height: min(320px, 56vh);
  overflow-y: auto;
  padding: 6px;
}

.lf-select__options:focus-visible {
  outline: none;
}

.lf-select__option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: 1.35;
  cursor: pointer;
}

.lf-select__option.is-active,
.lf-select__option:hover {
  background: color-mix(in srgb, var(--color-brand) 12%, transparent);
  color: var(--color-brand-text);
}

.lf-select__option.is-selected {
  font-weight: 650;
}

.lf-select__option.is-disabled {
  color: var(--color-text-muted);
  cursor: default;
  opacity: 0.6;
}

.lf-select__option.is-disabled:hover {
  background: transparent;
  color: var(--color-text-muted);
}

.lf-select__option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lf-select__check {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--color-brand-text);
  opacity: 0;
}

.lf-select__check svg {
  width: 18px;
  height: 18px;
}

.lf-select__option.is-selected .lf-select__check {
  opacity: 1;
}

.lf-select__empty {
  padding: 18px 12px;
  color: var(--color-text-muted);
  font-size: var(--text-md);
  text-align: center;
}

@media (max-width: 640px) {
  .lf-select__panel {
    max-width: calc(100vw - 24px);
  }

  .lf-select--inline {
    width: 100%;
  }
}
