/* ==========================================================================
   Commercial Bank of Ethiopia (CBE) - Official Receipt Stylesheet
   Faithful 1:1 match to https://mbreciept.cbe.com.et/v2-hfHCxGJTdsWqFjNt5h3D
   Perfect Responsiveness Across All Devices (Mobile, Tablet, Desktop)
   ========================================================================== */

/* Design Tokens */
:root {
  --cbe-primary: #83257a;
  --cbe-primary-hover: #6d2066;
  --cbe-status-green: #86efac;
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --bg-subtle: #f9fafb;
  --text-dark: #111827;
  --text-body: #1f2937;
  --text-muted: #4b5563;
  --text-light: #6b7280;
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-btn: 0 4px 14px rgba(131, 37, 122, 0.35);
  --radius-card: 12px;
  --radius-box: 8px;
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 6px 85px;
}

@media (min-width: 640px) {
  body {
    padding: 16px 12px 90px;
  }
}

@media (min-width: 768px) {
  body {
    padding: 24px 16px 100px;
  }
}

/* ==========================================================================
   PAGE WRAPPER & RECEIPT CARD
   Matches original max-w-3xl (768px)
   ========================================================================== */
.receipt-page {
  width: 100%;
  display: flex;
  justify-content: center;
}

.receipt-card {
  width: 100%;
  max-width: 768px;
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   RECEIPT HEADER BANNER
   Exact CBE Purple (#83257a)
   ========================================================================== */
.receipt-header {
  background-color: var(--cbe-primary);
  color: #ffffff;
  padding: 16px 14px 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .receipt-header {
    padding: 20px 20px 22px;
  }
}

@media (min-width: 768px) {
  .receipt-header {
    padding: 26px 32px 28px;
  }
}

/* Official CBE Emblem on the Left */
.header-logo-container {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .header-logo-container {
    left: 18px;
  }
}

@media (min-width: 768px) {
  .header-logo-container {
    left: 28px;
  }
}

.cbe-emblem {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

@media (min-width: 640px) {
  .cbe-emblem {
    width: 52px;
    height: 52px;
  }
}

@media (min-width: 768px) {
  .cbe-emblem {
    width: 62px;
    height: 62px;
  }
}

/* Centered Header Titles */
.header-title-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 46px; /* Ensures text never overlaps the logo */
}

@media (min-width: 640px) {
  .header-title-container {
    padding: 0 60px;
  }
}

.bank-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.2px;
}

@media (min-width: 640px) {
  .bank-title {
    font-size: 21px;
  }
}

@media (min-width: 768px) {
  .bank-title {
    font-size: 24px;
  }
}

.receipt-type {
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  margin-top: 2px;
  opacity: 0.96;
}

@media (min-width: 640px) {
  .receipt-type {
    font-size: 14px;
    margin-top: 3px;
  }
}

@media (min-width: 768px) {
  .receipt-type {
    font-size: 15px;
  }
}

.status-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--cbe-status-green);
  margin-top: 3px;
}

@media (min-width: 640px) {
  .status-badge {
    font-size: 11px;
    letter-spacing: 0.18em;
    margin-top: 4px;
  }
}

@media (min-width: 768px) {
  .status-badge {
    font-size: 12px;
    letter-spacing: 0.2em;
  }
}

/* ==========================================================================
   RECEIPT CONTENT BODY
   ========================================================================== */
.receipt-content {
  padding: 12px 10px 16px;
}

@media (min-width: 640px) {
  .receipt-content {
    padding: 20px 18px 22px;
  }
}

@media (min-width: 768px) {
  .receipt-content {
    padding: 26px 28px 28px;
  }
}

/* ==========================================================================
   INFORMATION SECTION GRID (Company & Customer Information)
   Always stays 2 parallel columns side-by-side (matching original CBE responsive design)
   ========================================================================== */
.info-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 12px;
  row-gap: 14px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .info-section-grid {
    column-gap: 24px;
    row-gap: 20px;
    margin-bottom: 22px;
  }
}

@media (min-width: 768px) {
  .info-section-grid {
    column-gap: 40px;
    row-gap: 24px;
    margin-bottom: 26px;
  }
}

.info-column {
  width: 100%;
}

.info-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 6px;
  line-height: 1.3;
}

@media (min-width: 480px) {
  .info-header {
    font-size: 12px;
  }
}

