/* =========================================================================
   billing.css — the credits & wallet console on the dashboard
   frosted-glass cards matching the dreamy auth aesthetic
   ========================================================================= */

.billing-section { margin-bottom: 2.5rem; }

/* the key-reveal banner (first signup only) */
.key-reveal {
  background: linear-gradient(135deg, rgba(255, 143, 171, 0.18), rgba(157, 170, 242, 0.18));
  border: 1.5px solid var(--rose-deep);
  border-radius: 1.25rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  animation: keyRevealPulse 2.5s ease-in-out infinite;
}
@keyframes keyRevealPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 143, 171, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(255, 143, 171, 0); }
}
.key-reveal .kr-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  color: var(--rose-deep);
}
.key-reveal .kr-body { flex: 1; min-width: 0; }
.key-reveal h3 {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 700;
  color: var(--ink);
  margin: 0 0 .25rem;
}
.key-reveal p {
  font-size: .85rem;
  color: var(--ink-soft);
  margin: 0 0 .6rem;
  line-height: 1.4;
}
.key-reveal .kr-key {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.key-reveal code {
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 600;
  background: rgba(61, 44, 78, 0.08);
  padding: .35rem .65rem;
  border-radius: .5rem;
  color: var(--ink);
  word-break: break-all;
}
.key-reveal .kr-copy {
  background: var(--rose-deep);
  color: #fff;
  border: none;
  border-radius: .5rem;
  padding: .35rem .8rem;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  min-height: 36px;
  transition: background .2s, transform .15s;
}
.key-reveal .kr-copy:hover { transform: translateY(-1px); }
.key-reveal .kr-copy:active { transform: translateY(0); }
.key-reveal .kr-dismiss {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .25rem .5rem;
  line-height: 1;
}
.key-reveal .kr-dismiss:hover { color: var(--ink); }

/* the 3-up billing card grid */
.billing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.bill-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--panel-border);
  border-radius: 1.25rem;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  position: relative;
  overflow: hidden;
}
.bill-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--whale), var(--rose));
  opacity: .7;
}
.bill-card .bc-icon {
  width: 24px; height: 24px;
  color: var(--rose-deep);
  margin-bottom: .15rem;
}
.bill-card .bc-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
}
.bill-card .bc-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.bill-card .bc-sub {
  font-size: .8rem;
  color: var(--ink-soft);
}
.bill-card .bc-sub code {
  font-family: var(--font-mono);
  font-size: .72rem;
  background: rgba(61, 44, 78, 0.06);
  padding: .15rem .35rem;
  border-radius: .3rem;
  word-break: break-all;
}
.bill-card.is-low .bc-value { color: var(--rose-deep); }
.bill-card.is-zero .bc-value { color: #c0392b; }

/* copy button inside the deposit card */
.copy-btn {
  background: rgba(157, 170, 242, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: .4rem;
  padding: .2rem .5rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .2s, color .2s;
  min-height: 28px;
  align-self: flex-start;
}
.copy-btn:hover { background: rgba(157, 170, 242, 0.3); color: var(--ink); }
.copy-btn.copied { background: rgba(76, 175, 80, 0.2); color: #2e7d32; border-color: #66bb6a; }

/* balance flash animation when it changes */
@keyframes balFlash {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); color: var(--rose); }
  100% { transform: scale(1); }
}
.bc-value.flash { animation: balFlash .6s ease; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .key-reveal { animation: none; }
  .bc-value.flash { animation: none; }
  .key-reveal .kr-copy:hover, .copy-btn:hover { transform: none; }
}

/* =========================================================================
   transaction history (ledger)
   ========================================================================= */
.ledger-wrap {
  margin-top: 1.5rem;
}
.ledger-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft, #6b5b7a);
  margin: 0 0 .75rem;
  font-weight: 600;
}
.ledger-table-scroll {
  overflow-x: auto;
  border-radius: 14px;
  background: var(--panel-bg, rgba(255, 255, 255, 0.55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border, rgba(157, 170, 242, 0.25));
}
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 480px;
}
.ledger-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft, #6b5b7a);
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--panel-border, rgba(157, 170, 242, 0.2));
  white-space: nowrap;
}
.ledger-table tbody td {
  padding: .65rem .9rem;
  border-bottom: 1px solid rgba(157, 170, 242, 0.12);
  color: var(--ink, #3d2c4e);
  vertical-align: middle;
}
.ledger-table tbody tr:last-child td { border-bottom: none; }
.ledger-table td.num,
.ledger-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-detail { font-family: var(--font-mono, monospace); font-size: .78rem; color: var(--ink-soft, #6b5b7a); }

/* row accents: deposits green, burns rose-tinted */
.ledger-table tbody tr.is-deposit td.num { color: #2e7d32; font-weight: 700; }
.ledger-table tbody tr.is-burn td.num { color: var(--rose, #ff8fab); }

/* type tag pill */
.tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .15rem .5rem;
  border-radius: 999px;
  line-height: 1.4;
}
.tag.is-deposit { background: rgba(76, 175, 80, 0.16); color: #2e7d32; }
.tag.is-burn { background: rgba(255, 143, 171, 0.16); color: var(--rose, #ff8fab); }

.ledger-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--ink-soft, #6b5b7a);
  font-size: .85rem;
}

/* zebra hover for readability on dense tables */
.ledger-table tbody tr:hover td { background: rgba(157, 170, 242, 0.07); }

/* =========================================================================
   wallet hero — the prominent "your ethereum address" card at the top.
   leads with the deposit address (the thing users asked to see) + a scannable
   QR for phone deposits; the API key (sk-addr) is shown secondary.
   ========================================================================= */
.wallet-hero { margin-bottom: 2.5rem; }
.wallet-card {
  background: linear-gradient(135deg, rgba(255, 143, 171, 0.16), rgba(157, 170, 242, 0.16));
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1.5px solid var(--panel-border);
  border-radius: 1.5rem;
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.wallet-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rose), var(--whale));
}
/* the QR (white rounded square so scanners read it cleanly) */
.wallet-qr {
  flex-shrink: 0;
  width: 132px;
  height: 132px;
  background: #fff;
  border-radius: 1rem;
  padding: 10px;
  box-shadow: 0 8px 22px -8px rgba(61, 44, 78, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wallet-qr svg { width: 100%; height: 100%; display: block; }
.wallet-qr-fallback { font-size: 2.4rem; color: var(--ink-soft); opacity: .35; }
/* address + key details */
.wallet-detail {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
  flex: 1 1 280px;
}
.wallet-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
}
.wallet-addr {
  font-family: var(--font-mono);
  font-size: clamp(.85rem, 2.4vw, 1.15rem);
  font-weight: 600;
  color: var(--ink);
  background: rgba(61, 44, 78, 0.08);
  padding: .5rem .85rem;
  border-radius: .6rem;
  word-break: break-all;
  align-self: flex-start;
  max-width: 100%;
}
.wallet-meta {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.wallet-chain, .wallet-cur {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 999px;
  letter-spacing: .04em;
}
.wallet-chain { background: rgba(157, 170, 242, 0.22); color: #4150b5; }
.wallet-cur { background: rgba(61, 44, 78, 0.1); color: var(--ink); }
.wallet-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .35rem;
}
.wallet-copy { min-height: 44px; padding: 0 1.4rem; white-space: nowrap; }
.wallet-copyok {
  font-size: .8rem;
  font-weight: 700;
  color: #2e7d32;
}
.wallet-note {
  font-size: .82rem;
  color: var(--ink-soft);
  line-height: 1.45;
  margin: .2rem 0 0;
}
.wallet-note code { font-family: var(--font-mono); font-size: .76rem; background: rgba(61,44,78,.07); padding: .1rem .3rem; border-radius: .3rem; }
/* secondary API key row (the key is sk- + the address above) */
.wallet-keyrow {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px dashed var(--panel-border);
  flex-wrap: wrap;
}
.wallet-keylabel {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
}
.wallet-key {
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(61, 44, 78, 0.06);
  padding: .3rem .55rem;
  border-radius: .45rem;
  word-break: break-all;
}
@media (max-width: 560px) {
  .wallet-card { flex-direction: column; align-items: stretch; text-align: left; }
  .wallet-qr { align-self: center; }
  .wallet-copy { width: 100%; }
}

/* =========================================================================
   model grid: "free" badge on free-tier (free:...) model chips
   ========================================================================= */
.model-chip .mc-badge.mc-free {
  background: rgba(76, 175, 80, 0.18);
  color: #2e7d32;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .62rem;
  font-weight: 700;
}
.model-chip.is-free { border-color: rgba(76, 175, 80, 0.35); }
.model-chip.is-free:hover { border-color: rgba(76, 175, 80, 0.6); }
