/**
 * KoreAves — Shared TaxonCombobox Styles
 * Single owner for the live TaxonCombobox component.
 */

.ka-combobox-status {
  padding: 6px 14px;
  border-top: 1px solid var(--ka-color-rule-hairline);
  background: var(--ka-color-paper-sunken);
  color: var(--ka-color-ink-quiet);
  font-family: var(--ka-font-hangul-sans);
  font-size: 11.5px;
}

.ka-combobox-instruction,
.ka-combobox-empty {
  padding: 12px 14px;
  background: var(--ka-color-paper-base);
  color: var(--ka-color-ink-quiet);
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.4;
}

/* ==========================================================================
   Canonical Unified TaxonCombobox Styles (Human UX Remediation Round 2)
   ========================================================================== */

.ka-combobox-root {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

/* Current public markup keeps the input and clear control inside this wrapper.
   It must fill the combobox root; otherwise its intrinsic input width (~220px)
   wins inside the flex root and the visible search field collapses to roughly
   half of the toolbar/search-card width. It is also the positioning context
   for the search icon and clear button. */
.ka-combobox-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ka-combobox-search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--ka-color-ink-quiet, #616b64);
  pointer-events: none;
  z-index: 2;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ka-combobox-root .ka-combobox-input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 34px;
  background-color: #ffffff;
  border: 1px solid #cfcac0;
  border-radius: 6px;
  color: var(--ka-color-ink-primary, #181c19);
  font-family: var(--ka-font-hangul-sans, system-ui, sans-serif);
  font-size: 13.5px;
  line-height: 1.4;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* The component inserts one semantic SVG search icon. The old background
     icon belongs to pre-component inputs and would otherwise double-render. */
  background-image: none;
}

.ka-combobox-root .ka-combobox-input:focus {
  outline: none;
  border-color: #205c42;
  box-shadow: 0 0 0 2px rgba(32, 92, 66, 0.18);
}

.ka-combobox-root .ka-combobox-input::placeholder {
  color: #859189;
}

/* Clear button: strictly hidden when idle; shown ONLY on focus-within + query */
.ka-combobox-root .ka-combobox-clear-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 44px;
  height: 42px;
  min-width: 44px;
  min-height: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--ka-color-ink-quiet, #616b64);
  cursor: pointer;
  padding: 0;
  z-index: 3;
  border-radius: 4px;
  transition: color 0.12s ease;
}

.ka-combobox-root .ka-combobox-clear-btn:hover {
  color: var(--ka-color-ink-primary, #181c19);
}

.ka-combobox-root .ka-combobox-clear-btn:focus-visible {
  outline: 2px solid #205c42;
  outline-offset: -2px;
}

.ka-combobox-root .ka-combobox-clear-btn.is-visible {
  display: inline-flex;
}

/* Listbox dropdown */
.ka-combobox-root .ka-combobox-listbox {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--ka-color-paper-base, #fbfbfa);
  border: 1px solid #cfcac0;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(28, 28, 26, 0.08);
  max-height: 280px;
  overflow-y: auto;
  box-sizing: border-box;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.ka-combobox-root .ka-combobox-listbox.popup-flipped-above {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -6px 16px rgba(28, 28, 26, 0.08);
}

/* Unified result anatomy. Older rules styled a different legacy option class,
   leaving the current `ka-combobox-item` rows cramped and visually ungrouped. */
.ka-combobox-root .ka-combobox-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 11px 14px;
  list-style: none;
  cursor: pointer;
  border-bottom: 1px solid var(--ka-color-rule-hairline, #e2ded5);
  background: var(--ka-color-paper-base, #fbfbfa);
}

.ka-combobox-root .ka-combobox-item:hover,
.ka-combobox-root .ka-combobox-item.is-active,
.ka-combobox-root .ka-combobox-item.is-selected {
  background: var(--ka-color-paper-sunken, #edebe4);
}

.ka-option-availability {
  margin-left: auto;
  flex: 0 0 auto;
  border: 1px solid var(--ka-color-rule-subtle, #cfcac0);
  border-radius: 999px;
  padding: 2px 6px;
  font-family: var(--ka-font-mono, monospace);
  font-size: 9px;
  line-height: 1.25;
  color: var(--ka-color-ink-secondary, #3b433d);
  background: var(--ka-color-paper-surface, #fff);
}

.ka-option-availability--limited,
.ka-option-availability--checklist {
  color: var(--ka-color-ink-quiet, #616b64);
  background: var(--ka-color-paper-sunken, #edebe4);
}

@media (max-width: 520px) {
  .ka-combobox-root .ka-combobox-item {
    padding: 6px 10px;
  }
}

@media (max-width: 768px) {
  .ka-combobox-root .ka-combobox-input {
    height: 44px;
    font-size: 13px;
  }
  .ka-combobox-root .ka-combobox-clear-btn {
    height: 44px;
  }
}
