/* =========================================================
   WALLET BUILD MODAL LAYOUT
   Two-column: Form (left) / Pass Preview (right)
   Height constraint: never exceed viewport
========================================================= */

#walletBuildModal:not(.hidden) {
  overflow: auto;
  align-items: flex-start;
  padding: 20px 0;
}

#walletBuildModal.is-saving {
  pointer-events: none;
  opacity: 0.72;
  transition: opacity 180ms ease;
}

#walletBuildModal.is-saving * {
  pointer-events: none;
}

.modal-card.wallet-build {
  position: relative;
  max-width: 1040px;
  width: 96%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.wallet-build .modal-header {
  flex-shrink: 0;
}

.modal-card.wallet-build .modal-body.two-col {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* Two-column body */
.modal-body.two-col {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 36px;
  align-items: flex-start;
}

/* IMAGE PICKER BASE */
.image-picker {
  position: relative;
  width: 140px;
  height: 96px; /* 🔑 smaller = calmer */
  border-radius: 12px;
  border: 1px dashed rgba(255,170,60,0.45);
  background: rgba(255,255,255,0.04);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  overflow: hidden;
}

.image-picker.banner {
  width: 100%;
  height: 96px;
}

/* FILE INPUT OVERLAY */
.image-picker input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}




/* =========================================================
   ASSETS + SAVE — FULL WIDTH ROW (compact)
========================================================= */

.assets-save-row {
  grid-column: 1 / -1;
  margin-top: 16px;
  flex-shrink: 0;
}

.asset-row-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: none;
}

.asset-row-compact .form-status {
  margin-top: 0;
  order: 1;
  width: 100%;
}

.asset-row-compact .asset-actions {
  padding-bottom: 0;
}

/* Individual asset blocks */
.asset-picker label {
  display: block;
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 6px;
}

/* Action buttons */
.asset-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 4px;
}

/* Placeholder text */
.picker-placeholder {
  font-size: 13px;
  opacity: 0.6;
  pointer-events: none;
}

/* Image previews */
.image-picker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Hover */
.image-picker:hover {
  border-color: #ff9f2f;
  background: rgba(255,255,255,0.07);
}


/* =========================================================
   LEFT COLUMN — FORM
   Calm vertical rhythm
========================================================= */

.coupon-form {
  max-width: 460px;
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0.75;
  margin-bottom: 5px;
}

.coupon-form input,
.coupon-form textarea,
.coupon-form select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;

  border: 1px solid rgba(255,170,60,0.22);
  background: rgba(255,255,255,0.055);
  color: #fff;

  font-size: 14px;
  box-sizing: border-box;
}

.coupon-form input:focus,
.coupon-form textarea:focus,
.coupon-form select:focus {
  outline: none;
  border-color: #ff9f2f;
  background: rgba(255,255,255,0.085);
}

.coupon-form textarea {
  min-height: 72px;
  resize: vertical;
}

.form-row.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Design Tools — barcode + popup buttons */
.design-tools-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 170, 60, 0.2);
}

.design-tools-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

.design-tools-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-popup {
  font-size: 13px;
  padding: 8px 14px;
}

/* Color row (used in popup and legacy) */
.coupon-form .color-row,
.wallet-popup .color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coupon-form input[type="color"],
.wallet-popup input[type="color"] {
  width: 56px;
  height: 36px;
  padding: 2px;
  border: 1px solid rgba(255, 170, 60, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.coupon-form .color-value,
.wallet-popup .color-value {
  font-size: 13px;
  font-family: ui-monospace, monospace;
  color: rgba(255, 255, 255, 0.85);
}

/* =========================================================
   WALLET POPUPS (lightweight overlays, not second modal)
========================================================= */

.wallet-popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}

.wallet-popup-overlay.hidden {
  display: none;
}

.wallet-popup {
  background: linear-gradient(180deg, rgba(14, 12, 16, 0.98), rgba(10, 8, 12, 0.95));
  border: 1px solid rgba(255, 170, 60, 0.25);
  border-radius: 14px;
  padding: 0;
  max-width: 360px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.wallet-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 170, 60, 0.15);
  flex-shrink: 0;
}

