/* =========================================================
   Receipt Modal - Upgraded Premium Glass Theme
   ========================================================= */
:root {
  --receipt-glass-bg: rgba(255, 255, 255, 0.78);
  --receipt-glass-bg-soft: rgba(255, 255, 255, 0.62);
  --receipt-glass-border: rgba(255, 255, 255, 0.7);
  --receipt-shadow: 0 32px 80px rgba(15, 23, 42, 0.24);
  --receipt-card-bg: rgba(248, 250, 252, 0.94);
  --receipt-card-border: rgba(226, 232, 240, 0.95);
  --receipt-paper-bg: #ffffff;
  --receipt-paper-border: rgba(226, 232, 240, 0.88);
  --receipt-text-strong: #0f172a;
  --receipt-text-muted: #64748b;
  --receipt-accent: #2563eb;
  --receipt-radius: 24px;
}

/* better bootstrap backdrop handling */
.modal-backdrop.show {
  background-color: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* modal wrapper */
.receipt-modal {
  --receipt-modal-pad-top: clamp(16px, 5vh, 56px);
  --receipt-modal-pad-bottom: clamp(24px, 10vh, 96px);
  --receipt-modal-pad-x: clamp(12px, 2vw, 24px);
  top: 0 !important;
  inset: 0 !important;
  padding: var(--receipt-modal-pad-top) var(--receipt-modal-pad-x) var(--receipt-modal-pad-bottom);
  background: transparent;
  overflow-y: auto;
  display: block;
}

.modal-open .receipt-modal {
  background: transparent !important;
}

.receipt-modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.receipt-modal .modal-dialog {
  width: min(700px, 100%);
  max-width: min(700px, 94vw);
  min-height: 0;
  margin: 0;
  padding: 0;
  display: block;
}

.receipt-modal .modal-dialog-centered {
  min-height: 0;
  align-items: stretch;
}

/* modal panel */
.receipt-modal .modal-content {
  width: 100%;
  min-height: min(520px, 68vh);
  max-height: calc(100vh - var(--receipt-modal-pad-top) - var(--receipt-modal-pad-bottom));
  background: linear-gradient(160deg, var(--receipt-glass-bg), var(--receipt-glass-bg-soft));
  border: 1px solid var(--receipt-glass-border);
  border-radius: var(--receipt-radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--receipt-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* soft glossy layer */
.receipt-modal .modal-content::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.1) 28%,
    rgba(255, 255, 255, 0.02) 100%
  );
  z-index: 0;
}

/* content sits above overlay */
.receipt-modal .modal-header,
.receipt-modal .modal-body,
.receipt-modal .modal-footer {
  position: relative;
  z-index: 1;
}

/* header/footer */
.receipt-modal .modal-header,
.receipt-modal .modal-footer {
  border: 0;
  background: transparent;
}

/* header */
.receipt-modal .modal-header {
  padding: 1.2rem 1.4rem 0.8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: start;
}

.receipt-modal__heading {
  min-width: 0;
}

.receipt-modal__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--receipt-text-strong);
}

.receipt-modal__subtitle {
  margin: 0.28rem 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--receipt-text-muted);
}

/* status badge */
.receipt-status {
  align-self: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
}

.receipt-status.is-success {
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.2);
}

.receipt-status.is-pending {
  background: rgba(234, 179, 8, 0.12);
  color: #a16207;
  border-color: rgba(234, 179, 8, 0.28);
}

.receipt-status.is-failed {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.22);
}

.receipt-status.is-neutral {
  background: rgba(148, 163, 184, 0.16);
  color: #475569;
  border-color: rgba(148, 163, 184, 0.28);
}

/* close button */
.receipt-close.btn-close {
  opacity: 1;
  margin: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background-color: rgba(255, 255, 255, 0.95);
  background-size: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  filter: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.receipt-close.btn-close:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

/* body */
.receipt-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 1.4rem 1rem;
  gap: 0.8rem;
}

/* preview card */
.receipt-card {
  flex: 1 1 auto;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--receipt-card-bg);
  border: 1px solid var(--receipt-card-border);
  border-radius: 20px;
  padding: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 16px 40px rgba(15, 23, 42, 0.08);
}