@media (min-width: 640px) {
  .info-header {
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 5px;
  }
}

@media (min-width: 768px) {
  .info-header {
    font-size: 14px;
    margin-bottom: 10px;
  }
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table tr td {
  padding: 2px 0;
  vertical-align: top;
  font-size: 10.5px;
  line-height: 1.35;
}

@media (min-width: 480px) {
  .info-table tr td {
    font-size: 11px;
    padding: 2.5px 0;
  }
}

@media (min-width: 640px) {
  .info-table tr td {
    padding: 3px 0;
    font-size: 12px;
    line-height: 1.4;
  }
}

@media (min-width: 768px) {
  .info-table tr td {
    padding: 3.5px 0;
    font-size: 13px;
  }
}

.info-table .lbl {
  color: var(--text-muted);
  font-weight: 400;
  text-align: left;
  padding-right: 4px;
  width: 46%;
}

@media (min-width: 640px) {
  .info-table .lbl {
    padding-right: 10px;
    width: 48%;
  }
}

.info-table .val {
  color: var(--text-body);
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.info-table .customer-name-val {
  font-weight: 600;
  color: var(--text-dark);
}

.info-table .address-val {
  line-height: 1.3;
}

/* ==========================================================================
   PAYMENT / TRANSACTION INFORMATIONS BOX (13 Rows)
   ========================================================================== */
.transaction-box {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-box);
  overflow: hidden;
  background-color: var(--bg-card);
  margin-bottom: 16px;
  position: relative;
}

@media (min-width: 640px) {
  .transaction-box {
    margin-bottom: 20px;
  }
}

.transaction-box-header {
  background-color: var(--bg-subtle);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-dark);
  text-align: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-medium);
}

@media (min-width: 640px) {
  .transaction-box-header {
    font-size: 14px;
    padding: 10px 14px;
  }
}

@media (min-width: 768px) {
  .transaction-box-header {
    font-size: 15px;
    padding: 12px 16px;
  }
}

.transaction-table-container {
  position: relative;
  width: 100%;
}

/* Official CBE Stamp: tilted -28deg, prominently centered over rows 5-9 */
.stamp-overlay-wrapper {
  position: absolute;
  left: 48%;
  top: 52%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.official-cbe-stamp {
  width: clamp(170px, 52vw, 215px);
  height: auto;
  transform: rotate(-28deg);
  opacity: 0.90;
  mix-blend-mode: multiply;
  filter: contrast(1.05);
}

.transaction-table {
  width: 100%;
  border-collapse: collapse;
  position: relative;
  z-index: 1;
}

.transaction-table tr {
  border-bottom: 1px solid var(--border-light);
}

.transaction-table tr:last-child {
  border-bottom: none;
}

.transaction-table td {
  padding: 6px 8px;
  vertical-align: middle;
  line-height: 1.35;
  font-size: 11px;
}

@media (min-width: 480px) {
  .transaction-table td {
    padding: 7px 10px;
    font-size: 11.5px;
  }
}

@media (min-width: 640px) {
  .transaction-table td {
    padding: 8px 14px;
    font-size: 12.5px;
  }
}

@media (min-width: 768px) {
  .transaction-table td {
    padding: 9px 16px;
    font-size: 13.5px;
  }
}

.transaction-table .tx-lbl {
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  width: 52%;
}

.transaction-table .tx-val {
  color: var(--text-dark);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

/* Row 13: Total amount debited */
.transaction-table .total-row {
  background-color: #fafafa;
}

.transaction-table .total-lbl {
  color: var(--text-dark);
  font-weight: 700;
  font-size: 11.5px;
}

@media (min-width: 640px) {
  .transaction-table .total-lbl {
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  .transaction-table .total-lbl {
    font-size: 14px;
  }
}

.transaction-table .total-val {
  color: var(--text-dark);
  font-weight: 700;
  font-size: 12px;
}

@media (min-width: 640px) {
  .transaction-table .total-val {
    font-size: 13.5px;
  }
}

@media (min-width: 768px) {
  .transaction-table .total-val {
    font-size: 14.5px;
  }
}

/* ==========================================================================
   AMOUNT IN WORD & VERIFICATION QR CODE CARD
   Responsive: Centered stacked on mobile, Side-by-side on tablet/desktop
   (Matching original CBE responsive behavior)
   ========================================================================== */
.amount-word-container {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-box);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
  text-align: center;
}

@media (min-width: 640px) {
  .amount-word-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    padding: 14px 20px;
    gap: 16px;
    margin-bottom: 24px;
  }
}

.amount-word-info {
  flex: 1;
  text-align: center;
}

.amount-word-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}

