/* location_picker — always-visible search with inline results.
   Selected chips render above the search box. Brands can search, click to add,
   and remove chips individually without any modal-in-modal stacking. */

.location-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.location-picker__pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
}

.location-picker__pills:empty {
  display: none;
}

.location-picker__pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1-5) var(--space-2-5);
  background: var(--color-bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-tight);
  color: var(--color-text-default);
  white-space: nowrap;
}

.location-picker__pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-subtlest);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.location-picker__pill-remove:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-default);
}

.location-picker__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.location-picker__count {
  color: var(--color-text-subtle);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
}

.location-picker__clear-all {
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-subtle);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  cursor: pointer;
  text-decoration: underline;
  transition: color var(--duration-fast) var(--ease-out);
}

.location-picker__clear-all:hover {
  color: var(--color-text-error);
}

.location-picker__clear-all[hidden] {
  display: none;
}

.location-picker__search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.location-picker__search-icon {
  position: absolute;
  left: var(--space-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtlest);
  pointer-events: none;
}

.location-picker__search {
  width: 100%;
  padding: var(--space-2-5) var(--space-3) var(--space-2-5) var(--space-9);
  border: var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-snug);
  color: var(--color-text-default);
  background: var(--color-bg-primary);
  box-sizing: border-box;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.location-picker__search::placeholder {
  color: var(--color-text-placeholder);
}

.location-picker__search:focus {
  outline: none;
  border-color: var(--color-border-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-text-default) 6%, transparent);
}

.location-picker__results {
  display: none;
  flex-direction: column;
  gap: var(--space-0-5);
  max-height: 280px;
  overflow-y: auto;
  padding: var(--space-1);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
}

.location-picker__results.is-visible {
  display: flex;
}

.location-picker__results-empty {
  padding: var(--space-3-5) var(--space-3);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  color: var(--color-text-subtlest);
  margin: 0;
  text-align: center;
}

.location-picker__results-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2-5);
  padding: var(--space-4);
  color: var(--color-text-subtlest);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
}

.location-picker__results-loading-spinner {
  width: 16px;
  height: 16px;
  border: var(--border-width-2) solid var(--color-border-subtle);
  border-right-color: var(--color-text-subtlest);
  border-radius: var(--radius-full);
  animation: location-picker-spin var(--duration-700) var(--ease-linear) infinite;
  flex-shrink: 0;
}

@keyframes location-picker-spin {
  to { transform: rotate(360deg); }
}

.location-picker__result {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  width: 100%;
  padding: var(--space-2) var(--space-2-5);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  text-align: left;
  color: var(--color-text-default);
  cursor: pointer;
  transition: background var(--duration-instant) var(--ease-out);
}

.location-picker__result:hover,
.location-picker__result:focus-visible {
  background: var(--color-bg-secondary);
  outline: none;
}

.location-picker__result-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-bg-secondary);
  color: var(--color-text-subtle);
}

.location-picker__result-icon--country {
  background: color-mix(in srgb, var(--color-brand-purple-500) 12%, transparent);
  color: var(--color-brand-purple-500);
}

.location-picker__result-icon--region {
  background: var(--color-bg-info);
  color: var(--color-text-info);
}

.location-picker__result-icon--city {
  background: var(--color-bg-success);
  color: var(--color-text-success);
}

.location-picker__result-text {
  flex: 1;
  min-width: 0;
}

.location-picker__result-kind {
  flex-shrink: 0;
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-normal);
  color: var(--color-text-subtlest);
  text-transform: capitalize;
}
