/* Shared multi-location picker: post composer, search and Space settings. Same
   look as the composer's Post to panel (see posts-composer-overlays.css). */
.audience-location-picker {
  --loc-surface: #fff;
  --loc-ink: #0f172a;
  --loc-soft: #536471;
  --loc-muted: #64748b;
  --loc-line: #e5e7eb;
  --loc-track: #f6f7fb;
  --loc-hover: rgba(15, 23, 42, .05);
  --loc-blue: #1da1f2;
  --loc-blue-hover: #168ad3;
  --loc-blue-edge: #0f6fa8;
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--loc-ink);
  font-size: 15px;
  line-height: 22px;
  -webkit-tap-highlight-color: transparent;
}

.audience-location-picker[hidden],
.audience-location-picker [hidden] {
  display: none;
}

/* The shared locations dialog owns this scroll-lock state. */
body.locations-picker-open {
  overflow: hidden;
}

@keyframes audience-location-picker-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.audience-location-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}

.audience-location-picker__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  /* A steady height, so the window does not jump as the list changes. */
  height: min(600px, calc(100dvh - 48px));
  overflow: hidden;
  border-radius: 16px;
  background: var(--loc-surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
  animation: audience-location-picker-in .14s ease-out;
}

.audience-location-picker__panel > :not(.audience-location-picker__options) {
  flex-shrink: 0;
}

.audience-location-picker__icon {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audience-location-picker__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
}

.audience-location-picker__header h2 {
  margin: 0;
  color: var(--loc-ink);
  font-size: 17px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: 0;
}

.audience-location-picker__header p {
  margin: 2px 0 0;
  color: var(--loc-soft);
  font-size: 13px;
  line-height: 18px;
}

.audience-location-picker__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -8px -12px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--loc-ink);
  cursor: pointer;
}

.audience-location-picker__search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  margin: 0 20px 10px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--loc-track);
  color: var(--loc-muted);
}

.audience-location-picker__search:focus-within {
  box-shadow: inset 0 0 0 1px var(--loc-line);
}

.audience-location-picker__search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--loc-ink);
  font: inherit;
  font-size: 16px;
  box-shadow: none;
  appearance: none;
}

.audience-location-picker__search input::placeholder {
  color: var(--loc-muted);
  opacity: 1;
}

.audience-location-picker__breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 20px 6px;
  color: var(--loc-soft);
  font-size: 13px;
  line-height: 18px;
}

.audience-location-picker__breadcrumb button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--loc-blue);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.audience-location-picker__breadcrumb .audience-location-picker__icon {
  width: 16px;
  height: 16px;
}

.audience-location-picker__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 100px;
  overflow-y: auto;
  padding: 0 20px 10px;
}

.audience-location-picker__tag {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--loc-ink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.audience-location-picker__coverage {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 20px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--loc-track);
  font-size: 14px;
  line-height: 20px;
}

.audience-location-picker__coverage p {
  margin: 2px 0 0;
  color: var(--loc-soft);
  font-size: 13px;
  line-height: 18px;
}

.audience-location-picker__coverage button {
  flex-shrink: 0;
  max-width: 45%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--loc-blue);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.audience-location-picker__status {
  margin: 0;
  padding: 0 20px 8px;
  color: var(--loc-soft);
  font-size: 13px;
  line-height: 18px;
}

.audience-location-picker__status:empty,
.audience-location-picker__tags:empty {
  display: none;
}

.audience-location-picker__browse-label {
  margin: 0;
  padding: 2px 20px 4px;
  color: var(--loc-soft);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

.audience-location-picker__options {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 12px 8px;
}

.audience-location-picker__option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
}

.audience-location-picker__option:active {
  background: var(--loc-track);
}

.audience-location-picker__option.is-covered {
  cursor: default;
}

.audience-location-picker__option.is-covered input {
  opacity: .5;
}

.audience-location-picker__option input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--loc-blue);
  pointer-events: none;
}

.audience-location-picker__option-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.audience-location-picker__option-copy strong {
  color: var(--loc-ink);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.audience-location-picker__option-copy span {
  display: block;
  color: var(--loc-soft);
  font-size: 13px;
  line-height: 18px;
}

.audience-location-picker__option-copy span::first-letter {
  text-transform: uppercase;
}

.audience-location-picker__flag {
  flex: none;
  width: 25px;
  height: 18px;
  border-radius: 2px;
  object-fit: cover;
}

.audience-location-picker__browse {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--loc-muted);
  cursor: pointer;
}

.audience-location-picker__empty {
  margin: 0;
  padding: 24px 0;
  color: var(--loc-soft);
  font-size: 13px;
  text-align: center;
}

.audience-location-picker__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--loc-line);
}

.audience-location-picker__button {
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--loc-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.audience-location-picker__button--primary {
  border-color: var(--loc-blue-edge);
  background: var(--loc-blue);
  color: #fff;
  font-weight: 700;
}

.audience-location-picker__button:disabled {
  border-color: var(--loc-line);
  background: var(--loc-line);
  color: var(--loc-muted);
  cursor: default;
}

.audience-location-picker__option:focus-visible,
.audience-location-picker button:focus-visible {
  outline: 2px solid var(--loc-blue);
  outline-offset: 2px;
}

.audience-location-picker__option:focus-visible {
  outline-offset: -2px;
}

@media (hover: hover) {
  .audience-location-picker__option:hover {
    background: var(--loc-track);
  }

  .audience-location-picker__option.is-covered:hover {
    background: none;
  }

  .audience-location-picker__close:hover,
  .audience-location-picker__browse:hover,
  .audience-location-picker__button:not(.audience-location-picker__button--primary):not(:disabled):hover {
    background: var(--loc-hover);
  }

  .audience-location-picker__button--primary:not(:disabled):hover {
    background: var(--loc-blue-hover);
  }
}

@media (max-width: 640px) {
  .audience-location-picker {
    padding: 0;
  }

  .audience-location-picker__panel {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .audience-location-picker__footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .audience-location-picker__button {
    flex: 1;
    height: 44px;
  }

  .audience-location-picker__button:not(.audience-location-picker__button--primary) {
    border-color: var(--loc-line);
  }
}

@media (prefers-reduced-motion: reduce) {
  .audience-location-picker__panel {
    animation: none;
  }
}
