/* ── QR Card: mobile-first layout ──────────────────────────── */
.qr-card {
  display: flex;
  justify-content: center;
  align-items: center;
  /* Constrain width on large screens for better readability */
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

/* Stack card body vertically and center everything */
.qr-card .card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

/* ── QR Wrapper ─────────────────────────────────────────────── */
/* Mobile-first: maximize QR size for easy scanning.
   Uses calc(100% - ...) so it never escapes its container.
   The wrapper must be wider than the 220px canvas + padding. */
.qr-wrapper {
  /* At least 256px so 220px canvas + 2×16px padding = 252px fits */
  width: min(280px, calc(100% - 0.5rem));
  height: min(280px, calc(100% - 0.5rem));
  margin: 0 auto var(--space-md);
  padding: 0.75rem; /* reduced from 1rem to give canvas more room */
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Ensure the generated QR canvas/img never overflows the white box */
.qr-wrapper canvas,
.qr-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-wrapper.qr-skeleton {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

.qr-wrapper.qr-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--color-bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite ease-in-out;
}

/* ── QR Info ────────────────────────────────────────────────── */
.qr-info {
  text-align: center;
  margin-bottom: var(--space-md);
  width: 100%;
  box-sizing: border-box;
}

/* Fluid heading typography: scales between 1.125rem (tiny mobile)
   and 1.5rem (desktop) */
.qr-info h2 {
  font-size: clamp(1.125rem, 4.5vw, 1.5rem);
  word-break: break-word;
}

/* ── QR Actions ─────────────────────────────────────────────── */
.qr-actions {
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure the download button meets 44px minimum touch target */
.qr-actions .btn {
  min-height: 44px;
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}

/* ── Mobile breakpoint (≤ 768px) ─── */
@media (max-width: 768px) {
  .qr-card {
    max-width: 100%;
  }

  .qr-actions {
    flex-direction: column;
    width: 100%;
  }

  .qr-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* ── Small mobile (≤ 480px): bigger QR, tighter padding ─── */
@media (max-width: 480px) {
  .qr-wrapper {
    /* On very small screens use almost full available width */
    width: min(260px, calc(100% - 0.25rem));
    height: min(260px, calc(100% - 0.25rem));
    padding: 0.625rem;
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.text-skeleton {
  position: relative;
  color: transparent !important;
}

.text-skeleton::after {
  content: '';
  display: block;
  height: 12px;
  margin: 8px auto;
  width: min(220px, 70%);
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--color-bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite ease-in-out;
}
