/* Attendee wallet layout. Mobile-first, one column; tokens only, no literal colors. */

/* The "Modo de prueba" banner is styled once in base.css (OD-UI-012). */

.wallet {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 32rem;
  margin: 0 auto;
  padding: var(--space-4);
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
}

.wallet__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

/* The approved imagotype, never narrower than the 115 px brand minimum (OD-UI-006). */
.wallet__logo {
  inline-size: max(var(--brand-logo-min-width), 7.1875rem);
  block-size: auto;
  flex-shrink: 0;
}

.wallet__heading {
  font-size: var(--font-size-xlarge);
}

.sign-in,
.balance {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/*
 * The QR panel is a white card with the strong line and the 24 px card radius (OD-UI-012), so the
 * code keeps white around its quiet zone.
 */
.pay {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-qr-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
}

.sign-in[hidden],
.pay[hidden] {
  display: none;
}

/* Decorative gold isotype heading the sign-in frame (alt=""). */
.sign-in__isotype {
  inline-size: 3rem;
  block-size: auto;
  align-self: center;
}

.sign-in__heading,
.balance__heading,
.pay__heading {
  font-size: var(--font-size-large);
}

.balance__body,
.pay__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/*
 * Owner row at the top of the balance card (OD-UI-017): the Clerk UserButton or the initials
 * circle, then the owner's name (and reservation for a personal link), which wraps.
 */
.balance__identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

/* Clerk renders its own avatar button in this slot; the slot keeps the 44 px touch target. */
.balance__account {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
}

/* Decorative initials (aria-hidden) on the primary pair: 7.76:1 in Claro. */
.balance__avatar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  inline-size: var(--touch-target-min);
  block-size: var(--touch-target-min);
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-weight: 700;
  line-height: 1;
}

.balance__identity[hidden],
.balance__account[hidden],
.balance__avatar[hidden],
.balance__owner[hidden] {
  display: none;
}

/* The owner's own name and reservation (reservations-static-qr D13, OD-UI-017). */
.balance__owner {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* The balance is the display figure: Bodoni Moda 400 on the fluid figure scale (OD-UI-012). */
.balance__amount {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-figure);
  font-weight: 400;
  line-height: var(--line-height-figure);
  letter-spacing: var(--heading-letter-spacing);
  color: var(--color-heading);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  /* The new server value rolls in as one figure; no intermediate balance is ever drawn. */
  animation: wallet-balance-roll var(--motion-sheet) var(--motion-ease-out);
}

.balance__button,
.pay__button {
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-primary-text);
}

/* "Actualizar saldo" is a secondary action, styled as a link with the full touch target. */
.balance__button[data-action="refresh-balance"] {
  align-self: flex-start;
  padding-inline: var(--space-1);
  border-color: transparent;
  background: transparent;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/*
 * QR frame (ui-v2-wallet-qr-frame, OD-UI-006): a square on white whose padding holds the
 * decorative ring, so the ring stays outside the QR's own four-module quiet zone and never
 * overlaps or clips the code.
 */
.pay__qr-frame {
  position: relative;
  align-self: center;
  width: min(100%, 22rem);
  aspect-ratio: 1;
  padding: 4%;
  background: var(--color-qr-surface);
}

/* Black on white is drawn inside the SVG; nothing may overlap or tint the code. */
.pay__qr {
  display: block;
  width: 100%;
  height: auto;
  animation: wallet-qr-sweep calc(var(--motion-sheet) * 1.5) var(--motion-ease-out);
}

/*
 * The ring's emptiness is the stroke-dashoffset attribute written on each 1 s tick from the same
 * expiry as the countdown; no stylesheet offset, transition or animation may move it.
 */
.pay__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pay__ring-track,
.pay__ring-progress {
  fill: none;
  stroke-width: 2px;
}

.pay__ring-track {
  stroke: var(--color-divider);
}

.pay__ring-progress {
  stroke: var(--color-primary);
}

/* Last ten seconds: soft gold; the countdown text still states the seconds. */
.pay__ring--late .pay__ring-progress {
  stroke: var(--color-warning-surface);
}

/* Static QR: the same shape, full and still, in the light line color. */
.pay__ring--still .pay__ring-track {
  stroke: var(--color-divider);
}

.pay__short-code-label {
  color: var(--color-text-muted);
  text-align: center;
}

/* Monospace keeps similar glyphs apart while the code is read aloud. */
.pay__short-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
}

