/* Eventos Arjona — Wallet Pass (Apple Wallet × Ticketmaster) */

:root {
  --wallet-radius: 22px;
  --wallet-shadow: 0 22px 50px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(15, 23, 42, 0.08);
  --wallet-text: #111827;
  --wallet-muted: #6B7280;
  --wallet-line: #E5E7EB;
  --wallet-page: #ECECF1;
  --wallet-card: #FFFFFF;
}

.ticket-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(20px, env(safe-area-inset-top)) 16px 48px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  color: var(--wallet-text);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(124, 58, 237, 0.12), transparent),
    var(--wallet-page);
  -webkit-font-smoothing: antialiased;
}

.ticket-theme-dark.ticket-page {
  --wallet-page: #0B0F19;
  --wallet-text: #F9FAFB;
  --wallet-muted: #9CA3AF;
  --wallet-line: rgba(255,255,255,0.12);
}

.ticket-shell {
  width: min(100%, 420px);
  animation: walletEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes walletEnter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Pass container ── */
.wallet-pass {
  border-radius: var(--wallet-radius);
  overflow: hidden;
  box-shadow: var(--wallet-shadow);
  background: var(--wallet-card);
}

.ticket-theme-dark .wallet-pass {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* ── Hero (cover image) ── */
.wallet-hero {
  position: relative;
  min-height: 220px;
  max-height: 280px;
  background: linear-gradient(145deg, var(--hero-primary, var(--primary, #7C3AED)), var(--hero-secondary, var(--secondary, #4F46E5)));
  overflow: hidden;
}

.wallet-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.wallet-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.05) 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(135deg, rgba(124, 58, 237, 0.25), transparent 60%);
}

.wallet-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 18px 20px 24px;
  color: #fff;
}

.wallet-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wallet-logo {
  height: 26px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.wallet-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
}

.wallet-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

.wallet-hero-badge.status-cancelled .wallet-status-dot { background: #F87171; box-shadow: 0 0 8px rgba(248,113,113,0.8); }
.wallet-hero-badge.status-finished .wallet-status-dot { background: #94A3B8; box-shadow: none; }

.wallet-hero-info {
  margin-top: auto;
}

.wallet-event-title {
  font-size: clamp(1.65rem, 6vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.wallet-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0.95;
}

.wallet-dot { opacity: 0.6; }

.wallet-organizer {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ── Floating card body ── */
.wallet-card {
  position: relative;
  margin-top: -18px;
  padding: 0 14px 14px;
  z-index: 3;
}

.wallet-card-inner {
  background: var(--wallet-card);
  border-radius: 20px;
  border: 1px solid var(--wallet-line);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.ticket-theme-dark .wallet-card-inner {
  background: #151B28;
  border-color: rgba(255,255,255,0.08);
}

/* Type + price strip */
.wallet-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--wallet-line);
}

.wallet-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary, #7C3AED);
  background: rgba(124, 58, 237, 0.1);
}

.wallet-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--wallet-text);
  font-variant-numeric: tabular-nums;
}

/* Details */
.wallet-details {
  padding: 14px 18px 6px;
}

.wallet-holder-block {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--wallet-line);
}

.wallet-holder-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wallet-muted);
  margin-bottom: 4px;
}

.wallet-holder-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--wallet-text);
}

.wallet-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-detail {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.wallet-detail-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--primary, #7C3AED);
  margin-top: 2px;
}

.wallet-detail-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.wallet-detail-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wallet-muted);
  margin-bottom: 2px;
}

.wallet-detail-value {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--wallet-text);
}

/* Perforation */
.wallet-perforation {
  position: relative;
  height: 20px;
  margin: 8px 0;
}

.wallet-perforation::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 50%;
  border-top: 2px dashed var(--wallet-line);
}

.wallet-notch {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wallet-page);
  border: 1px solid var(--wallet-line);
}

.wallet-notch-left { left: -9px; }
.wallet-notch-right { right: -9px; }

.ticket-theme-dark .wallet-notch {
  background: var(--wallet-page);
}

