/* creator-earnings-dashboard.css — Creator Earnings Dashboard.
   Dark theme, TikTok-inspired accent colors. NovaReelOS design system. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #000; color: #E8E8E8; font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* ── Topbar ───────────────────────────────────────────────────────────── */
.ced-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: rgba(0,0,0,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid #1A1A1A;
}
.ced-topbar-title { font-size: 1.25rem; font-weight: 800; color: #fff; }
.ced-topbar-right { display: flex; align-items: center; gap: 14px; }
.ced-refresh-btn {
  display: flex; align-items: center; gap: 6px;
  background: #1A1A1A; border: 1px solid #2A2A2A; color: #ccc;
  font-size: 0.78rem; font-weight: 600; padding: 7px 14px; border-radius: 6px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.ced-refresh-btn:hover { border-color: #00F2EA; color: #00F2EA; }
.ced-refresh-btn.loading { opacity: 0.5; cursor: not-allowed; }
.ced-refresh-icon { font-size: 0.9rem; }
.ced-refresh-icon.spinning { animation: cedSpin 0.8s linear infinite; display: inline-block; }
@keyframes cedSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.ced-timestamp { font-size: 0.72rem; color: #555; }

/* ── Container ────────────────────────────────────────────────────────── */
.ced-container { max-width: 1040px; margin: 0 auto; padding: 28px 20px 60px; }

/* ── Hero: Combined Total Card ───────────────────────────────────────── */
.ced-hero-grid { margin-bottom: 20px; }
.ced-total-card {
  background: linear-gradient(135deg, #0A0A0A 0%, #111111 100%);
  border: 1px solid #1A1A1A; border-radius: 16px;
  padding: 28px 24px; display: flex; flex-direction: column; gap: 6px;
}
.ced-total-card .ced-card-label { font-size: 0.82rem; }
.ced-total-value { font-size: 2.4rem; font-weight: 900; color: #fff; letter-spacing: -0.02em; }
.ced-total-sub { font-size: 0.75rem; color: #555; margin-top: 2px; }

/* ── Cards Grid ───────────────────────────────────────────────────────── */
.ced-cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 36px; }
.ced-card {
  background: #0A0A0A; border: 1px solid #1A1A1A; border-radius: 14px;
  padding: 22px 18px; display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.ced-card:hover { border-color: rgba(255,255,255,0.08); }
.ced-card-label { font-size: 0.78rem; color: #8A8B91; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ced-card-value { font-size: 1.6rem; font-weight: 800; color: #fff; }
.ced-card-meta { font-size: 0.72rem; color: #555; }
.ced-card-meta strong { font-weight: 700; }

/* Accent variants per card type */
.ced-card-accent-coral { }
.ced-card-accent-coral .ced-card-value { color: #FF4D6D; }
.ced-card-accent-cyan { }
.ced-card-accent-cyan .ced-card-value { color: #00F2EA; }
.ced-card-accent-purple { }
.ced-card-accent-purple .ced-card-value { color: #A855F7; }
.ced-card-accent-green { }
.ced-card-accent-green .ced-card-value { color: #22C55E; }

/* Card header row */
.ced-card-header { display: flex; align-items: center; justify-content: space-between; }
.ced-card-icon { font-size: 1.3rem; }

/* Tier breakdown list */
.ced-tier-list { list-style: none; margin-top: 4px; }
.ced-tier-item { display: flex; justify-content: space-between; font-size: 0.75rem; color: #666; padding: 3px 0; }
.ced-tier-item span:last-child { color: #aaa; font-weight: 600; }

/* ── Tooltips ─────────────────────────────────────────────────────────── */
.ced-tooltip-wrap { position: relative; display: inline-flex; align-items: center; }
.ced-tooltip-trigger { font-size: 0.75rem; color: #555; cursor: help; margin-left: 4px; }
.ced-tooltip-trigger:hover { color: #00F2EA; }
.ced-tooltip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); z-index: 20;
  background: #1A1A1A; border: 1px solid #00F2EA; border-radius: 8px;
  padding: 10px 14px; font-size: 0.72rem; color: #ccc; line-height: 1.5;
  width: 220px; text-align: left; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.ced-tooltip-wrap:hover .ced-tooltip { display: block; }
/* Arrow */
.ced-tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #00F2EA;
}

/* ── Loading Skeleton ─────────────────────────────────────────────────── */
@keyframes cedShimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.ced-skeleton {
  background: linear-gradient(90deg, #1A1A1A 25%, #252525 50%, #1A1A1A 75%);
  background-size: 800px 100%;
  animation: cedShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
.ced-card-loading { display: flex; flex-direction: column; gap: 10px; }
.ced-skeleton-value { height: 1.6rem; width: 60%; }
.ced-skeleton-meta { height: 0.75rem; width: 45%; }
.ced-skeleton-badge { height: 1rem; width: 30%; margin-top: 4px; }

/* ── Error State ──────────────────────────────────────────────────────── */
.ced-card-error { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 80px; }
.ced-error-icon { font-size: 1.2rem; }
.ced-error-msg { font-size: 0.75rem; color: #EF4444; text-align: center; }

/* ── Payout Table ─────────────────────────────────────────────────────── */
.ced-payout-next {
  display: flex; gap: 20px; margin-bottom: 16px;
  background: #0D0D0D; border: 1px solid #1A1A1A; border-radius: 10px; padding: 16px 18px;
}
.ced-payout-stat { display: flex; flex-direction: column; gap: 4px; }
.ced-payout-stat-label { font-size: 0.72rem; color: #666; font-weight: 600; }
.ced-payout-stat-value { font-size: 1.05rem; font-weight: 800; color: #fff; }
.ced-payout-table-wrap { overflow-x: auto; }
.ced-payout-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.ced-payout-table th {
  text-align: left; padding: 8px 12px; font-size: 0.68rem; font-weight: 700;
  color: #555; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid #1A1A1A;
}
.ced-payout-table td { padding: 10px 12px; border-bottom: 1px solid #0F0F0F; color: #aaa; }
.ced-payout-table tr:last-child td { border-bottom: none; }
.ced-payout-table tr:hover td { background: #0A0A0A; }
.ced-right { text-align: right; }
.ced-status-badge {
  display: inline-block; font-size: 0.65rem; font-weight: 700; padding: 3px 8px;
  border-radius: 4px;
}
.ced-status-paid { background: rgba(34,197,94,0.12); color: #22C55E; }
.ced-status-pending { background: rgba(251,191,36,0.12); color: #FBBF24; }
.ced-status-failed { background: rgba(239,68,68,0.12); color: #EF4444; }
.ced-lifetime { margin-top: 16px; padding-top: 14px; border-top: 1px solid #1A1A1A; display: flex; justify-content: space-between; align-items: center; }
.ced-lifetime-label { font-size: 0.72rem; color: #555; font-weight: 600; }
.ced-lifetime-value { font-size: 1rem; font-weight: 800; color: #8A8B91; }
.ced-empty-payouts { text-align: center; padding: 24px 16px; color: #444; font-size: 0.82rem; }

/* ── Content visibility ───────────────────────────────────────────────── */
.ced-content { display: none; }
.ced-content.visible { display: flex; flex-direction: column; gap: 8px; }

/* ── Revenue Trend + Top Posts Sections ───────────────────────────────── */
.ced-section {
  margin-top: 2rem;
  background: #0A0A0A;
  border: 1px solid #1A1A1A;
  border-radius: 14px;
  padding: 22px 18px;
}
.ced-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ced-section-title {
  font-size: 0.78rem;
  color: #8A8B91;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ced-range-toggle { display: flex; gap: 4px; }
.ced-range-btn {
  background: #1A1A1A;
  border: 1px solid #2A2A2A;
  color: #888;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.ced-range-btn:hover { border-color: #00F2EA; color: #00F2EA; }
.ced-range-btn.active { background: #00F2EA; color: #000; border-color: #00F2EA; }
.ced-chart-wrap { min-height: 260px; }
.ced-chart-wrap canvas { width: 100%; height: 260px; }

/* Top Posts */
.ced-posts-grid { display: flex; flex-direction: column; gap: 0; }
.ced-post-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #1A1A1A;
  font-size: 0.82rem;
}
.ced-post-row:last-child { border-bottom: none; }
.ced-post-caption { flex: 1; color: #ccc; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ced-post-stat { color: #666; font-size: 0.72rem; white-space: nowrap; }
.ced-post-eng {
  background: rgba(0, 242, 234, 0.12);
  color: #00F2EA;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.ced-empty { color: #444; font-size: 0.82rem; text-align: center; padding: 24px 16px; }

/* Sparkline */
.ced-sparkline-wrap { margin-top: 6px; }
.ced-sparkline-wrap canvas { width: 100%; height: 40px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .ced-cards-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .ced-topbar { flex-direction: column; gap: 8px; padding: 12px 16px; }
  .ced-cards-grid { grid-template-columns: 1fr; }
  .ced-container { padding: 16px 12px 40px; }
  .ced-total-value { font-size: 2rem; }
}