/* ============================================================
   Credits page styling
   ============================================================ */
.credits-page { display: flex; flex-direction: column; gap: 20px; }

.credits-balance-card {
  background: linear-gradient(135deg, #0c3eae 0%, #4f46e5 100%);
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(12, 62, 174, .25);
}
.credits-balance-card.low    { background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%); }
.credits-balance-card.empty  { background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%); }
.cb-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cb-main .cb-label { font-size: .85rem; opacity: .85; margin-bottom: 4px; }
.cb-main .cb-value { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.cb-warning { margin-top: 6px; font-size: .8rem; opacity: .9; }
.cb-meta { display: flex; gap: 18px; flex-wrap: wrap; }
.cb-meta > div { background: rgba(255,255,255,.12); padding: 8px 14px; border-radius: 10px; min-width: 120px; }
.cb-meta-label { display: block; font-size: .7rem; opacity: .85; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
.cb-meta-value { font-size: 1rem; font-weight: 700; }
.cb-error { font-size: .9rem; opacity: .9; }

.credits-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border, #e5e7eb); }
.credits-tabs .tab {
  background: none; border: none; padding: 10px 16px; font: inherit;
  color: var(--text-secondary, #6b7280); cursor: pointer; border-bottom: 2px solid transparent;
}
.credits-tabs .tab.active { color: var(--accent, #0c3eae); border-color: var(--accent, #0c3eae); font-weight: 600; }

.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pack-card { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 6px; transition: transform .15s, box-shadow .15s; }
.pack-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.06); }
.pack-name { font-weight: 700; font-size: 1.1rem; }
.pack-credits { font-size: 2rem; font-weight: 800; color: var(--accent, #0c3eae); line-height: 1.05; }
.pack-bonus { font-size: .8rem; color: #059669; font-weight: 600; margin-left: 6px; }
.pack-price { font-size: 1.4rem; font-weight: 700; }
.pack-per-credit { font-size: .8rem; color: var(--text-secondary, #6b7280); }
.pack-desc { font-size: .85rem; color: var(--text-secondary, #6b7280); margin-top: 4px; }
.pack-buy { margin-top: auto; background: var(--accent, #0c3eae); color: #fff; border: none; border-radius: 10px; padding: 12px; font: inherit; font-weight: 600; cursor: pointer; }
.pack-buy:hover  { background: #0a338f; }
.pack-buy:disabled { opacity: .65; cursor: not-allowed; }
.pack-footnote { font-size: .8rem; color: var(--text-secondary, #6b7280); text-align: center; margin-top: 12px; }

.reason-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: #e5e7eb; color: #374151; text-transform: lowercase; }
.reason-pack_purchase { background: #d1fae5; color: #065f46; }
.reason-admin_grant   { background: #dbeafe; color: #1e40af; }
.reason-admin_debit   { background: #fee2e2; color: #991b1b; }
.reason-consume       { background: #fef3c7; color: #92400e; }
.reason-refund        { background: #ede9fe; color: #6d28d9; }

td.pos { color: #047857; font-weight: 600; }
td.neg { color: #b91c1c; font-weight: 600; }

.card.empty, .card.error { padding: 30px; text-align: center; color: var(--text-secondary, #6b7280); }
.card.error { color: #b91c1c; }

/* Low-balance dashboard banner */
.low-credits-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fef3c7; color: #78350f; border: 1px solid #fbbf24;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
}
.low-credits-banner.empty { background: #fee2e2; color: #7f1d1d; border-color: #f87171; }
.low-credits-banner a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ── Inline pay modal (Stripe Elements) ───────────────────────────────── */
.cred-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 10000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.cred-modal-overlay.open { display: flex; }
.cred-modal {
  background: #fff;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cred-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.cred-modal-title { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.cred-modal-close {
  background: none; border: none; font-size: 1.5rem; line-height: 1;
  color: #64748b; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.cred-modal-close:hover { background: #f1f5f9; color: #0f172a; }
.cred-modal-body { padding: 20px; overflow-y: auto; }
.cred-modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.cred-pay-summary {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.cred-pay-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .92rem; padding: 4px 0;
}
.cred-pay-row.cred-pay-amount {
  border-top: 1px dashed #cbd5e1; margin-top: 6px; padding-top: 8px;
  font-size: 1rem;
}
.cred-pay-stripe { min-height: 220px; margin-bottom: 8px; }
.cred-pay-loading {
  display: flex; align-items: center; gap: 10px; padding: 24px; color: #64748b; font-size: .9rem;
}
.cred-pay-loading .spinner {
  width: 18px; height: 18px; border-width: 2px;
}
.cred-pay-error {
  background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
  border-radius: 8px; padding: 10px 12px; font-size: .85rem; margin-top: 8px;
}
.cred-pay-secured {
  display: flex; align-items: center; gap: 8px;
  font-size: .78rem; color: #64748b; margin-top: 12px;
}
.cred-pay-secured i { color: #10b981; }
