*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0066ff;
  --primary-hover: #0052cc;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.checkout-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  padding: 2.5rem;
}

.checkout-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  margin-bottom: 1.5rem;
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.025em;
}

.checkout-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.938rem;
}

.order-summary {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.order-summary h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.item-details {
  display: flex;
  flex-direction: column;
}

.item-name {
  font-weight: 500;
  color: var(--text);
}

.item-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.item-price {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.order-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.total-amount {
  font-size: 1.25rem;
  color: var(--primary);
}

.subscription-info {
  display: flex;
  gap: 0.75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}

.info-icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.subscription-info strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.subscription-info p {
  font-size: 0.813rem;
  color: var(--text-secondary);
  margin: 0;
}

.checkout-form {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(0 102 255 / 0.1);
}

.form-group input::placeholder {
  color: var(--text-secondary);
}

.form-group input:invalid:not(:placeholder-shown) {
  border-color: var(--error);
}

.submit-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.submit-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.terms {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 1rem;
  line-height: 1.5;
}

.checkout-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.secure-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.813rem;
  color: var(--text-secondary);
}

.secure-badge svg {
  width: 16px;
  height: 16px;
  color: var(--success);
}

.powered-by {
  font-size: 0.813rem;
  color: var(--text-secondary);
}

.powered-by strong {
  color: #635bff;
}

/* Result pages */
.result-card {
  text-align: center;
}

.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.result-icon svg {
  width: 36px;
  height: 36px;
}

.result-icon.success {
  background: #d1fae5;
  color: var(--success);
}

.result-icon.cancel {
  background: #fee2e2;
  color: var(--error);
}

.result-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.result-message {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.result-details {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.detail-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.detail-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.detail-value {
  font-weight: 500;
  font-size: 0.875rem;
}

.next-steps {
  text-align: left;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.next-steps h2 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.next-steps ul {
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.next-steps li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.next-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

.retry-btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.2s;
  margin-bottom: 1.5rem;
}

.retry-btn:hover {
  background: var(--primary-hover);
}

.support-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.support-info a {
  color: var(--primary);
  text-decoration: none;
}

.support-info a:hover {
  text-decoration: underline;
}

/* Error message */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

.error-message.visible {
  display: block;
}

/* Responsive */
@media (max-width: 520px) {
  .checkout-card {
    padding: 1.5rem;
  }

  .checkout-footer {
    flex-direction: column;
    gap: 0.75rem;
  }
}
