/* AyaSend Premium Country Picker v2.0 ─────────────────────────────────────
   One shared component for Compare, Recharge, Bills, Gift Cards, eSIM, Data
   Design: Apple Wallet / Revolut / Wise quality standard
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Overlay container ──────────────────────────────────────────────────── */
.aya-pk {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 640px) {
  .aya-pk { align-items: center; }
}

/* ── Backdrop ───────────────────────────────────────────────────────────── */
.aya-pk__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: ayaPkBdIn 0.24s ease forwards;
}
.aya-pk__backdrop--closing {
  animation: ayaPkBdOut 0.28s ease forwards;
}

/* ── Sheet (the card) ───────────────────────────────────────────────────── */
.aya-pk__sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 88dvh;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -2px 40px rgba(0,0,0,0.18), 0 -1px 0 rgba(0,0,0,0.05);
  animation: ayaPkSheetIn 0.38s cubic-bezier(0.32,0.72,0,1) forwards;
  will-change: transform;
  overflow: hidden;
  outline: none;
}
html.dark .aya-pk__sheet {
  background: #0f172a;
  box-shadow: 0 -2px 60px rgba(0,0,0,0.7), 0 -1px 0 rgba(37,99,235,0.15);
}
.aya-pk__sheet--closing {
  animation: ayaPkSheetOut 0.30s cubic-bezier(0.4,0,0.6,1) forwards;
}

@media (min-width: 640px) {
  .aya-pk__sheet {
    width: 520px;
    max-height: 84vh;
    border-radius: 20px;
    animation: ayaPkModalIn 0.30s cubic-bezier(0.34,1.36,0.64,1) forwards;
    box-shadow: 0 24px 80px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.06);
  }
  html.dark .aya-pk__sheet {
    box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.06);
  }
  .aya-pk__sheet--closing {
    animation: ayaPkModalOut 0.22s ease-in forwards;
  }
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes ayaPkBdIn   { from { opacity:0 } to { opacity:1 } }
@keyframes ayaPkBdOut  { from { opacity:1 } to { opacity:0 } }
@keyframes ayaPkSheetIn  { from { transform:translateY(100%) } to { transform:translateY(0) } }
@keyframes ayaPkSheetOut { from { transform:translateY(0) }   to { transform:translateY(100%) } }
@keyframes ayaPkModalIn  { from { opacity:0; transform:scale(.95) translateY(10px) } to { opacity:1; transform:scale(1) translateY(0) } }
@keyframes ayaPkModalOut { from { opacity:1; transform:scale(1) translateY(0) }    to { opacity:0; transform:scale(.97) translateY(6px) } }
@keyframes ayaPkSpin    { to { transform: rotate(360deg) } }

/* ── Swipe handle ───────────────────────────────────────────────────────── */
.aya-pk__handle {
  flex-shrink: 0;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
}
.aya-pk__handle::after {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(100,116,139,0.22);
  transition: background 0.15s;
}
.aya-pk__handle:active::after { background: rgba(100,116,139,0.4); }
@media (min-width: 640px) { .aya-pk__handle { display: none; } }

