/* XIAN Snackbar — three states: scan / connecting / ready
   Figma nodes 60857:145970, 60857:126770, 60857:126780
   Renders inside the iPhone screen, anchored above the bottom nav. */

.xn-snackbar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 96px; /* clears the 80px nav-bar with 16px breathing room */
  height: 80px; /* matches Figma — 16px V-padding + 22+20 line wrap = 80 */
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  overflow: hidden;
  z-index: 10;
  /* Frosted-glass surface from Figma `dark/translucent-3` over the screen.
     On the white Explore body this resolves to near-solid white; we set the
     mostly-opaque value here so the snackbar reads as a discrete card even
     when the body below has darker pixels. */
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(9.5px);
  -webkit-backdrop-filter: blur(9.5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* ── Left product area (86×80) ──
   Figma uses content-stretch with 8px padding, no explicit fill — the
   translucent base shows through. We keep it transparent so both halves
   share the same surface. */
.xn-snackbar .product {
  flex-shrink: 0;
  width: 86px;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 8px;
  background: transparent;
}
.xn-snackbar .product img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Right header area ──
   Figma sets bg-white on this half explicitly, even though the outer is
   translucent. That's how it gets the visible split between product image
   on the left and text on the right. */
.xn-snackbar .header {
  flex: 1 1 0;
  min-width: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 16px 12px;
}

.xn-snackbar .content {
  flex: 1 1 0;
  min-width: 0;
}
.xn-snackbar .content p {
  font-family: var(--font-stack);
  font-weight: 400;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: -0.31px;
  color: #0a0a0a;
  font-variation-settings: 'wdth' 100;
}
/* Figma authors the bolded product name as a smaller inline span (14/20)
   so the line-height tightens on the wrapped second line. */
.xn-snackbar .content p strong {
  font-weight: 700;
  font-size: 14px;
  line-height: 20px;
}

/* ── Connect button (Scan state) ──
   Text-only blue button — no background, no border. Figma rounded 4px and
   px-2 py-2.5 (8/10) so the tap target hits 40px min height. */
.xn-snackbar .btn-connect {
  flex-shrink: 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-stack);
  font-weight: 510;
  font-size: 16px;
  line-height: 21px;
  letter-spacing: -0.31px;
  color: var(--xian-primary);
  font-variation-settings: 'wdth' 100;
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    background-color 120ms ease;
}
.xn-snackbar .btn-connect:hover {
  background: rgba(0, 117, 245, 0.06);
}
.xn-snackbar .btn-connect:active {
  opacity: 0.6;
  transform: scale(0.96);
}

/* ── Loading icon (Connecting + Ready states) ──
   Four dots laid out at the EXACT inset percentages Figma uses on the
   20×20 container. The right dot is intentionally larger and darker so
   when the whole element rotates, the leading dot reads as the head of
   the spinner. */
.xn-snackbar .loading {
  width: 80px;
  min-height: 40px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 4px;
  padding: 10px 8px;
}
.xn-snackbar .dots {
  position: relative;
  width: 20px;
  height: 20px;
  animation: xn-rotate 1.4s linear infinite;
}
.xn-snackbar .dots span {
  position: absolute;
  border-radius: 999px;
}
/* Top dot — light blue, small (33×33%) */
.xn-snackbar .dots span:nth-child(1) {
  top: 4.17%;
  bottom: 62.5%;
  left: 33.33%;
  right: 33.33%;
  background: #75c3ff;
}
/* Bottom dot — light blue, small */
.xn-snackbar .dots span:nth-child(2) {
  top: 62.5%;
  bottom: 4.17%;
  left: 33.33%;
  right: 33.33%;
  background: #75c3ff;
}
/* Left dot — gray, small */
.xn-snackbar .dots span:nth-child(3) {
  top: 33.33%;
  bottom: 33.33%;
  left: 8.33%;
  right: 58.33%;
  background: #f0f0f0;
}
/* Right dot — primary blue, larger (~41×41%) — orbits as leader */
.xn-snackbar .dots span:nth-child(4) {
  top: 29.17%;
  bottom: 29.17%;
  left: 54.17%;
  right: 4.17%;
  background: #415cff;
}
@keyframes xn-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
/* Ready state — pause the spinner so the dots hold the Figma static layout */
.xn-snackbar.is-ready .dots {
  animation-play-state: paused;
}

/* ── Entry animation — slides up from below + fades in. ── */
.xn-snackbar.is-enter {
  animation: xn-snackbar-enter 480ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes xn-snackbar-enter {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
