/* Dual staff sheet: screen 800×640px; print fits upper half A4 portrait (210×148.5mm). */

.sgm-receipt-print {
  padding: 16px;
}

.sgm-receipt-sheet {
  --sgm-receipt-width: 800px;
  --sgm-receipt-height: 640px;
  --sgm-slip-left-width: 402px;
  --sgm-slip-gap: 16px;
  --sgm-slip-right-left: 410px;
  --sgm-slip-right-width: 390px;
  position: relative;
  width: var(--sgm-receipt-width);
  height: var(--sgm-receipt-height);
  margin: 0 auto;
  background-position: left top;
  background-repeat: no-repeat;
  background-size: var(--sgm-receipt-width) var(--sgm-receipt-height);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.sgm-receipt-slip {
  position: absolute;
  top: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sgm-receipt-slip--left {
  left: 0;
  width: var(--sgm-slip-left-width);
}

.sgm-receipt-slip--right {
  left: var(--sgm-slip-right-left);
  width: var(--sgm-slip-right-width);
  padding-left: 0;
}

/* Right copy aligned to pre-printed form on background */
.sgm-receipt-slip--right .sgm-receipt-value {
  transform: translateX(1.25%);
}

.sgm-receipt-value {
  position: absolute;
  margin: 0;
  font-family: "Mukta", sans-serif;
  color: #17357f;
  line-height: 1.2;
}

.sgm-receipt-value__label {
  font-weight: 700;
}

/* Donor band */
.sgm-receipt-value--receipt-no {
  top: 25.2%;
  left: 4%;
  font-size: 14px;
  font-weight: 600;
}

.sgm-receipt-value--date {
  top: 25.2%;
  left: 64%;
  font-size: 14px;
  font-weight: 600;
}

.sgm-receipt-value--donor {
  top: 29%;
  left: 4%;
  width: 92%;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sgm-receipt-value--address {
  top: 33%;
  left: 4%;
  width: 92%;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

/* Rupees column */
.sgm-receipt-value--amount {
  left: 50%;
  width: 46%;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.sgm-receipt-value--row-1 {
  top: 45.4%;
}

.sgm-receipt-value--row-2 {
  top: 53.4%;
}

.sgm-receipt-value--row-3 {
  top: 61%;
}

.sgm-receipt-value--row-4 {
  top: 68.5%;
}

.sgm-receipt-value--total {
  top: 74.4%;
  left: 50%;
  width: 46%;
  font-size: 16px;
  font-weight: 700;
  text-align: right;
}

.sgm-receipt-value--remarks {
  top: 75.5%;
  left: 4%;
  width: 92%;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  text-align: left;
  overflow: hidden;
  max-height: 14.5%;
}

/* Lavender footer band */
.sgm-receipt-value--words {
  top: 92%;
  left: 4%;
  width: 52%;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.sgm-receipt-value--receiver {
  top: 92%;
  left: 58%;
  width: 36%;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.sgm-receipt-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 800px;
  margin: 18px auto 0;
}

.sgm-receipt-toolbar__btn,
.sgm-receipt-toolbar__link {
  display: inline-block;
  padding: 10px 18px;
  border: 0;
  background: #ff6908;
  color: #333333;
  font-family: "Mukta", sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

.sgm-receipt-toolbar__btn:hover,
.sgm-receipt-toolbar__link:hover {
  background: #ff7e2b;
  color: #333333;
}

.sgm-receipt__message {
  max-width: 720px;
  margin: 24px auto;
  padding: 12px 14px;
  font-family: "Mukta", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #6c1919;
  background: rgba(255, 105, 8, 0.1);
  border-left: 4px solid #6c1919;
}

body.sgm-receipt-page .entry-content,
body.sgm-receipt-page .wp-block-post-content {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

/* Public donor copy: left slip only (402×640px) */
.sgm-receipt-print--public {
  max-width: 402px;
  margin: 0 auto;
  padding: 16px;
}

.sgm-receipt-sheet--donor {
  --sgm-receipt-width: 800px;
  --sgm-receipt-height: 640px;
  width: 402px;
  height: 640px;
  overflow: hidden;
  background-position: left top;
  background-size: var(--sgm-receipt-width) var(--sgm-receipt-height);
}

.sgm-receipt-sheet--donor .sgm-receipt-slip--left {
  position: relative;
  left: auto;
  width: 100%;
  padding-left: 0;
}

.sgm-receipt-toolbar--public {
  max-width: 402px;
}

@media screen and (max-width: 440px) {
  .sgm-receipt-print--public,
  .sgm-receipt-sheet--donor {
    width: 100%;
    max-width: 402px;
  }

  .sgm-receipt-sheet--donor {
    height: auto;
    aspect-ratio: 402 / 640;
    background-size: 199% 100%;
  }
}

@media screen and (max-width: 840px) {
  .sgm-receipt-sheet:not(.sgm-receipt-sheet--donor) {
    width: 100%;
    max-width: 800px;
    height: auto;
    aspect-ratio: 800 / 640;
  }
}

@media print {
  @page {
    /* size: 210mm 297mm; */
    margin: 0;
  }

  html,
  body.sgm-receipt-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  body.sgm-receipt-page .sgm-header,
  body.sgm-receipt-page .sgm-footer,
  body.sgm-receipt-page .no-print,
  body.sgm-receipt-page .sgm-receipt-toolbar {
    display: none !important;
  }

  /* Staff: dual receipt on upper half of A4 portrait (210 × 148.5 mm) */
  body.sgm-receipt-page:not(.sgm-receipt-page--public) {
    width: 210mm !important;
    height: 297mm !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .entry-content,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .wp-block-post-content,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) article,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) main,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .site-main,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) #primary,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) #content,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .content-area,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .wp-site-blocks,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .wp-block-group {
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    max-width: none !important;
    border: 0 !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-print {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 210mm !important;
    height: 148.5mm !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 9999;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-sheet {
    width: 210mm !important;
    height: 148.5mm !important;
    max-width: none;
    margin: 0 !important;
    box-shadow: none;
    overflow: hidden;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-position: left top !important;
    background-size: 210mm 148.5mm !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-slip--left {
    left: 0 !important;
    width: 50.25% !important;
    padding-left: 0 !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-slip--right {
    left: 51.25% !important;
    width: 48.75% !important;
    padding-left: 0 !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--receipt-no,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--date,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--donor,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--address,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--words,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--remarks {
    font-size: 3.6mm !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--donor {
    font-size: 3.8mm !important;
  }

  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--amount,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--total,
  body.sgm-receipt-page:not(.sgm-receipt-page--public) .sgm-receipt-value--receiver {
    font-size: 4mm !important;
  }

  /* Public: single slip (unchanged sizing) */
  body.sgm-receipt-page--public {
    width: 100% !important;
    min-height: 100vh !important;
    height: auto !important;
  }

  body.sgm-receipt-page--public .entry-content,
  body.sgm-receipt-page--public .wp-block-post-content,
  body.sgm-receipt-page--public article,
  body.sgm-receipt-page--public main,
  body.sgm-receipt-page--public .site-main,
  body.sgm-receipt-page--public #primary,
  body.sgm-receipt-page--public #content,
  body.sgm-receipt-page--public .content-area,
  body.sgm-receipt-page--public .wp-site-blocks,
  body.sgm-receipt-page--public .wp-block-group {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    border: 0 !important;
    text-align: center !important;
  }

  body.sgm-receipt-page--public .sgm-receipt-print {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 402px !important;
    height: 640px !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 9999;
  }

  body.sgm-receipt-page--public .sgm-receipt-sheet--donor {
    width: 402px !important;
    height: 640px !important;
    margin: 0 !important;
    box-shadow: none;
    overflow: hidden;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background-repeat: no-repeat !important;
    background-size: 800px 640px !important;
    background-position: left top !important;
  }
}
