/**
 * Pass Preview Styles
 * Pixel-accurate Apple Wallet & Google Wallet pass previews.
 * Uses the app's CSS custom properties for dark-mode support.
 */

/* ================================================================== */
/*  Page layout                                                        */
/* ================================================================== */
.pass-preview-page {
  max-width: none;
}

/* Action bar */
.pp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.pp-actions-left { display: flex; align-items: center; gap: 12px; }
.pp-actions-right { display: flex; gap: 8px; flex-wrap: wrap; }
.pp-member-badge { font-size: 15px; }

/* Two-column grid */
.pp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.pp-col-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Phone-like frame that centres the pass card */
.pp-phone-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ================================================================== */
/*  APPLE WALLET pass                                                  */
/* ================================================================== */
.apple-pass {
  width: 340px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
}

/* Header row */
.ap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
}
.ap-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ap-logo {
  height: 30px;
  width: auto;
  border-radius: 4px;
  object-fit: contain;
}
.ap-logo-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: rgba(255,255,255,.15);
}
.ap-logo-text {
  font-size: 16px;
  font-weight: 600;
  opacity: .9;
}
.ap-header-right { text-align: right; }

/* Generic field */
.ap-field { flex: 1; min-width: 0; }
.ap-field-right { text-align: right; }
.ap-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.ap-value {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Field rows */
.ap-row {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
}
.ap-secondary-row {
  border-top: 1px solid rgba(255,255,255,.12);
}
.ap-aux-row {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-bottom: 14px;
}

/* Barcode area */
.ap-barcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  margin: 0 12px 12px;
  border-radius: 12px;
  padding: 16px 12px 10px;
}
.ap-qr-box { line-height: 0; }
.ap-qr-box canvas { border-radius: 4px; }
.ap-qr-alt {
  margin-top: 6px;
  font-size: 11px;
  color: #888;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* Back of pass */
.pp-back-toggle {
  margin-top: 12px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.pp-back-toggle:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}
.apple-pass-back {
  width: 340px;
  border-radius: 14px;
  margin-top: 12px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.ap-back-field {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.ap-back-field:last-child { border-bottom: none; }

/* ================================================================== */
/*  GOOGLE WALLET pass                                                 */
/*  Matches the real Android Generic Pass rendering order:             */
/*  header-strip → card-title/header → hero → text-modules → barcode  */
/* ================================================================== */
.google-pass {
  width: 340px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  font-family: 'Google Sans', 'Roboto', 'Noto Sans', sans-serif;
  color: #fff;
}

/* Header strip: circular logo + issuer name */
.gp-header-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 0;
}
.gp-logo {
  height: 24px;
  width: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.15);
}
.gp-logo-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.gp-issuer {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  font-weight: 500;
}

/* Card title + header value */
.gp-title-area { padding: 8px 20px 12px; }
.gp-card-title {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  margin-bottom: 2px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.gp-header-value {
  font-size: 22px;
  font-weight: 500;
  color: #fff;
}

/* Body (white card area with modules, barcode, and hero at bottom) */
.gp-body {
  background: #fff;
  padding: 16px 20px 0;
  color: #202124;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

/* Hero image (object-level, renders below text modules) */
.gp-hero {
  width: calc(100% + 40px);
  margin: 16px -20px 0;
  aspect-ratio: 3.06 / 1;
  overflow: hidden;
}
.gp-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Text modules */
.gp-modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin-bottom: 20px;
}
.gp-module {
  padding: 8px 0;
  border-bottom: 1px solid #e8eaed;
}
.gp-module:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.gp-module-header {
  font-size: 10px;
  color: #80868b;
  font-weight: 500;
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.gp-module-body {
  font-size: 14px;
  color: #202124;
  font-weight: 400;
}

/* Barcode */
.gp-barcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 4px;
  border-top: 1px solid #e8eaed;
}
.gp-barcode canvas { border-radius: 4px; }
.gp-qr-alt {
  margin-top: 4px;
  font-size: 12px;
  color: #80868b;
  font-family: 'Roboto Mono', monospace;
}

/* ================================================================== */
/*  Raw JSON viewer                                                    */
/* ================================================================== */
.pp-json-details {
  margin-top: 8px;
}
.pp-json-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 4px 0;
}
.pp-json {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* ================================================================== */
/*  Responsive                                                         */
/* ================================================================== */
@media (max-width: 820px) {
  .pp-grid { grid-template-columns: 1fr; }
  .apple-pass, .apple-pass-back, .google-pass { width: 100%; max-width: 360px; }
  .pp-actions { flex-direction: column; align-items: stretch; }
  .pp-actions-right { justify-content: flex-end; }
}