.wallet-popup-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.wallet-popup-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 6px;
}

.wallet-popup-close:hover {
  color: #fff;
  background: rgba(255, 170, 60, 0.15);
}

.wallet-popup-body {
  padding: 16px;
  overflow: auto;
}

.wallet-popup-body .form-row {
  margin-bottom: 12px;
}

.wallet-popup-body .asset-picker {
  margin-bottom: 14px;
}

.wallet-popup-body .asset-picker:last-child {
  margin-bottom: 0;
}

.wallet-popup-body label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0.8;
  margin-bottom: 5px;
}


/* =========================================================
   RIGHT COLUMN — PASS PREVIEW ONLY
========================================================= */

.wallet-preview-col {
  display: flex;
  justify-content: flex-end;
}

/* Preview uses CSS variables set by JS from color pickers */
.wallet-pass-preview,
.coupon-preview {
  --wallet-bg: rgb(0, 0, 0);
  --wallet-fg: rgb(255, 255, 255);
  --wallet-label: rgb(200, 200, 200);

  width: 320px;
  border-radius: 22px;
  overflow: hidden;

  background-color: var(--wallet-bg);
  color: var(--wallet-fg);

  box-shadow:
    0 16px 36px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(0,0,0,.08);
}

/* Header */
.pass-header {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 10px 14px;
  height: 56px;
  box-sizing: border-box;
}

/* Banner */
.pass-banner {
  height: 110px;
  position: relative;
  background: var(--wallet-bg);
}

.pass-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.banner-hint {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  color: var(--wallet-label);
  opacity: 0.9;
}

/* Offer — main text uses foreground */
.pass-primary {
  text-align: center;
  font-weight: 800;
  font-size: 22px;
  line-height: 1.2;
  color: var(--wallet-fg);

  padding: 16px 16px 10px;
  margin: 0 auto;
}

/* Secondary text and labels use label color */
.pass-secondary,
.coupon-preview .label {
  color: var(--wallet-label);
  padding: 6px 14px;
  font-size: 12px;
  white-space: pre-line;
}

/* Barcode area — QR or placeholder */
.pass-barcode {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 18px;
  min-height: 150px;
}

.pass-barcode-placeholder {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--wallet-label);
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

.pass-barcode-pdf417 { border-color: rgba(255, 170, 60, 0.4); }
.pass-barcode-aztec  { border-color: rgba(255, 170, 60, 0.4); }


/* =========================================================
   DATE INPUT — FORCE NATIVE PICKER
========================================================= */

.coupon-form input[type="date"] {
  appearance: auto;
  -webkit-appearance: auto;

  background: #ffffff;
  color: #111;

  border-radius: 8px;
  padding: 6px 34px 6px 10px;
  height: 36px;
  line-height: 36px;

  cursor: pointer;
}


/* =========================================================
   Logo and Banner handling for preview
========================================================= */
/* Logo container in pass header */
.pass-logo-box {
  width: 44px;
  height: 44px;

  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.pass-logo-box img {
  width: 100%;
  height: 100%;

  object-fit: contain;
  display: block;
}


#pass-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;

  flex: 1;              /* 🔑 title owns remaining space */
  min-width: 0;         /* allows text truncation */

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-box {
  width: 100%;
  max-width: 320px;   /* wallet width */
  height: 110px;      /* banner height */
  max-height: 110px;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.banner-box img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;

  object-fit: contain;
  display: block;
}

.form-status {
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.85;
  color: #ffb55a;
}

/* Chrome / Edge / Safari calendar icon */
.coupon-form input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  display: block;
  cursor: pointer;
  filter: none;
}

