/* =========================================================
   STOREFRONT INVOICE
   ========================================================= */

.storefront-invoice-page {
  min-height: calc(100vh - 72px);
  background:
    radial-gradient(
      circle at 15% 12%,
      rgba(220, 227, 215, 0.5),
      transparent 25rem
    ),
    radial-gradient(
      circle at 88% 76%,
      rgba(239, 227, 206, 0.34),
      transparent 28rem
    ),
    linear-gradient(
      150deg,
      var(--store-bg) 0%,
      #F7F3EC 56%,
      var(--store-bg-soft) 100%
    );
}

.storefront-invoice-card {
  padding: 1.75rem;
  border: 1px solid rgba(204, 200, 189, 0.76);
  border-radius: 1.5rem;
  background: rgba(251, 248, 242, 0.92);
  box-shadow:
    0 20px 48px rgba(68, 77, 67, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
}

.storefront-invoice-label {
  color: var(--store-primary-hover);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.storefront-invoice-token {
  margin-top: 0.3rem;
  color: var(--store-text);
  font-size: 1.15rem;
  font-weight: 800;
}

.storefront-invoice-status {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.storefront-invoice-status.is-success {
  color: #60755e;
  border: 1px solid rgba(135, 151, 130, 0.3);
  background: rgba(229, 238, 226, 0.94);
}

.storefront-invoice-status.is-pending {
  color: #987a49;
  border: 1px solid rgba(194, 161, 106, 0.3);
  background: rgba(239, 227, 206, 0.9);
}

.storefront-invoice-status.is-danger {
  color: #9c625e;
  border: 1px solid rgba(184, 117, 112, 0.28);
  background: rgba(244, 225, 222, 0.92);
}

.storefront-invoice-status.is-neutral {
  color: var(--store-text-soft);
  border: 1px solid var(--store-border);
  background: rgba(234, 230, 220, 0.78);
}

.storefront-invoice-copy-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--store-border);
  border-radius: 0.75rem;
  background: rgba(247, 243, 236, 0.85);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.storefront-invoice-copy-button:hover {
  border-color: rgba(135, 151, 130, 0.58);
  background: var(--store-surface);
}

.storefront-invoice-copy-value {
  color: var(--store-text-soft);
  font-size: 0.7rem;
}

.storefront-invoice-copy-action {
  flex-shrink: 0;
  color: var(--store-primary-hover);
  font-size: 0.7rem;
  font-weight: 800;
}

.storefront-invoice-summary {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--store-border);
  font-size: 0.82rem;
}

.storefront-invoice-summary-label {
  color: var(--store-text-muted);
}

.storefront-invoice-summary-value {
  color: var(--store-text);
  font-weight: 700;
  text-align: right;
}


.storefront-invoice-total {
  color: var(--store-primary-hover);
  font-size: 1rem;
  font-weight: 800;
}

.storefront-invoice-countdown {
  color: var(--store-text);
  font-size: 0.8rem;
  font-weight: 800;
}

.storefront-qris-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--store-border);
}

.storefront-qris-title {
  margin-bottom: 0.85rem;
  color: var(--store-text);
  font-size: 1.2rem;
  font-weight: 600;
}

.storefront-sandbox-notice {
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(194, 161, 106, 0.28);
  border-radius: 0.75rem;
  color: #917343;
  background: rgba(239, 227, 206, 0.62);
  font-size: 0.68rem;
  line-height: 1.6;
}

.storefront-sandbox-notice code {
  font-size: 0.64rem;
}

.storefront-qris-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.35rem;
  border: 1px solid rgba(204, 200, 189, 0.8);
  border-radius: 1rem;
  background: #fffdf9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.storefront-qris-wrap #qrcode {
  padding: 0.45rem;
  border-radius: 0.6rem;
  background: #fff;
}

.storefront-qris-fallback {
  color: var(--store-text-soft);
  font-size: 0.65rem;
  line-height: 1.5;
  text-align: center;
}

.storefront-qris-instruction {
  max-width: 25rem;
  color: var(--store-text-soft);
  font-size: 0.7rem;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 639px) {
  .storefront-invoice-card {
    padding: 1.25rem;
    border-radius: 1.15rem;
  }

  .storefront-invoice-token {
    max-width: 15rem;
    font-size: 0.92rem;
  }

  .storefront-invoice-summary {
    font-size: 0.75rem;
  }

  .storefront-invoice-summary > div {
    gap: 1rem;
  }

  .storefront-invoice-summary-value {
    max-width: 58%;
  }

  .storefront-qris-wrap {
    padding: 1rem;
  }

  .storefront-qris-wrap #qrcode,
  .storefront-qris-wrap #qrcode canvas,
  .storefront-qris-wrap #qrcode img {
    max-width: 100%;
    height: auto !important;
  }
}

/* Paid invoice success panel */

