/*
 * Reusable searchable location picker (country / airport).
 * Markup + classes mirror the feed's country picker so the UI matches 1:1.
 * Used on the ranking page; feed keeps its own copy in feed.css.
 */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--background);
  border: 1px solid var(--border);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s var(--ease);
}
.pill:hover { border-color: #D4D4D4; }
.pill.is-active {
  border-color: #bababa;
  font-weight: 600;
}

.country-picker { position: relative; display: inline-flex; }

/* The trigger reuses .pill styling. Override only what's needed for the dropdown. */
.country-trigger {
  font-family: var(--font-sans);
  transition: border-color 0.15s var(--ease);
}
.country-picker.is-open .country-trigger {
  border-color: #D4D4D4;
  box-shadow: none;
}
.country-trigger-flag { font-size: 15px; line-height: 1; }
.country-trigger-label {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.country-trigger-caret {
  font-size: 10px;
  color: inherit;
  opacity: 0.7;
  transition: transform 0.15s var(--ease);
}
.country-picker.is-open .country-trigger-caret { transform: rotate(180deg); }

.country-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 8px;
  z-index: 30;
}
.country-search-row {
  position: relative;
  margin-bottom: 6px;
}
.country-search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.country-search {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
}
.country-search:focus {
  outline: none;
  border-color: var(--unique);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--unique) 22%, transparent);
}

.country-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.country-option:hover { background: color-mix(in srgb, var(--unique) 8%, transparent); }
.country-option.is-selected {
  background: color-mix(in srgb, var(--unique) 12%, transparent);
  color: var(--unique);
  font-weight: 600;
}
.country-option-flag { font-size: 16px; line-height: 1; flex: 0 0 auto; }
.country-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-option[hidden] { display: none; }

.country-empty {
  padding: 14px 10px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .pill { border-color: var(--border); }
  .pill:hover,
  .pill.is-active { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
  .country-picker.is-open .country-trigger {
    border-color: color-mix(in srgb, var(--text) 30%, var(--border));
  }
}
