/* Country picker styles (flag + no-crop + search) — oai lane, audited by Fable. */
/* Country picker styles — oai lane, audited by Fable. */
.country-picker,
.country-picker__popup {
  --ccp-brand: #ed1c24;
  --ccp-ink: #231f20;
  --ccp-muted: #6e686b;
  --ccp-hairline: #e6e2e3;
  --ccp-tint: rgba(237, 28, 36, 0.08);
}

.country-picker {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--ccp-ink);
  font: inherit;
}

.country-picker__trigger {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--ccp-hairline);
  border-radius: 11px;
  background: #fff;
  color: var(--ccp-ink);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.country-picker__trigger:hover {
  border-color: #cec8ca;
  background: #fffafa;
}

.country-picker__trigger:focus-visible {
  outline: none;
  border-color: var(--ccp-brand);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.14);
}

.country-picker__flag {
  position: relative;
  width: 20px;
  height: 15px;
  display: inline-flex;
  flex: 0 0 20px;
  overflow: hidden;
  border-radius: 2px;
  background: #f5f3f4;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.country-picker__flag img {
  width: 20px;
  height: 15px;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.country-picker__flag--broken::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      135deg,
      transparent 46%,
      rgba(110, 104, 107, 0.25) 47%,
      rgba(110, 104, 107, 0.25) 53%,
      transparent 54%
    );
}

.country-picker__code {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  color: var(--ccp-ink);
  font-variant-numeric: tabular-nums;
}

/*
 * The popup is fixed-positioned and portaled to the native dialog so an
 * overflow-scrolling modal body cannot crop it. JavaScript supplies its
 * viewport-clamped top, left and max-height values.
 *
 * The popup owns the floating-container visuals and clips its contents;
 * the listbox is now only the inner scrolling options region.
 */
.country-picker__popup {
  position: fixed;
  z-index: 10000;
  width: max-content;
  min-width: min(22rem, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ccp-hairline);
  border-radius: 11px;
  background: #fff;
  color: var(--ccp-ink);
  box-shadow:
    0 18px 45px rgba(35, 31, 32, 0.16),
    0 4px 12px rgba(35, 31, 32, 0.08);
  font: inherit;
}

.country-picker__popup[hidden] {
  display: none;
}

.country-picker__search-header {
  position: sticky;
  top: 0;
  z-index: 1;
  flex: none;
  padding: 8px;
  border-bottom: 1px solid var(--ccp-hairline);
  background: #fff;
}

.country-picker__search {
  width: 100%;
  display: block;
  box-sizing: border-box;
  padding: 0.6rem 0.7rem;
  border: 1.5px solid var(--ccp-hairline);
  border-radius: 9px;
  background: #fff;
  color: var(--ccp-ink);
  font: inherit;
  appearance: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.country-picker__search::placeholder {
  color: var(--ccp-muted);
  opacity: 1;
}

.country-picker__search:focus {
  outline: none;
  border-color: var(--ccp-brand);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
}

.country-picker__listbox {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ccp-ink);
  font: inherit;
  scrollbar-width: thin;
  scrollbar-color: #c9c3c5 transparent;
}

.country-picker__listbox[hidden] {
  display: none;
}

.country-picker__listbox:focus {
  outline: none;
}

.country-picker__option {
  display: grid;
  grid-template-columns: 20px minmax(12rem, 1fr) max-content 18px;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.35;
}

.country-picker__option:hover,
.country-picker__option.is-active,
.country-picker__option.is-selected {
  background: var(--ccp-tint);
}

.country-picker__option.is-selected {
  font-weight: 600;
}

.country-picker__name {
  min-width: 0;
  color: var(--ccp-ink);
  white-space: normal;
  overflow-wrap: normal;
}

.country-picker__option .country-picker__code {
  color: var(--ccp-muted);
}

.country-picker__check {
  width: 18px;
  color: var(--ccp-brand);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.country-picker__empty {
  padding: 24px 16px;
  color: var(--ccp-muted);
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

/*
 * Direction is inherited by the trigger and explicitly copied to the portaled
 * popup. Grid/flex start positions therefore mirror in RTL, while dial-code
 * spans retain their own isolated LTR direction.
 */
[dir="rtl"] .country-picker__trigger,
.country-picker__popup[dir="rtl"],
.country-picker__listbox[dir="rtl"] {
  direction: rtl;
}

@media (max-width: 420px) {
  .country-picker__popup {
    min-width: calc(100vw - 16px);
  }

  .country-picker__option {
    grid-template-columns: 20px minmax(0, 1fr) max-content 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .country-picker__trigger,
  .country-picker__search {
    transition: none;
  }
}