.storefront-purchase-success {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.1rem;
  padding: 1.1rem;
  border: 1px solid rgba(135, 151, 130, 0.3);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(238, 242, 234, 0.96), rgba(249, 247, 241, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.storefront-purchase-success-icon {
  display: inline-flex;
  width: 3.25rem;
  height: 3.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(105, 130, 101, 0.35);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(145deg, var(--store-primary), var(--store-primary-hover));
  box-shadow: 0 0.55rem 1.2rem rgba(74, 92, 71, 0.16);
}

.storefront-purchase-success-icon svg {
  width: 1.7rem;
  height: 1.7rem;
}

.storefront-purchase-success-title {
  color: var(--store-text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.storefront-purchase-success-text {
  margin-top: 0.28rem;
  color: var(--store-text-soft);
  font-size: 0.74rem;
  line-height: 1.65;
}

.storefront-purchase-success-button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  color: #fff;
  background: var(--store-primary);
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 0.45rem 1rem rgba(74, 92, 71, 0.14);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.storefront-purchase-success-button:hover {
  transform: translateY(-1px);
  background: var(--store-primary-hover);
}

.storefront-purchase-success-button svg {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 639px) {
  .storefront-purchase-success {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .storefront-purchase-success-icon {
    margin-inline: auto;
  }

  .storefront-purchase-success-button {
    width: 100%;
  }
}

/* Invoice delivery and status detail */

.storefront-invoice-detail {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--store-border);
}

.storefront-invoice-detail-title {
  color: var(--store-text);
  font-size: 1.15rem;
  font-weight: 600;
}

.storefront-delivery-card {
  margin-bottom: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--store-border);
  border-radius: 0.9rem;
  background: rgba(247, 243, 236, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
}

.storefront-delivery-card > * + * {
  margin-top: 0.7rem;
}

.storefront-delivery-unit-label {
  color: var(--store-primary-hover);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.storefront-delivery-key {
  color: var(--store-text-muted);
}

.storefront-delivery-value {
  color: var(--store-text);
  font-weight: 700;
}

.storefront-delivery-link {
  color: var(--store-primary-hover);
  font-weight: 750;
  transition: color 0.2s ease;
}

.storefront-delivery-link:hover {
  color: var(--store-primary);
}

.storefront-invoice-message {
  color: var(--store-text-soft);
  font-size: 0.8rem;
  line-height: 1.75;
}

.storefront-invoice-hidden-count {
  margin-bottom: 0.8rem;
  color: var(--store-text-muted);
  font-size: 0.68rem;
}

.storefront-copy-all-button {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(135, 151, 130, 0.28);
  border-radius: 0.8rem;
  color: var(--store-primary-hover);
  background: rgba(220, 227, 215, 0.58);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease;
}

.storefront-copy-all-button:hover {
  transform: translateY(-1px);
  border-color: rgba(135, 151, 130, 0.5);
  background: rgba(220, 227, 215, 0.82);
}

.storefront-invoice-support {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--store-border);
  text-align: center;
}

.storefront-invoice-support-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--store-primary-hover);
  font-size: 0.8rem;
  font-weight: 750;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.storefront-invoice-support-link:hover {
  color: var(--store-primary);
  transform: translateY(-1px);
}

@media (max-width: 639px) {
  .storefront-delivery-card {
    padding: 0.85rem;
    font-size: 0.74rem;
  }

  .storefront-delivery-card .flex {
    gap: 0.75rem;
  }

  .storefront-delivery-key {
    max-width: 38%;
  }

  .storefront-delivery-value,
  .storefront-delivery-link {
    max-width: 62%;
  }

  .storefront-invoice-message {
    font-size: 0.75rem;
  }
}

/* Final storefront mobile safeguards */

@media (max-width: 639px) {
  .storefront-invoice-copy-button {
    width: 100%;
  }

  .storefront-invoice-token {
    overflow-wrap: anywhere;
  }

  .storefront-invoice-summary > div {
    align-items: flex-start;
  }

  .storefront-invoice-countdown {
    max-width: 58%;
    text-align: right;
  }

  .storefront-qris-wrap {
    overflow: hidden;
  }

  .storefront-qris-wrap canvas,
  .storefront-qris-wrap img {
    width: min(220px, 100%) !important;
    height: auto !important;
  }


  .storefront-checkout-button {
    touch-action: manipulation;
  }
}

.storefront-qris-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(184, 115, 89, 0.22);
  border-radius: 0.85rem;
  background: rgba(250, 242, 238, 0.78);
  text-align: center;
}

.storefront-qris-state.hidden {
  display: none;
}

.storefront-qris-state-message {
  color: var(--store-text-soft);
  font-size: 0.72rem;
  line-height: 1.6;
}

.storefront-qris-retry-button {
  min-width: 8.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(84, 112, 91, 0.28);
  border-radius: 0.75rem;
  background: var(--store-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.storefront-qris-retry-button:hover:not(:disabled) {
  background: var(--store-primary-hover);
  transform: translateY(-1px);
}

.storefront-qris-retry-button:disabled {
  cursor: wait;
  opacity: 0.62;
}