/* QR scan zone */
.wallet-scan {
  padding: 8px 18px 16px;
  text-align: center;
}

.wallet-scan-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wallet-muted);
  margin-bottom: 12px;
}

.wallet-qr-shell {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.wallet-qr-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: rgba(0,0,0,0.035);
  transform: rotate(-24deg);
  pointer-events: none;
}

.wallet-qr-frame {
  position: relative;
  background: #fff;
  border: 1px solid var(--wallet-line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8);
}

.wallet-qr-frame canvas {
  width: 100% !important;
  max-width: 272px;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

.wallet-qr-frame canvas.hidden { display: none !important; }

.wallet-scan.is-used .wallet-qr-frame canvas {
  filter: grayscale(1);
  opacity: 0.4;
}

.qr-used-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.82);
  border-radius: 14px;
  z-index: 2;
}

.qr-used-overlay span {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #64748B;
  padding: 8px 14px;
  border: 2px solid #94A3B8;
  border-radius: 8px;
}

.wallet-qr-hint {
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--wallet-muted);
}

.wallet-microtext {
  font-size: 5.5px;
  letter-spacing: 0.22em;
  color: #CBD5E1;
  margin: 6px 0 10px;
  user-select: none;
}

.wallet-entry-code {
  margin-top: 4px;
}

.wallet-entry-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wallet-muted);
  margin-bottom: 4px;
}

.wallet-entry-value {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.55;
  color: var(--wallet-text);
  font-variant-numeric: tabular-nums;
}

.wallet-entry-id {
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--wallet-muted);
  font-family: ui-monospace, monospace;
}

.qr-error {
  padding: 24px;
  font-size: 0.85rem;
  color: var(--wallet-muted);
  line-height: 1.5;
}

/* Security row */
.wallet-security-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 18px 8px;
}

.wallet-barcode {
  width: 100%;
  max-width: 280px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--wallet-line);
  border-radius: 10px;
}

.wallet-barcode svg,
.wallet-barcode img {
  width: 100%;
  height: 44px;
  display: block;
}

.wallet-seal {
  display: flex;
  justify-content: center;
  width: 100%;
}

.wallet-seal-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 140px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid #CBD5E1;
  background: linear-gradient(135deg, #E5E7EB 0%, #FFFFFF 45%, #D1D5DB 55%, #9CA3AF 100%);
  box-sizing: border-box;
}

.wallet-seal-title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #475569;
  line-height: 1.2;
}

.wallet-seal-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #334155;
  line-height: 1.2;
}

/* Footer */
.wallet-footer {
  padding: 12px 18px 18px;
  border-top: 1px solid var(--wallet-line);
  text-align: center;
}

.wallet-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.wallet-status.active {
  background: rgba(34, 197, 94, 0.12);
  color: #15803D;
}

.wallet-status.issued {
  background: rgba(245, 158, 11, 0.12);
  color: #B45309;
}

.wallet-status.used, .wallet-status.revoked {
  background: rgba(100, 116, 139, 0.15);
  color: #475569;
}

.wallet-footer-text {
  font-size: 0.7rem;
  line-height: 1.55;
  color: var(--wallet-muted);
  font-weight: 500;
}

/* Actions */
.ticket-actions {
  margin-top: 18px;
  width: min(100%, 420px);
}

