/* ── Skill chip/tag input (Career Analysis redesign, Task 08) ────────────────────────────────── */

.skill-chip-input {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skill-chip-input__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/*
 * Solid fill, not a tinted-light background — verified by contrast-ratio calculation
 * (Task 11 accessibility pass): the previously-used `--color-primary-light` tint under
 * `--color-primary` text computed to ~4.23:1 in light mode and ~3.95:1 in dark mode, both below
 * the 4.5:1 AA minimum for normal-size text. `--color-primary-active` (the design system's most
 * saturated brand variant) is dark enough in light mode and light enough in dark mode to pair with
 * `--color-primary-contrast` at ≥4.5:1 in BOTH themes — confirmed 6.4:1 (light) / 4.7:1 (dark).
 * Don't revert to a tinted-light chip without re-running the same check independently per theme.
 */
.skill-chip-input__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 36px;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  background: var(--color-primary-active, #4B3FF0);
  color: var(--color-primary-contrast, #ffffff);
  border-radius: var(--radius-full, 9999px);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  line-height: 1.2;
  max-width: 100%;
}

.skill-chip-input__chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.skill-chip-input__chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

/* Extend the tappable hit area to 44x44 without visually enlarging the chip (no-precision-required) */
.skill-chip-input__chip-remove::before {
  content: '';
  position: absolute;
  inset: -8px;
}

.skill-chip-input__chip-remove {
  position: relative;
}

.skill-chip-input__chip-remove:hover,
.skill-chip-input__chip-remove:focus-visible {
  /* Semi-transparent white overlay — works against the solid chip fill in either theme, unlike a
     hardcoded brand-blue rgba that assumed a light tinted background. */
  background-color: rgba(255, 255, 255, 0.22);
  outline: none;
}

.skill-chip-input__chip-remove:focus-visible {
  outline: 2px solid var(--color-primary-contrast, #ffffff);
  outline-offset: 1px;
}

.skill-chip-input__combo {
  position: relative;
}

.skill-chip-input__entry {
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-border, #D1D5DB);
  border-radius: var(--radius-md, 0.375rem);
  font-size: var(--font-size-base, 1rem);
  color: var(--color-text-primary, #111827);
  background: var(--color-surface, #fff);
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.skill-chip-input__entry:focus {
  outline: 2px solid var(--color-primary, #2563EB);
  outline-offset: 1px;
  border-color: var(--color-primary, #2563EB);
}

.skill-chip-input__listbox {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #D1D5DB);
  border-radius: var(--radius-md, 0.375rem);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-width: 100vw;
}

.skill-chip-input__listbox[hidden] {
  display: none;
}

.skill-chip-input__option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  cursor: pointer;
  font-size: var(--font-size-base, 1rem);
  color: var(--color-text-primary, #111827);
  box-sizing: border-box;
}

.skill-chip-input__option:hover,
.skill-chip-input__option.is-active {
  background-color: var(--color-primary-light, #EFF6FF);
  color: var(--color-primary, #2563EB);
}

.skill-chip-input__option-category {
  flex-shrink: 0;
  font-size: var(--font-size-sm, 0.8125rem);
  color: var(--color-text-muted, #6B7280);
}

.skill-chip-input__option--static {
  cursor: default;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
}

.skill-chip-input__option--static:hover {
  background: none;
  color: var(--color-text-muted, #6B7280);
}

.skill-chip-input__cap-message {
  margin: 0;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-warning, #B45309);
}

@media (prefers-reduced-motion: reduce) {
  .skill-chip-input__chip-remove,
  .skill-chip-input__entry {
    transition: none;
  }
}

@media (max-width: 480px) {
  .skill-chip-input__chip-label {
    max-width: 140px;
  }
}
