/* ============================================================
   checkout.css — AstroVault
   Checkout page. Requires base.css loaded first.
   ============================================================ */

.checkout-page {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 64px);
  padding: 120px 5vw 4rem;
  display: flex;
  justify-content: center;
}

.checkout-card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  height: fit-content;
}

.checkout-loading {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

/* ── PRODUCT SUMMARY ── */
.checkout-product {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.checkout-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  overflow: hidden;
}
.checkout-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.checkout-product-info {
  /* Without this, a flex item's default min-width:auto lets long unbroken
     text (filenames, etc.) force the box wider than its column and spill
     past the card's edge instead of wrapping — this is what fixes it. */
  flex: 1;
  min-width: 0;
}

.checkout-video {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}
.checkout-video video {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: #000;
  object-fit: contain;
}
.checkout-video img {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: #000;
  object-fit: contain;
}

.checkout-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}
.checkout-gallery img {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: #000;
  object-fit: contain;
}

.checkout-bundle-note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--violet-soft);
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.checkout-genre {
  color: var(--violet-soft);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.checkout-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.checkout-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: pre-line;      /* preserve line breaks, same as the admin textarea */
  overflow-wrap: break-word;
  max-height: 6.2em;          /* ~4 lines collapsed */
  overflow: hidden;
  position: relative;
  transition: max-height 0.25s ease;
}
.checkout-desc.expanded {
  max-height: none;
}
.checkout-desc-toggle {
  display: inline-block;
  margin-top: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--violet-soft);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.checkout-desc-toggle:hover {
  color: var(--text);
}

/* ── SUMMARY ROW ── */
.checkout-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.checkout-price {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

/* ── FORM ── */
.checkout-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.checkout-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

.checkout-form input[type="email"],
.checkout-form input[type="text"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  transition: border-color var(--transition);
}
.checkout-form input[type="email"]:focus,
.checkout-form input[type="text"]:focus {
  outline: none;
  border-color: var(--brand-light);
}

.checkout-form select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23B7ADD6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}
.checkout-form select:focus {
  outline: none;
  border-color: var(--brand-light);
}
.checkout-form select option {
  background: var(--surface);
  color: var(--text);
}

.checkout-submit {
  width: 100%;
  justify-content: center;
  margin-bottom: 1rem;
}
.checkout-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.checkout-secure {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.checkout-error {
  color: #F87171;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.75rem;
}

/* ── ERROR STATE ── */
.checkout-error-state {
  text-align: center;
  padding: 1rem 0;
}
.checkout-error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.checkout-error-state h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}
.checkout-error-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── QR PH PAYMENT STATE ── */
.qr-pay-state {
  text-align: center;
  padding: 0.5rem 0 1rem;
}
.qr-instructions {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 1.25rem;
}
.qr-image-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.qr-image {
  width: 320px;
  height: 320px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border, #2a2650);
  background: #fff;
  padding: 10px;
  object-fit: contain;
  object-position: center;
}
.qr-amount {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 1rem;
}
.qr-static-instructions {
  text-align: left;
  background: #1a1730;
  border: 1px solid var(--border, #2a2650);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.qr-static-instructions p {
  margin: 0 0 0.6rem;
}
.qr-static-instructions p:last-child {
  margin-bottom: 0;
}
.qr-static-instructions strong {
  color: var(--text, #fff);
}
.qr-static-instructions ol {
  margin: 0 0 0.6rem;
  padding-left: 1.2rem;
}
.qr-static-instructions li {
  margin-bottom: 0.35rem;
}
.qr-status {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}
.qr-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5c542;
  margin-right: 6px;
  animation: qr-pulse 1.4s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes qr-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
.qr-expired-state {
  margin-bottom: 1.5rem;
}
.qr-expired-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.qr-cancel-link {
  display: inline-block;
  margin-top: 0.5rem;
}

/* ── QR PH PAID STATE ── */
.qr-paid-state {
  text-align: center;
  padding: 1rem 0;
}
.qr-paid-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.qr-paid-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.qr-paid-state .btn-primary {
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .checkout-card {
    padding: 1.75rem;
  }
}
