/* Gift card. Laid out at 856×540 and scaled via --gc-scale, which card.js sets from the
   frame width. Theme colors arrive inline as --gc-bg, --gc-fg and --gc-accent. */

.gc-wrap {
  width: 100%;
  max-width: 856px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

/* The frame reserves the scaled footprint; the card inside is always 856×540 */
.gc-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 856 / 540;
}

.gc {
  --gc-scale: 1;
  --gc-line: color-mix(in srgb, var(--gc-fg) 55%, transparent);
  position: absolute;
  top: 0;
  left: 0;
  width: 856px;
  height: 540px;
  transform: scale(var(--gc-scale));
  transform-origin: 0 0;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 32px;
  background: var(--gc-bg);
  color: var(--gc-fg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 36px 48px 30px;
  display: flex;
  box-shadow: 0 24px 60px rgba(40, 30, 20, 0.16), 0 4px 12px rgba(40, 30, 20, 0.06);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.gc--light {
  box-shadow: 0 24px 60px rgba(40, 30, 20, 0.12), 0 0 0 1px rgba(40, 30, 20, 0.08);
}

.gc--qr {
  gap: 36px;
}

.gc--barcode {
  flex-direction: column;
  justify-content: space-between;
}

.gc-rings {
  position: absolute;
  right: 0;
  top: 0;
  color: var(--gc-accent);
  pointer-events: none;
}

/* ---- Brand ---- */
.gc-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.gc-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gc-accent);
  color: var(--gc-bg);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
}

.gc-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
  box-sizing: border-box;
}

/* Image logo backings */
.gc-logo--bg-none {
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.gc-logo--bg-none img {
  padding: 0;
}

.gc-logo--bg-white {
  background: #ffffff;
}

.gc-logo--bg-black {
  background: #141413;
}

.gc-logo--bg-accent {
  background: var(--gc-accent);
}

.gc-store {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---- Value ---- */
.gc-value-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.gc-kicker {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--gc-accent);
}

.gc-value {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

/* ---- To / From / Message ---- */
.gc-details {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.gc--barcode .gc-details {
  gap: 22px;
}

.gc-names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.gc--barcode .gc-names {
  gap: 32px;
}

.gc-field {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  border-bottom: 1.5px solid var(--gc-line);
  padding-bottom: 8px;
}

.gc--qr .gc-field--message {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.gc-label {
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gc-accent);
}

.gc-name {
  min-width: 0;
  font-size: 28px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gc-message {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.gc--barcode .gc-message {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* ---- Footer line ---- */
.gc-footer {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  opacity: 0.9;
}

.gc-footer a {
  color: inherit;
  text-decoration: none;
}

.gc-footer a:hover {
  text-decoration: underline;
}

/* ---- Layout columns ---- */
.gc-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.gc-side {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}

.gc-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.gc-bottom {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ---- White scan box ---- */
.gc-codebox {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  color: #141413;
}

.gc--light .gc-codebox {
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gc-fg) 14%, transparent);
}

.gc-codebox--qr {
  gap: 10px;
  border-radius: 16px;
  padding: 24px 24px 16px;
}

.gc-codebox--barcode {
  gap: 6px;
  border-radius: 12px;
  padding: 14px 40px 10px;
}

.gc-qr {
  width: 198px;
  height: 198px;
}

.gc-qr img {
  display: block;
  width: 100%;
  height: 100%;
}

.gc-barcode {
  width: 492px;
  height: 96px;
}

/* Stretched to fill the slot; scanners only care about relative bar widths. */
.gc-barcode img {
  display: block;
  width: 100%;
  height: 100%;
}

.gc-codetext {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 198px;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-align: center;
  overflow-wrap: anywhere;
}

.gc-codebox--barcode .gc-codetext {
  flex-direction: row;
  gap: 28px;
  max-width: 492px;
  font-size: 14px;
  letter-spacing: 2px;
}

.gc-pin {
  font-weight: 600;
}

.barcode-render-error {
  font-size: 13px;
  color: #64748b;
  text-align: center;
  padding: 1rem 0;
}

/* ---- Actions under the card (viewer only) ---- */
.gc-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.gc-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-subtle);
}

.gc-action-btn:hover {
  background: #fbfaf8;
  color: var(--text-primary);
  border-color: #d1c9bd;
}

/* ---- Print: real ID-1 card size (85.6 × 54 mm) ---- */
@media print {
  @page {
    margin: 15mm;
  }

  html,
  body {
    background: #ffffff !important;
    background-image: none !important;
  }

  .app-viewer-mode {
    padding: 0 !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    min-height: 0 !important;
  }

  .gc-actions,
  #toastContainer {
    display: none !important;
  }

  .gc-wrap {
    margin: 0 !important;
    width: 85.6mm !important;
  }

  .gc-frame {
    width: 85.6mm !important;
    height: 54mm !important;
  }

  .gc {
    /* 85.6mm / 856px */
    transform: scale(0.3779528) !important;
    box-shadow: none !important;
    border: 1px solid rgba(0, 0, 0, 0.12);
  }
}