/* receipt paper area */
.receipt-card__inner {
  flex: 1 1 420px;
  width: min(420px, 100%);
  background: var(--receipt-paper-bg);
  border-radius: 16px;
  border: 1px solid var(--receipt-paper-border);
  overflow: hidden;
  box-shadow:
    0 18px 34px rgba(15, 23, 42, 0.08),
    0 3px 10px rgba(15, 23, 42, 0.05);
}

/* receipt frame */
.receipt-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: 0;
  background: #fff;
}

/* footer actions */
.receipt-actions {
  flex-shrink: 0;
  padding: 0.9rem 1.4rem 1.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(255,255,255,0.92), rgba(255,255,255,0.68));
  border-top: 1px solid rgba(226, 232, 240, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.receipt-actions .btn {
  min-height: 44px;
  border-radius: 999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.receipt-actions .btn:hover {
  transform: translateY(-1px);
}

.receipt-actions .receipt-action-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.05rem;
}

.receipt-actions .btn-primary {
  background: linear-gradient(180deg, #3b82f6, var(--receipt-accent));
  border-color: var(--receipt-accent);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.receipt-actions .btn-outline-secondary {
  border-color: rgba(148, 163, 184, 0.55);
  color: #475569;
  background: rgba(255, 255, 255, 0.78);
}

.receipt-actions .btn-outline-success {
  border-color: rgba(16, 185, 129, 0.45);
  color: #047857;
  background: rgba(255, 255, 255, 0.78);
}

.receipt-actions .btn-outline-warning {
  border-color: rgba(245, 158, 11, 0.45);
  color: #b45309;
  background: rgba(255, 255, 255, 0.78);
}

.receipt-actions .btn-outline-primary {
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
  background: rgba(255, 255, 255, 0.78);
}

/* tablet */
@media (max-width: 768px) {
  .receipt-modal .modal-dialog {
    width: min(96vw, 680px);
    padding: 0;
  }

  .receipt-modal .modal-content {
    min-height: min(480px, 70vh);
    max-height: calc(100vh - var(--receipt-modal-pad-top) - var(--receipt-modal-pad-bottom));
    border-radius: 22px;
  }

  .receipt-modal .modal-header {
    padding: 1rem 1.1rem 0.75rem;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .receipt-status {
    grid-column: 1 / 2;
    justify-self: start;
    align-self: start;
    margin-top: 0.1rem;
  }

  .receipt-close.btn-close {
    grid-column: 2 / 3;
    grid-row: 1 / span 2;
    justify-self: end;
  }

  .receipt-modal .modal-body {
    padding: 0 1.1rem 0.9rem;
  }

  .receipt-actions {
    padding: 0.85rem 1.1rem 1.1rem;
    justify-content: center;
  }

  .receipt-frame {
    min-height: 260px;
  }
}

/* phone */
@media (max-width: 576px) {
  .receipt-modal .modal-dialog {
    width: calc(100vw - 10px);
    min-height: 0;
    padding: 0;
  }

  .receipt-modal .modal-content {
    min-height: min(420px, 70vh);
    max-height: calc(100vh - var(--receipt-modal-pad-top) - var(--receipt-modal-pad-bottom));
    border-radius: 18px;
  }

  .receipt-modal .modal-header {
    padding: 0.95rem 0.95rem 0.7rem;
    gap: 0.55rem;
  }

  .receipt-modal__title {
    font-size: 1rem;
  }

  .receipt-modal__subtitle {
    font-size: 0.82rem;
  }

  .receipt-modal .modal-body {
    padding: 0 0.95rem 0.8rem;
  }

  .receipt-card {
    padding: 0.75rem;
    border-radius: 16px;
  }

  .receipt-card__inner {
    width: 100%;
    border-radius: 14px;
  }

  .receipt-frame {
    min-height: 240px;
  }

  .receipt-actions {
    padding: 0.8rem 0.95rem 0.95rem;
    gap: 0.6rem;
    justify-content: center;
  }

  .receipt-actions .btn:not(.receipt-action-icon) {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 120px;
  }
}

@media (max-height: 720px) {
  .receipt-modal.show {
    align-items: flex-start;
  }
}

@media print {
  .receipt-modal,
  .modal-backdrop {
    display: none !important;
  }
}