/* ── Header ─────────────────────────────────────────────────────────────── */
.aya-pk__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 18px 14px;
  border-bottom: 1px solid rgba(226,232,240,0.8);
}
html.dark .aya-pk__header { border-color: rgba(51,65,85,0.65); }
.aya-pk__header-text { flex: 1; min-width: 0; }
.aya-pk__title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}
html.dark .aya-pk__title { color: #f1f5f9; }
.aya-pk__subtitle {
  font-size: 12px;
  color: #64748b;
  margin: 2px 0 0;
  line-height: 1;
}
html.dark .aya-pk__subtitle { color: #64748b; }

.aya-pk__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(100,116,139,0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s, color 0.15s;
}
.aya-pk__close:hover { background: rgba(100,116,139,0.18); color: #334155; }
.aya-pk__close:active { transform: scale(0.88); }
html.dark .aya-pk__close { background: rgba(51,65,85,0.55); color: #94a3b8; }
html.dark .aya-pk__close:hover { background: rgba(51,65,85,0.8); color: #cbd5e1; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.aya-pk__search-wrap {
  flex-shrink: 0;
  padding: 10px 14px 8px;
  position: relative;
}
.aya-pk__search-icon {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #94a3b8;
  transition: color 0.15s;
}
.aya-pk__search-wrap:focus-within .aya-pk__search-icon { color: #2563EB; }
html.dark .aya-pk__search-wrap:focus-within .aya-pk__search-icon { color: #60a5fa; }
.aya-pk__search-input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 44px;
  border-radius: 14px;
  border: 1.5px solid rgba(226,232,240,0.9);
  background: #f8fafc;
  font-size: 15px;
  font-weight: 500;
  color: #0f172a;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.aya-pk__search-input::placeholder { color: #94a3b8; font-weight: 400; }
.aya-pk__search-input:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3.5px rgba(37,99,235,0.12);
  background: #fff;
}
html.dark .aya-pk__search-input {
  background: rgba(30,41,59,0.8);
  border-color: rgba(51,65,85,0.7);
  color: #f1f5f9;
}
html.dark .aya-pk__search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3.5px rgba(59,130,246,0.15);
  background: rgba(15,23,42,0.9);
}
.aya-pk__search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Region chips ───────────────────────────────────────────────────────── */
.aya-pk__regions {
  flex-shrink: 0;
  display: flex;
  gap: 7px;
  padding: 0 14px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.aya-pk__regions::-webkit-scrollbar { display: none; }

.aya-pk__region-chip {
  flex-shrink: 0;
  height: 33px;
  padding: 0 13px;
  border-radius: 100px;
  border: 1.5px solid rgba(226,232,240,0.9);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.18s cubic-bezier(0.34,1.36,0.64,1);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
}
.aya-pk__region-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-1px);
}
.aya-pk__region-chip:active { transform: scale(0.95); }
.aya-pk__region-chip--active {
  background: linear-gradient(135deg, #2563EB, #1d4ed8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(37,99,235,0.38);
  transform: translateY(-1px);
}
.aya-pk__region-chip--active:hover { transform: translateY(-1px); }

html.dark .aya-pk__region-chip {
  background: rgba(30,41,59,0.8);
  border-color: rgba(51,65,85,0.6);
  color: #94a3b8;
}
html.dark .aya-pk__region-chip:hover {
  border-color: #3b82f6;
  color: #93c5fd;
  background: rgba(30,58,138,0.3);
}
html.dark .aya-pk__region-chip--active {
  background: linear-gradient(135deg, #2563EB, #1d4ed8);
  color: #fff;
  border-color: transparent;
}

/* ── Scrollable body ────────────────────────────────────────────────────── */
.aya-pk__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 12px);
}

/* ── Section labels ─────────────────────────────────────────────────────── */
.aya-pk__section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  user-select: none;
}

/* ── Country list ───────────────────────────────────────────────────────── */
.aya-pk__list {
  padding: 2px 10px 4px;
}

/* ── Country item row ───────────────────────────────────────────────────── */
.aya-pk__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 7px 10px;
  border-radius: 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.13s, transform 0.1s;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}
.aya-pk__item:hover { background: rgba(241,245,249,0.9); }
.aya-pk__item:active { background: rgba(226,232,240,0.85); transform: scale(0.984); }
.aya-pk__item--selected {
  background: linear-gradient(135deg, rgba(37,99,235,0.09), rgba(37,99,235,0.04));
}
.aya-pk__item--selected:hover {
  background: linear-gradient(135deg, rgba(37,99,235,0.13), rgba(37,99,235,0.07));
}
html.dark .aya-pk__item:hover { background: rgba(30,41,59,0.75); }
html.dark .aya-pk__item:active { background: rgba(15,23,42,0.9); }
html.dark .aya-pk__item--selected { background: rgba(37,99,235,0.14); }

/* ── Flag ───────────────────────────────────────────────────────────────── */
.aya-pk__flag-wrap {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(226,232,240,0.65);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.04);
  transition: border-color 0.15s;
}
.aya-pk__item--selected .aya-pk__flag-wrap {
  border-color: rgba(37,99,235,0.4);
  box-shadow: 0 1px 4px rgba(37,99,235,0.15);
}
html.dark .aya-pk__flag-wrap {
  border-color: rgba(51,65,85,0.6);
  background: rgba(30,41,59,0.6);
}
.aya-pk__flag {
  width: 44px;
  height: 44px;
  object-fit: cover;
  display: block;
}

