/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a28;
  --border: #2a2a3a;
  --text: #e0e0e8;
  --text-dim: #8888a0;
  --accent: #f7931a;       /* Bitcoin orange */
  --accent-glow: #f7931a40;
  --green: #22c55e;
  --green-glow: #22c55e40;
  --red: #ef4444;
  --purple: #a855f7;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

/* === Layout === */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Header === */
header {
  text-align: center;
  margin-bottom: 3rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.tagline {
  font-size: 1.1rem;
  margin-top: 1rem;
  color: var(--text);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* === Steps === */
.step {
  display: none;
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s ease-out;
}

.step.active { display: block; }
.step.completed {
  display: block;
  opacity: 0.75;
}

.step h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text);
}

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

/* === Plans Grid === */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.plan-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.plan-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.plan-card.selected {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

.plan-card .plan-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.plan-card .plan-specs {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.plan-card .plan-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.plan-card .plan-price-fiat {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.plan-card.skeleton {
  color: var(--text-dim);
  border-style: dashed;
  cursor: default;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: #e8850f;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* === Fields & Results === */
.result { margin-top: 1rem; }

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.field code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
  color: var(--text);
}

.secret-field {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.secret-field code {
  flex: 1;
}

.blurred {
  filter: blur(5px);
  transition: filter 0.2s;
}

.blurred.revealed { filter: none; }

.warning {
  font-size: 0.8rem;
  color: var(--red);
  margin-top: 0.5rem;
}

.hidden { display: none; }

/* === Invoice Area === */
.invoice-area {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.qr-placeholder {
  width: 200px;
  height: 200px;
  background: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.invoice-details { flex: 1; min-width: 200px; }

.copy-field {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.copy-field code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truncated {
  max-width: 300px;
}

/* === Status === */
.status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.waiting {
  background: var(--accent);
  animation: pulse 2s infinite;
}

.status-dot.working {
  background: var(--purple);
  animation: pulse 1s infinite;
}

.status-dot.done {
  background: var(--green);
}

.status-dot.error {
  background: var(--red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === Provision Log === */
.provision-log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  max-height: 250px;
  overflow-y: auto;
  line-height: 1.8;
}

.provision-log .log-line {
  color: var(--text-dim);
}

.provision-log .log-line::before {
  content: '› ';
  color: var(--accent);
}

.provision-log .log-line.success { color: var(--green); }
.provision-log .log-line.error { color: var(--red); }

/* === Setup Fee === */
.fee-display {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 1rem 0;
}

.fee-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.fee-note {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.btn-success {
  background: var(--green) !important;
  border-color: var(--green) !important;
}

/* === Model Cards === */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.model-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

.model-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.model-card.selected {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

.model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.model-name { font-weight: 700; font-size: 1.05rem; }
.model-provider { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.model-desc { font-size: 0.85rem; color: var(--text); margin-bottom: 0.75rem; line-height: 1.4; }
.model-pricing { font-size: 0.8rem; color: var(--text-dim); font-family: var(--font-mono); }

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-premium { background: var(--purple); color: #fff; }
.badge-recommended { background: var(--green); color: #000; }
.badge-agentic { background: #3b82f6; color: #fff; }
.badge-cheap { background: var(--accent); color: #000; }

/* === Usage Tiers === */
.usage-section {
  margin-bottom: 1rem;
}

.usage-section label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.usage-tiers {
  display: flex;
  gap: 0.5rem;
}

.btn-tier {
  flex: 1;
  text-align: center;
}

.btn-tier.selected {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* === Cost Estimate === */
.cost-estimate {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease-out;
}

.cost-estimate h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cost-table td {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.cost-table .cost-val {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.cost-table .cost-detail {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.cost-table .cost-usd {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
}

.cost-table .cost-total td {
  border-bottom: none;
  border-top: 2px solid var(--accent);
  padding-top: 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.cost-estimate .btn-primary {
  margin-top: 1rem;
  width: 100%;
  justify-content: center;
}

/* === Payment Summary === */
.payment-summary {
  margin-bottom: 1.5rem;
}

.payment-total {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.payment-breakdown {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* === Footer === */
footer {
  text-align: center;
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}

footer p { color: var(--text-dim); font-size: 0.85rem; }
footer .small { font-size: 0.75rem; margin-top: 0.25rem; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* === Identity Tabs === */
.identity-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-tab {
  flex: 1;
  text-align: center;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-card-hover);
}

.identity-panel {
  margin-bottom: 1rem;
}

.input-nsec {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-nsec:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.input-nsec::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* === Advanced Sections === */
.advanced-section {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  background: var(--bg);
}

.advanced-section summary {
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.advanced-section summary:hover {
  color: var(--accent);
}

.advanced-section[open] summary {
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.advanced-section .field {
  margin-top: 0.5rem;
}

.advanced-section code {
  background: var(--bg-card);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* === API Status Banner === */
.api-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  margin-top: 0.75rem;
}

.api-status.live {
  color: var(--green);
  border: 1px solid var(--green);
  background: #22c55e10;
}

.api-status.mock {
  color: var(--accent);
  border: 1px solid var(--accent);
  background: #f7931a10;
}

/* === Agent Callout === */
.agent-callout {
  margin-top: 3rem;
  padding: 1.5rem 2rem;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: #f7931a08;
}

.agent-callout h3 {
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.agent-callout p {
  margin-bottom: 0.5rem;
  color: var(--text);
  line-height: 1.6;
}

.agent-callout ol {
  margin: 0.75rem 0 0.75rem 1.5rem;
  color: var(--text-dim);
  line-height: 1.8;
}

.agent-callout a {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* === Responsive === */
@media (max-width: 480px) {
  .container { padding: 1rem; }
  header h1 { font-size: 2rem; }
  .plans-grid { grid-template-columns: 1fr; }
  .invoice-area { flex-direction: column; }
  .qr-placeholder { width: 100%; }
}