@media (min-width: 640px) {
  .amount-word-label {
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  .amount-word-label {
    font-size: 13.5px;
  }
}

.amount-word-text {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-body);
  line-height: 1.35;
}

@media (min-width: 640px) {
  .amount-word-text {
    font-size: 12.5px;
  }
}

@media (min-width: 768px) {
  .amount-word-text {
    font-size: 13px;
  }
}

.qr-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.qr-code-img {
  width: 72px;
  height: 72px;
  display: block;
}

@media (min-width: 640px) {
  .qr-code-img {
    width: 68px;
    height: 68px;
  }
}

@media (min-width: 768px) {
  .qr-code-img {
    width: 74px;
    height: 74px;
  }
}

/* ==========================================================================
   RECEIPT FOOTER (Slogan & Copyright)
   ========================================================================== */
.receipt-footer {
  text-align: center;
  padding: 4px 0 6px;
}

.footer-slogan {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cbe-primary);
  margin-bottom: 3px;
}

@media (min-width: 640px) {
  .footer-slogan {
    font-size: 13.5px;
    margin-bottom: 4px;
  }
}

@media (min-width: 768px) {
  .footer-slogan {
    font-size: 14px;
  }
}

.footer-copyright {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-light);
}

@media (min-width: 640px) {
  .footer-copyright {
    font-size: 11.5px;
  }
}

@media (min-width: 768px) {
  .footer-copyright {
    font-size: 12px;
  }
}

/* ==========================================================================
   FLOATING "DOWNLOAD PDF" BUTTON
   ========================================================================== */
.download-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
}

.btn-download {
  background-color: var(--cbe-primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .btn-download {
    padding: 10px 24px;
    font-size: 14px;
  }
}

.btn-download:hover {
  background-color: var(--cbe-primary-hover);
  box-shadow: 0 6px 18px rgba(109, 32, 102, 0.45);
}

.btn-download:active {
  transform: scale(0.98);
}

/* ==========================================================================
   OFFICIAL CBE MOBILE RECEIPT LOADER
   Exact 1:1 match to mbreciept.cbe.com.et:
   Pale lavender circular disc (#eae7ee) with rotating gold CBE emblem & "Loading receipt..."
   ========================================================================== */
.cbe-loader-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  user-select: none;
}

.cbe-loader-overlay.cbe-loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cbe-loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Circular Soft Lavender Badge Container (Exact 116px matching original 1:1 scale) */
.cbe-loader-circle {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background-color: #eae7ee;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Official CBE Logo - Circulating 360deg smoothly (Exact 63px = 54% ratio of circle) */
.cbe-loader-spinner {
  width: 63px;
  height: 63px;
  object-fit: contain;
  display: block;
  animation: cbeLogoCirculate 1.8s linear infinite;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

@keyframes cbeLogoCirculate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Official Text: "Loading receipt..." - Plum Purple Tint (#83528b), Exactly 40px gap */
.cbe-loading-text {
  margin-top: 40px;
  font-size: 15.5px;
  font-weight: 500;
  color: #83528b;
  letter-spacing: -0.01em;
  margin-bottom: 0;
  font-family: inherit;
}

.cbe-dots {
  display: inline-block;
  animation: cbeDotsPulse 1.4s infinite;
}

@keyframes cbeDotsPulse {
  0%, 20% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Interactive Replay Helper Cursor on Header Logo */
.header-logo-container {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.header-logo-container:hover {
  transform: scale(1.05);
}

.header-logo-container:active {
  transform: scale(0.95);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(17, 24, 39, 0.92);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
}

.toast-notification.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   PRINT / PDF MEDIA STYLES
   Ensures clean PDF generation without background noise or floating buttons
   ========================================================================== */
@media print {
  body {
    background-color: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .receipt-page {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .receipt-card {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .download-bar,
  #cbeLoader,
  .cbe-loader-overlay {
    display: none !important;
    visibility: hidden !important;
  }

  .official-cbe-stamp {
    mix-blend-mode: normal !important;
  }
}