.ticket-actions button {
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  background: var(--wallet-text);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.ticket-actions button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ticket-actions button:active:not(:disabled) { transform: scale(0.98); }

/* Animations */
.anim-cover { animation: heroIn 0.5s ease both; }
.anim-header { animation: slideUp 0.45s ease 0.08s both; }
.anim-badge { animation: badgeIn 0.4s ease 0.12s both; }
.anim-type { animation: slideUp 0.4s ease 0.15s both; }
.anim-meta { animation: slideUp 0.4s ease 0.18s both; }
.anim-qr { animation: qrIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heroIn {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes badgeIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes qrIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-shell, .anim-cover, .anim-header, .anim-badge, .anim-type, .anim-meta, .anim-qr, .anim-barcode, .anim-seal, .anim-footer {
    animation: none !important;
  }
}

/* Desktop — single column wallet (mobile-first, max 420px) */
@media (min-width: 768px) {
  .ticket-page { padding-top: 32px; }
  .wallet-hero { min-height: 240px; }
}

/* ── Print / PDF ── */
@media print {
  @page { size: A4 portrait; margin: 10mm; }

  html, body {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print, .ticket-actions, #unlock, .loading, .error { display: none !important; }

  .ticket-page {
    background: #fff !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  .ticket-shell {
    width: 100% !important;
    max-width: 400px !important;
    margin: 0 auto !important;
    box-shadow: none !important;
  }

  .wallet-pass {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .wallet-hero-overlay,
  .wallet-hero-img {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wallet-card { margin-top: -14px !important; padding: 0 10px 10px !important; }

  .wallet-card-inner { box-shadow: none !important; }

  /* POS mode — QR only */
  body.print-mode-pos .wallet-hero,
  body.print-mode-pos .wallet-strip,
  body.print-mode-pos .wallet-details,
  body.print-mode-pos .wallet-perforation,
  body.print-mode-pos .wallet-barcode,
  body.print-mode-pos .wallet-seal,
  body.print-mode-pos .wallet-footer,
  body.print-mode-pos .wallet-entry-code,
  body.print-mode-pos .wallet-microtext,
  body.print-mode-pos .wallet-qr-hint {
    display: none !important;
  }

  body.print-mode-pos .wallet-card { margin-top: 0 !important; padding: 0 !important; }
  body.print-mode-pos .wallet-scan { padding: 20px !important; }
  body.print-mode-pos .wallet-qr-frame canvas { max-width: 320px !important; width: 320px !important; }
  body.print-mode-pos .wallet-scan-label { font-size: 1rem !important; color: #000 !important; }

  /* User mode — full color pass */
  body.print-mode-user .wallet-pass {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ── Template accents ── */
.template-premium .wallet-type-chip { background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(79,70,229,0.1)); }
.template-dark .wallet-pass { background: #151B28; }
.template-dark .wallet-card-inner { background: #1A2234; }
.template-festival .wallet-hero { min-height: 250px; }
.template-festival .wallet-type-chip { background: linear-gradient(135deg, rgba(236,72,153,0.15), rgba(249,115,22,0.12)); color: #DB2777; }
.template-vip .wallet-type-chip { background: linear-gradient(135deg, rgba(234,179,8,0.2), rgba(217,119,6,0.12)); color: #B45309; }
.template-vip .wallet-hero-overlay { background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(120,53,15,0.35) 100%); }
.template-minimal .wallet-pass { box-shadow: 0 8px 30px rgba(15,23,42,0.08); }
.template-minimal .wallet-hero { min-height: 180px; }
.template-corporate .wallet-type-chip { border-radius: 8px; text-transform: none; letter-spacing: 0.02em; }
.template-kids .wallet-event-title { font-weight: 800; }
.template-kids .wallet-type-chip { background: rgba(34,197,94,0.12); color: #15803D; }

.wallet-export,
.wallet-export * {
  animation: none !important;
  transition: none !important;
}

.wallet-export .wallet-hero-badge {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.wallet-export .wallet-barcode img {
  width: 100% !important;
  height: 44px !important;
}

.wallet-export .wallet-notch {
  background: #ffffff !important;
}

.wallet-export,
.wallet-export .wallet-pass,
.wallet-export .wallet-card,
.wallet-export .wallet-card-inner {
  overflow: visible !important;
  height: auto !important;
}

.ticket-preview-root {
  width: 100%;
}

.wallet-qr-preview {
  width: 100%;
  max-width: 272px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 12px;
  background-color: #111827;
  background-image:
    linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff),
    linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  display: grid;
  place-items: center;
}

.wallet-qr-preview span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 12px;
  border-radius: 999px;
}
