/* credits.css — Credits overlay / balance card / session list / detail panel */

/* ══════ Overlay ══════ */
.credits-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: transparent; z-index: 9998;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding-top: 56px; padding-right: 60px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.credits-overlay.visible {
  opacity: 1; pointer-events: auto;
}

/* ══════ Panel ══════ */
.credits-panel {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; width: 420px; max-width: 92vw;
  height: 55vh; max-height: 70vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
}

/* ── Header ── */
.cr-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cr-header-left {
  display: flex; align-items: center; gap: 8px;
}
.cr-back {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 16px; padding: 4px 6px;
  border-radius: 6px; display: none; line-height: 1;
}
.cr-back:hover { background: var(--bg3); color: var(--text); }
.cr-back.visible { display: flex; }
.cr-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.cr-refresh {
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 4px; border-radius: 6px; line-height: 1;
  margin-left: auto;
}
.cr-refresh:hover { background: var(--bg3); color: var(--text); }
.cr-refresh.refreshing svg { animation: spin 0.6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.cr-close {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 20px; padding: 2px 6px;
  border-radius: 6px; line-height: 1;
}
.cr-close:hover { background: var(--bg3); color: var(--text); }

/* ── Balance Card ── */
.cr-balance {
  padding: 20px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.cr-balance-amount {
  font-size: 32px; font-weight: 800; color: var(--text);
  letter-spacing: -0.5px; line-height: 1.2;
}
.cr-balance-label {
  font-size: 12px; color: var(--text3); margin-top: 4px;
}
.cr-balance-detail {
  display: flex; gap: 20px; margin-top: 12px;
}
.cr-balance-item {
  font-size: 12px; color: var(--text2);
}
.cr-balance-item span {
  font-weight: 600; color: var(--text); margin-left: 4px;
}

/* ── Tabs ── */
.cr-tabs {
  display: flex; gap: 4px; padding: 12px 20px 0;
  flex-shrink: 0;
}
.cr-tab {
  background: none; border: 1px solid var(--border);
  color: var(--text3); font-size: 12px; font-weight: 500;
  padding: 5px 14px; border-radius: 16px;
  cursor: pointer; transition: all 0.15s;
}
.cr-tab:hover { border-color: var(--text2); color: var(--text2); }
.cr-tab.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}

/* ── Type Badge (全部流水) ── */
.cr-type-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; margin-right: 6px;
  vertical-align: middle;
}
.cr-type-badge.grant  { background: rgba(var(--green-rgb, 46,160,67), 0.15); color: var(--green); }
.cr-type-badge.settle { background: rgba(var(--accent-rgb, 99,102,241), 0.12); color: var(--accent); }
.cr-type-badge.hold   { background: rgba(var(--accent-rgb, 99,102,241), 0.08); color: var(--text3); }
.cr-type-badge.refund { background: rgba(var(--green-rgb, 46,160,67), 0.10); color: var(--green); }
.cr-type-badge.expire { background: rgba(var(--green-rgb, 46,160,67), 0.10); color: var(--green); }

/* ── Section Title ── */
.cr-section-title {
  font-size: 12px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 20px 6px;
  flex-shrink: 0;
}

/* ── Session List ── */
.cr-list {
  flex: 1; overflow-y: auto; padding: 0 8px 8px;
  min-height: 0;
}
.cr-list::-webkit-scrollbar { width: 4px; }
.cr-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.cr-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text3); font-size: 13px;
}

/* Session item */
.cr-session {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 8px; cursor: pointer;
  transition: background 0.12s;
}
.cr-session:hover { background: var(--bg3); }
.cr-session-info { flex: 1; min-width: 0; }
.cr-session-title {
  font-size: 13px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-session-time {
  font-size: 11px; color: var(--text3); margin-top: 2px;
}
.cr-session-cost {
  font-size: 13px; font-weight: 600; color: var(--text2);
  white-space: nowrap; margin-left: 12px; flex-shrink: 0;
}

/* ── Section Back Arrow ── */
.cr-sec-back {
  cursor: pointer; font-size: 16px; font-weight: 700;
  color: var(--text2); margin-right: 4px;
  padding: 0 4px; border-radius: 4px;
  vertical-align: middle;
}
.cr-sec-back:hover { color: var(--text); background: var(--bg3); }

/* ── Detail List ── */
.cr-detail-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; margin: 1px 0;
  border-radius: 6px;
}
.cr-detail-item:nth-child(odd) { background: var(--bg3); }
.cr-detail-left { flex: 1; min-width: 0; }
.cr-detail-desc {
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-detail-time {
  font-size: 11px; color: var(--text3); margin-top: 1px;
}
.cr-detail-amount {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  margin-left: 12px; flex-shrink: 0;
}
.cr-detail-amount.negative { color: var(--text2); }
.cr-detail-amount.positive { color: var(--green); }

/* ── Custom Tooltip ── */
.cr-has-tip {
  position: relative;
  cursor: default;
}
.cr-tip {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 6px);
  z-index: 10;
  width: max-content; min-width: 180px; max-width: 260px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  user-select: text;
  cursor: text;
}
.cr-has-tip:hover .cr-tip {
  display: block;
}
.cr-tip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text);
  padding: 2px 0;
  white-space: nowrap;
}
.cr-tip-label {
  color: var(--text3);
  flex-shrink: 0;
}

/* ── Load More ── */
.cr-load-more {
  text-align: center; padding: 10px;
}
.cr-load-more button {
  background: none; border: 1px solid var(--border);
  color: var(--text2); font-size: 12px; padding: 6px 16px;
  border-radius: 6px; cursor: pointer; transition: all 0.12s;
}
.cr-load-more button:hover { border-color: var(--accent); color: var(--text); }
.cr-load-more button:disabled { opacity: 0.5; cursor: default; }

/* ── Loading Spinner ── */
.cr-loading {
  text-align: center; padding: 20px; color: var(--text3); font-size: 12px;
}

/* ══════ Navbar Credits Badge (in More menu) ══════ */
.nav-credits-badge {
  font-size: 10px; font-weight: 700;
  background: var(--accent); color: #fff;
  padding: 1px 5px; border-radius: 8px;
  min-width: 14px; text-align: center;
  line-height: 14px; margin-left: auto;
}
