/* ============================================================
   OpenFinClaw Compute — Checkout Flow Stylesheet
   Payment success modal, cancel page, renewal failure banner
   ============================================================ */

/* ─── 1. Checkout Success Modal ─────────────────────────────── */

.checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.checkout-overlay.visible {
  display: flex;
  animation: checkoutOverlayIn 0.4s ease;
}

@keyframes checkoutOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.checkout-modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: checkoutModalIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkoutModalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Glow halo behind the modal ── */
.checkout-modal::before {
  content: '';
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(0, 212, 170, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Success icon area ── */
.checkout-icon-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0 8px;
}

.checkout-icon-ring {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 184, 148, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-icon-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--accent) 0%,
    transparent 30%,
    transparent 70%,
    var(--accent-end) 100%
  );
  opacity: 0;
  animation: ringReveal 1s 0.3s ease forwards;
}

@keyframes ringReveal {
  from { opacity: 0; transform: rotate(-90deg); }
  to   { opacity: 0.6; transform: rotate(0deg); }
}

.checkout-icon-ring::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--bg-card);
}

.checkout-icon-check {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.5);
  animation: checkPop 0.5s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes checkPop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Particle burst ── */
.checkout-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.checkout-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  top: 50%;
  left: 50%;
  opacity: 0;
  animation: particleBurst 1.2s 0.6s ease-out forwards;
}

.checkout-particle:nth-child(1) { --dx: -60px; --dy: -70px; animation-delay: 0.6s; }
.checkout-particle:nth-child(2) { --dx:  50px; --dy: -55px; animation-delay: 0.65s; }
.checkout-particle:nth-child(3) { --dx: -40px; --dy:  60px; animation-delay: 0.7s; }
.checkout-particle:nth-child(4) { --dx:  65px; --dy:  40px; animation-delay: 0.75s; width: 3px; height: 3px; background: var(--accent-end); }
.checkout-particle:nth-child(5) { --dx: -70px; --dy:  10px; animation-delay: 0.68s; width: 3px; height: 3px; }
.checkout-particle:nth-child(6) { --dx:  20px; --dy: -75px; animation-delay: 0.72s; background: var(--accent-end); }
.checkout-particle:nth-child(7) { --dx:  70px; --dy: -10px; animation-delay: 0.78s; width: 2px; height: 2px; }
.checkout-particle:nth-child(8) { --dx: -25px; --dy: -60px; animation-delay: 0.66s; width: 2px; height: 2px; background: var(--accent-end); }

@keyframes particleBurst {
  0%   { opacity: 0; transform: translate(0, 0) scale(0); }
  20%  { opacity: 1; transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.3)) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}

/* ── Modal body content ── */
.checkout-body {
  position: relative;
  z-index: 1;
  padding: 16px 32px 32px;
  text-align: center;
}

.checkout-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.checkout-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ── Order summary card ── */
.checkout-summary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 28px;
}

.checkout-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.checkout-summary-row + .checkout-summary-row {
  border-top: 1px solid var(--border-subtle);
}

.checkout-summary-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.checkout-summary-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.checkout-summary-value.highlight {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
}

.checkout-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 170, 0.2);
}

/* ── CTA buttons ── */
.checkout-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkout-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  color: var(--bg-primary);
  box-shadow: 0 4px 20px rgba(0, 212, 170, 0.25);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
}

.checkout-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(0, 212, 170, 0.4);
}

.checkout-btn-primary:active {
  transform: translateY(0);
}

.checkout-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 32px;
  background: transparent;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  text-decoration: none;
}

.checkout-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ── Footer note ── */
.checkout-footer-note {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.checkout-footer-note svg {
  display: inline;
  vertical-align: -2px;
  margin-right: 4px;
}

/* ── Close button (top-right) ── */
.checkout-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.checkout-close:hover {
  color: var(--text-primary);
  border-color: var(--border-card);
}


/* ─── 2. Checkout Cancel Banner (Pricing page) ──────────────── */

.checkout-cancel-banner {
  display: none;
  max-width: var(--max-width);
  margin: 0 auto 32px;
  padding: 28px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  animation: cancelBannerIn 0.4s ease;
}

.checkout-cancel-banner.visible {
  display: block;
}

@keyframes cancelBannerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.checkout-cancel-inner {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.checkout-cancel-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 180, 50, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-cancel-icon svg {
  width: 24px;
  height: 24px;
  color: #ffb432;
}

.checkout-cancel-content {
  flex: 1;
}

.checkout-cancel-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.checkout-cancel-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.checkout-cancel-reasons {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.checkout-cancel-reasons li {
  position: relative;
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.checkout-cancel-reasons li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.checkout-cancel-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.checkout-cancel-help {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.checkout-cancel-help a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.checkout-cancel-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.checkout-cancel-dismiss:hover {
  color: var(--text-primary);
}


/* ─── 3. Payment Failed Banner (Dashboard top) ──────────────── */

.payment-failed-banner {
  display: none;
  position: relative;
  background: linear-gradient(135deg, rgba(255, 160, 40, 0.08), rgba(255, 120, 20, 0.04));
  border: 1px solid rgba(255, 160, 40, 0.2);
  border-radius: var(--radius-md);
  margin: 0 0 20px;
  padding: 16px 20px;
  animation: failedBannerIn 0.4s ease;
}

.payment-failed-banner.visible {
  display: block;
}

@keyframes failedBannerIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.payment-failed-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.payment-failed-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 160, 40, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.payment-failed-icon svg {
  width: 18px;
  height: 18px;
  color: #ffa028;
}

.payment-failed-text {
  flex: 1;
  min-width: 200px;
}

.payment-failed-msg {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.payment-failed-countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #ffa028;
  font-family: var(--font-mono);
  font-weight: 500;
}

.payment-failed-countdown svg {
  width: 12px;
  height: 12px;
}

.payment-failed-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: rgba(255, 160, 40, 0.12);
  border: 1px solid rgba(255, 160, 40, 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffa028;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.payment-failed-cta:hover {
  background: rgba(255, 160, 40, 0.2);
  transform: translateY(-1px);
  opacity: 1;
  color: #ffa028;
}

.payment-failed-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.payment-failed-close:hover {
  color: var(--text-primary);
}


/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 600px) {
  .checkout-modal {
    max-width: 100%;
    border-radius: var(--radius-md);
  }

  .checkout-body {
    padding: 16px 20px 28px;
  }

  .checkout-title {
    font-size: 1.25rem;
  }

  .checkout-cancel-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .checkout-cancel-actions {
    flex-direction: column;
    width: 100%;
  }

  .checkout-cancel-actions .btn {
    width: 100%;
  }

  .payment-failed-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .payment-failed-cta {
    width: 100%;
    justify-content: center;
  }
}