/* ── Item body (name + sub) ─────────────────────────────────────────────── */
.aya-pk__item-body { flex: 1; min-width: 0; }
.aya-pk__item-name {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: -0.01em;
  transition: color 0.12s;
}
html.dark .aya-pk__item-name { color: #e2e8f0; }
.aya-pk__item--selected .aya-pk__item-name { color: #1d4ed8; font-weight: 700; }
html.dark .aya-pk__item--selected .aya-pk__item-name { color: #93c5fd; }

.aya-pk__item-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.2;
  font-weight: 500;
}
.aya-pk__item--selected .aya-pk__item-sub { color: rgba(37,99,235,0.7); }

/* ── Item right side ────────────────────────────────────────────────────── */
.aya-pk__item-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.aya-pk__item-meta {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(241,245,249,0.9);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}
html.dark .aya-pk__item-meta { background: rgba(51,65,85,0.55); color: #64748b; }
.aya-pk__item--selected .aya-pk__item-meta {
  background: rgba(37,99,235,0.1);
  color: #2563EB;
}
html.dark .aya-pk__item--selected .aya-pk__item-meta { color: #60a5fa; background: rgba(37,99,235,0.2); }

.aya-pk__item-check { color: #2563EB; flex-shrink: 0; }
html.dark .aya-pk__item-check { color: #60a5fa; }
.aya-pk__item-chevron { color: rgba(148,163,184,0.65); flex-shrink: 0; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.aya-pk__empty {
  text-align: center;
  padding: 52px 28px 40px;
}
.aya-pk__empty-icon { font-size: 44px; margin-bottom: 14px; line-height: 1; }
.aya-pk__empty-title { font-size: 16px; font-weight: 700; color: #334155; margin-bottom: 7px; }
html.dark .aya-pk__empty-title { color: #94a3b8; }
.aya-pk__empty-sub { font-size: 13px; color: #94a3b8; line-height: 1.5; }

/* ── Compatibility: old .premium-picker class still works ───────────────── */
.premium-picker { position: fixed; inset: 0; z-index: 9999; }
.premium-picker.show .premium-picker__backdrop { opacity: 1; }
.premium-picker__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .26s ease;
}
.premium-picker__modal {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #fff; border-radius: 28px 28px 0 0;
  max-height: 90vh; display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(0.32,0.72,0,1);
  box-shadow: 0 -4px 40px rgba(0,0,0,0.18);
  overflow: hidden;
}
@media (min-width: 640px) {
  .premium-picker__modal {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%,-50%) scale(.96);
    width: 480px; border-radius: 20px; max-height: 82vh;
    transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), opacity 0.28s ease;
    opacity: 0;
  }
}
.premium-picker.show .premium-picker__modal {
  transform: translateY(0);
}
@media (min-width: 640px) {
  .premium-picker.show .premium-picker__modal {
    transform: translate(-50%,-50%) scale(1);
    opacity: 1;
  }
}
html.dark .premium-picker__modal { background: #0f172a; }
.premium-picker__swipe-handle {
  flex-shrink: 0; height: 22px; display: flex; align-items: center; justify-content: center;
}
.premium-picker__swipe-handle::after {
  content: ''; display: block; width: 40px; height: 4px; border-radius: 2px;
  background: rgba(100,116,139,0.22);
}
@media (min-width: 640px) { .premium-picker__swipe-handle { display: none; } }
.premium-picker__header {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 18px 14px;
  border-bottom: 1px solid rgba(226,232,240,0.7);
}
html.dark .premium-picker__header { border-color: rgba(51,65,85,0.6); }
.premium-picker__title { font-size: 17px; font-weight: 800; color: #0f172a; letter-spacing:-0.02em; }
html.dark .premium-picker__title { color: #f1f5f9; }
.premium-picker__subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }
.premium-picker__close {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(100,116,139,0.1);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #64748b; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.premium-picker__close:hover { background: rgba(100,116,139,0.18); }
.premium-picker__close:active { transform: scale(0.88); }
html.dark .premium-picker__close { background: rgba(51,65,85,0.55); color: #94a3b8; }
.premium-picker__list-container {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 0 0 max(env(safe-area-inset-bottom,0px),12px);
}
.premium-picker__section-label {
  padding: 14px 20px 6px; font-size: 11px; font-weight: 700; color: #94a3b8;
  letter-spacing: 0.07em; text-transform: uppercase;
}
.premium-picker__list { padding: 2px 10px 4px; }
.premium-picker__country {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px; padding: 7px 10px; border-radius: 14px;
  border: none; background: transparent; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background 0.13s, transform 0.1s;
  box-sizing: border-box;
}
.premium-picker__country:hover { background: rgba(241,245,249,0.9); }
.premium-picker__country:active { background: rgba(226,232,240,0.85); transform: scale(0.984); }
.premium-picker__country.selected { background: linear-gradient(135deg,rgba(37,99,235,.09),rgba(37,99,235,.04)); }
html.dark .premium-picker__country:hover { background: rgba(30,41,59,0.75); }
html.dark .premium-picker__country.selected { background: rgba(37,99,235,0.14); }
.premium-picker__flag-circle {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; border: 1.5px solid rgba(226,232,240,0.65);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); flex-shrink: 0;
}
.premium-picker__country-info { flex: 1; min-width: 0; }
.premium-picker__country-name {
  font-size: 15px; font-weight: 600; color: #0f172a; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html.dark .premium-picker__country-name { color: #e2e8f0; }
.premium-picker__country.selected .premium-picker__country-name { color: #1d4ed8; font-weight: 700; }
html.dark .premium-picker__country.selected .premium-picker__country-name { color: #93c5fd; }
.premium-picker__country-currency {
  font-size: 11px; font-weight: 700; color: #94a3b8;
  background: rgba(241,245,249,0.9); padding: 2px 7px; border-radius: 6px;
  flex-shrink: 0;
}
html.dark .premium-picker__country-currency { background: rgba(51,65,85,0.55); }
.premium-picker__country.selected .premium-picker__country-currency { background: rgba(37,99,235,0.1); color: #2563EB; }
.premium-picker__country-check { color: #2563EB; flex-shrink: 0; }
html.dark .premium-picker__country-check { color: #60a5fa; }