.pay__countdown {
  font-size: var(--font-size-large);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Payment confirmation: the status region stays in the document; it has a box only when filled. */
.confirmation__region:not(:empty) {
  animation: wallet-confirmation-in var(--motion-sheet) var(--motion-ease-out);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 3px solid var(--color-success-surface);
  border-top-width: var(--space-3);
  border-radius: var(--radius);
}

/*
 * Confirmed payment (OD-UI-003): success color as a band and a border on the raised surface, plus
 * the words "Pago realizado". The box is not filled, so the focus ring of the focused heading and
 * of the button keeps its contrast.
 */
.confirmation__heading {
  font-size: var(--font-size-xlarge);
  color: var(--color-success-surface);
}

.confirmation__amount {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-xlarge);
  font-weight: 700;
  color: var(--color-heading);
  font-variant-numeric: tabular-nums;
}

.confirmation__balance {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.confirmation__detail {
  overflow-wrap: anywhere;
}

.movements__button {
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-primary-text);
}

/* "Listo" closes the confirmation; the pay button stays the one primary (OD-UI-012). */
.confirmation__button {
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary);
}

.movements {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.movements[hidden] {
  display: none;
}

.movements__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.movements__heading {
  font-size: var(--font-size-large);
}

.movements__button--secondary {
  background: var(--color-surface);
  color: var(--color-primary);
}

.movements__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.movements__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider); /* a separator, not a control border */
  animation: wallet-movement-in var(--motion-quick) var(--motion-ease);
}

.movements__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-weight: 700;
}

.movements__amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.movements__amount--credit {
  color: var(--color-primary);
}

.movements__details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

/* The shared purchase breakdown rules are in base.css (OD-UI-012 dedupe). */
.movements__breakdown {
  color: var(--color-text-muted);
}

/*
 * saper.club action buttons (OD-UI-012, superseding the Lato Black and small radius of OD-UI-005):
 * pills with small, tracked capitals in Lato Bold, from CSS only. The strings, and so the
 * accessible names, stay in normal case. The 44 px target stays.
 */
.balance__button,
.pay__button,
.confirmation__button,
.movements__button {
  min-height: var(--touch-target-min);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-button);
  font-weight: var(--button-font-weight);
  letter-spacing: var(--button-letter-spacing);
  text-transform: uppercase;
}

/* Disabled actions follow OD-UI-003: the disabled pair and a dashed border. */
.balance__button:disabled,
.pay__button:disabled,
.confirmation__button:disabled,
.movements__button:disabled {
  border-style: dashed;
  border-color: var(--color-disabled-text);
  background: var(--color-disabled-surface);
  color: var(--color-disabled-text);
}

/*
 * Wallet motion (ui-v2-wallet-qr-frame, OD-UI-006): whole values move in, timed by the --motion-*
 * tokens; the global reduced-motion rule in base.css makes every one instant. The sweep only
 * reveals a new QR; at rest the code is never clipped.
 */
@keyframes wallet-qr-sweep {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0); }
}

@keyframes wallet-confirmation-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes wallet-balance-roll {
  from { opacity: 0; transform: translateY(0.25em); }
  to { opacity: 1; transform: none; }
}

@keyframes wallet-movement-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/*
 * "Guardar mi acceso" (2026-10-03), link mode only: a secondary action under the balance, with its
 * help and a live message. The binding outcome after Clerk's redirect shows above the balance.
 */
.balance__save-access {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--color-divider);
}

.balance__save-access[hidden],
.balance__save-access-help[hidden],
.balance__save-access-message[hidden] {
  display: none;
}

.balance__save-access-help,
.balance__save-access-message {
  margin: 0;
}

.balance__button--secondary {
  background: transparent;
  color: var(--color-primary);
}

.balance__save-access-message[role="alert"],
.wallet__notice-text--error {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--color-error-surface);
  color: var(--color-error-text);
}

.wallet__notice:empty {
  display: none;
}

.wallet__notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.wallet__notice-text {
  margin: 0;
}

.wallet__notice-text--success {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--color-success-surface);
  color: var(--color-success-text);
}
