/* ============================================================
   International phone input (.rp-) - flag + dial code picker
   shared by the sign-up dialog, checkout and the profile page.
   ============================================================ */

.rp-flag {
  display: block;
  flex: none;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.12);
}

/* ------------------------------------------------------------ trigger */
.rp-pick {
  position: absolute;
  top: 50%;
  left: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 9px 0 8px;
  border: 0;
  border-right: 1px solid var(--ra-line, rgba(16, 24, 40, 0.1));
  border-radius: 11px 0 0 11px;
  background: none;
  color: var(--ra-ink, #0e1116);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.16s ease;
}
.rp-pick:hover { background: rgba(16, 24, 40, 0.045); }
.rp-dial { font-variant-numeric: tabular-nums; }
.rp-caret { color: var(--ra-faint, #9aa1ae); transition: transform 0.18s ease; }
.rp-pick[aria-expanded="true"] .rp-caret { transform: rotate(180deg); }
.rp-pick--plain {
  height: 38px;
  padding: 0 10px;
  font-size: 0.85rem;
  border-radius: 12px 0 0 12px;
}

/* the auth-dialog variant reuses .ra-input, just with room for the trigger */
.ra-field--tel .ra-input { padding-left: 112px; }
.ra-field--tel .ra-label { left: 112px; }

/* checkout / profile variant - the surrounding classes come from the app's
   prebuilt Tailwind bundle, so the trigger offset lives here instead. */
.rp-num-plain {
  padding-left: 108px;
  padding-right: 16px;
}

/* ------------------------------------------------------------ dropdown */
/* Invisible on desktop: it only exists to swallow wheel/touch scrolling so the
   page behind stays put while the list is open. */
.rp-scrim {
  position: fixed;
  inset: 0;
  z-index: 1399;
  touch-action: none;
  background: transparent;
}
.rp-scrim--dim {
  background: rgba(8, 10, 16, 0.44);
  backdrop-filter: blur(2px);
}

.rp-pop {
  position: fixed;
  z-index: 1400; /* above the auth dialog (1300) */
  display: flex;
  flex-direction: column;
  width: 340px;
  max-height: var(--rp-max, 340px);
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 70px -24px rgba(8, 10, 16, 0.5), 0 0 0 1px rgba(16, 24, 40, 0.03);
}
.rp-pop-head { display: none; }

.rp-search {
  display: flex;
  flex: none;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  color: var(--ra-faint, #9aa1ae);
}
.rp-search input {
  width: 100%;
  border: 0;
  background: none;
  color: var(--ra-ink, #0e1116);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}
.rp-search input::placeholder { color: var(--ra-faint, #9aa1ae); font-weight: 500; }

.rp-list {
  flex: 1;
  /* Without this the list keeps its full content height in the column flexbox
     and gets clipped by the popup instead of scrolling. */
  min-height: 0;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 24, 40, 0.22) transparent;
}
.rp-list::-webkit-scrollbar { width: 8px; }
.rp-list::-webkit-scrollbar-track { background: transparent; }
.rp-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(16, 24, 40, 0.22);
  background-clip: content-box;
}
.rp-list:hover::-webkit-scrollbar-thumb { background: rgba(16, 24, 40, 0.34); background-clip: content-box; }
.rp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--ra-ink, #0e1116);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.rp-row.is-cur { background: #f2f5fd; }
.rp-row.is-sel { color: var(--ra-navy, #132a8e); }
.rp-row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rp-row-dial {
  flex: none;
  color: var(--ra-muted, #6b7280);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rp-row.is-sel .rp-row-dial { color: var(--ra-navy, #132a8e); }
.rp-row-tick { flex: none; color: var(--ra-navy, #132a8e); }
.rp-empty {
  padding: 26px 14px;
  color: var(--ra-muted, #6b7280);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

/* ------------------------------------------------------------ phones: bottom sheet */
@media (max-width: 599px) {
  .rp-pop--sheet {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 78dvh;
    border: 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rp-pop-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 10px;
    font-family: var(--ra-display, inherit);
    font-size: 1.02rem;
    font-weight: 800;
  }
  .rp-pop-x {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(16, 24, 40, 0.06);
    color: var(--ra-ink-soft, #3d4452);
    cursor: pointer;
  }
  .rp-search { padding: 10px 16px; }
  .rp-row { padding: 12px 10px; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rp-caret { transition: none; }
}
