:root {
  --bg-primary: #f5f3f0;
  --bg-card: #ffffff;
  --bg-card-dark: #1a1a2e;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --accent: #0d6b3f;
  --accent-light: #e8f5ee;
  --danger: #dc2626;
  --success: #16a34a;
  --border: #e5e7eb;
  --shadow-clay: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
  --shadow-clay-hover: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9);
  --radius-card: 24px;
  --radius-btn: 16px;
  --radius-input: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f0f1a;
    --bg-card: #1a1a2e;
    --text-primary: #f5f3f0;
    --text-secondary: #9ca3af;
    --border: #2d2d44;
    --accent-light: #1a3d2e;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; max-width: 420px; }

.screen { display: none; flex-direction: column; align-items: center; gap: 16px; }
.screen.active { display: flex; }

/* Loading */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.checkout-header { width: 100%; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.1rem;
}
.brand svg { flex-shrink: 0; }

/* Clay card */
.clay-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-clay);
  width: 100%;
  transition: box-shadow 0.2s;
}

.payment-info { margin-bottom: 16px; }
.payment-info:last-child { margin-bottom: 0; }
.label {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary);
  margin-bottom: 4px;
}
.value { font-size: 2rem; font-weight: 800; color: var(--accent); }
.desc { font-size: 0.95rem; color: var(--text-secondary); }

/* PIX section */
.pix-section { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.qr-wrapper {
  display: flex; justify-content: center;
  background: #fff; border-radius: 16px; padding: 16px;
  margin-bottom: 12px;
}
#qrCode { width: 200px; height: 200px; }
.qr-hint { text-align: center; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 16px; }

.copy-section { display: flex; flex-direction: column; gap: 8px; }
.copy-input {
  width: 100%; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-input);
  background: var(--bg-primary); color: var(--text-primary);
  font-size: 0.85rem; font-family: monospace;
  text-overflow: ellipsis; overflow: hidden;
  cursor: pointer;
}

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-btn);
  font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: var(--shadow-clay); text-decoration: none;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-clay-hover); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-btn);
  font-size: 0.95rem; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: box-shadow 0.2s;
}
.btn-secondary:hover { box-shadow: var(--shadow-clay); }

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--accent-light);
  border-radius: 100px; font-size: 0.85rem; color: var(--accent);
  font-weight: 500;
}
.pulse-dot {
  width: 8px; height: 8px; background: var(--accent);
  border-radius: 50%; animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Footer */
.checkout-footer { text-align: center; font-size: 0.8rem; color: var(--text-secondary); margin-top: 8px; }

/* Error */
#error h2, #error p { text-align: center; }

/* Success */
.success-card {
  background: var(--bg-card); border-radius: var(--radius-card);
  padding: 40px 24px; box-shadow: var(--shadow-clay);
  width: 100%; display: flex; flex-direction: column;
  align-items: center; gap: 16px; text-align: center;
}
.success-icon {
  width: 96px; height: 96px; border-radius: 50%;
  background: rgba(22, 163, 74, 0.1);
  display: flex; align-items: center; justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .spinner, .pulse-dot { animation: none; }
  .btn-primary:hover { transform: none; }
}
