/* ========================================
   EBooks Digital — Design System & Core Styles
   Matches the real React app's look & feel
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  --background: 232 100% 98%;
  --foreground: 220 14% 11%;
  --card: 0 0% 100%;
  --card-foreground: 220 14% 11%;
  --primary: 220 50% 15%;
  --primary-foreground: 0 0% 100%;
  --secondary: 232 60% 95%;
  --secondary-foreground: 220 14% 11%;
  --muted: 220 20% 95%;
  --muted-foreground: 220 10% 45%;
  --accent: 315 100% 72%;
  --accent-foreground: 220 14% 11%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --border: 220 20% 92%;
  --input: 220 20% 92%;
  --ring: 315 100% 72%;
  --radius: 1.125rem;
  --pink: 315 100% 87%;
  --pink-dark: 315 100% 72%;
  --blue: 213 100% 90%;
  --blue-dark: 213 100% 72%;
  --yellow: 40 100% 74%;
  --yellow-dark: 40 100% 55%;
  --success: 142 72% 45%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --shadow-card: 0 10px 30px rgba(17,24,39,.06);
  --shadow-elevated: 0 20px 60px rgba(17,24,39,.10);
  --sidebar-background: 0 0% 100%;
  --sidebar-foreground: 220 10% 25%;
  --sidebar-accent: 315 100% 92%;
  --sidebar-border: 220 20% 92%;
}

.dark {
  --background: 222 47% 7%;
  --foreground: 210 40% 98%;
  --card: 222 47% 10%;
  --card-foreground: 210 40% 98%;
  --primary: 210 40% 98%;
  --primary-foreground: 222 47% 11%;
  --secondary: 217 33% 17%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --accent: 315 100% 72%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 63% 31%;
  --destructive-foreground: 210 40% 98%;
  --border: 217 33% 17%;
  --input: 217 33% 17%;
  --ring: 315 100% 72%;
  --sidebar-background: 222 47% 8%;
  --sidebar-foreground: 210 40% 90%;
  --sidebar-accent: 222 47% 15%;
  --sidebar-border: 217 33% 17%;
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* --- Brand Mark (gradient circle) --- */
.brand-mark-circle {
  width: 2rem; height: 2rem; border-radius: 0.75rem; flex-shrink: 0;
  background: conic-gradient(from 200deg, hsl(var(--pink-dark)), hsl(var(--yellow)), hsl(var(--blue-dark)), hsl(var(--pink-dark)));
}
.user-avatar-gradient {
  width: 2rem; height: 2rem; border-radius: 0.75rem; flex-shrink: 0;
  background: conic-gradient(from 200deg, hsl(var(--pink-dark)), hsl(var(--yellow)), hsl(var(--blue-dark)), hsl(var(--pink-dark)));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.75rem;
}
.topbar-avatar { width: 2.25rem; height: 2.25rem; }
.brand-name { font-weight: 800; font-size: 1rem; color: hsl(var(--foreground)); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem; padding: 0.625rem 1.25rem;
  border-radius: var(--radius); border: none; cursor: pointer; transition: all 0.15s;
  gap: 0.5rem;
}
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { opacity: 0.9; }
.btn-accent { background: hsl(var(--accent)); color: hsl(var(--foreground)); font-weight: 800; }
.btn-accent:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); }
.btn-ghost:hover { background: hsl(var(--muted)); }
.btn-success { background: hsl(var(--success)); color: #fff; }
.btn-destructive { background: hsl(var(--destructive)); color: #fff; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; border-radius: 0.75rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; border-radius: 0.75rem; }
.btn-gradient {
  background: linear-gradient(to right, hsl(var(--accent)), hsl(40 100% 55%));
  color: hsl(var(--foreground)); border-radius: 1rem; padding: 0.875rem;
  font-weight: 800; font-size: 0.875rem; border: none; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-gradient:hover { opacity: 0.95; }
.btn-gradient:active { transform: scale(0.99); }

/* --- Cards (matches .cardx from real app) --- */
.cardx {
  background: hsl(var(--card));
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-card);
}
.card-header { padding: 1.25rem 1.25rem 0; }
.card-title { font-size: 0.875rem; font-weight: 800; color: hsl(var(--foreground)); letter-spacing: -0.01em; }
.card-desc { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); margin-top: 0.25rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0 1.25rem 1.25rem; }

/* --- KPI Cards (matches real app exactly) --- */
.kpi-card {
  border-radius: 1rem; padding: 1rem 1.25rem;
  position: relative; overflow: hidden;
}
.kpi-icon-box {
  width: 2.5rem; height: 2.5rem; border-radius: 0.75rem;
  background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; margin-bottom: 0.5rem;
}
.kpi-card .kpi-title { font-size: 0.75rem; font-weight: 700; color: hsl(var(--foreground) / 0.8); margin-bottom: 0.125rem; }
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 800; color: hsl(var(--foreground)); letter-spacing: -0.02em; }
.kpi-card .kpi-sub { font-size: 0.6875rem; font-weight: 600; color: hsl(var(--foreground) / 0.7); margin-top: 0.25rem; }

.kpi-pink { background: linear-gradient(180deg, hsl(var(--pink)), hsl(315 100% 91%)); }
.dark .kpi-pink { background: linear-gradient(180deg, hsl(315 60% 25%), hsl(315 50% 18%)); }
.kpi-blue { background: linear-gradient(180deg, hsl(var(--blue)), hsl(213 100% 93%)); }
.dark .kpi-blue { background: linear-gradient(180deg, hsl(213 60% 25%), hsl(213 50% 18%)); }
.kpi-yellow { background: linear-gradient(180deg, hsl(var(--yellow)), hsl(40 100% 82%)); }
.dark .kpi-yellow { background: linear-gradient(180deg, hsl(40 60% 25%), hsl(40 50% 18%)); }
.kpi-green { background: linear-gradient(180deg, hsl(142 72% 82%), hsl(142 72% 90%)); }
.dark .kpi-green { background: linear-gradient(180deg, hsl(142 50% 22%), hsl(142 40% 15%)); }

/* --- Transaction List Items (matches real app) --- */
.tx-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem; border-radius: 0.75rem;
  transition: background 0.15s;
}
.tx-item:hover { background: hsl(var(--muted) / 0.5); }
.tx-icon {
  width: 2rem; height: 2rem; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; flex-shrink: 0;
}
.tx-icon.bg-muted { background: hsl(var(--muted)); }
.tx-icon.bg-kpi-pink { background: linear-gradient(180deg, hsl(var(--pink)), hsl(315 100% 91%)); }
.tx-info { flex: 1; min-width: 0; }
.tx-label { font-size: 0.75rem; font-weight: 700; color: hsl(var(--foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-date { font-size: 0.625rem; color: hsl(var(--muted-foreground)); font-weight: 500; }
.tx-amount { font-size: 0.75rem; font-weight: 800; flex-shrink: 0; }
.tx-amount.text-green { color: #16a34a; }
.tx-amount.text-red { color: hsl(var(--destructive)); }

/* --- Wallet Breakdown Row (matches real app) --- */
.wallet-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.375rem 0; border-bottom: 1px solid hsl(var(--border));
}
.wallet-row:last-child { border-bottom: none; }
.wallet-row-label { font-size: 0.8125rem; font-weight: 600; color: hsl(var(--muted-foreground)); }
.wallet-row-value { display: flex; align-items: center; gap: 0.25rem; }
.wallet-arrow { font-size: 0.75rem; }
.wallet-arrow.up { color: #22c55e; }
.wallet-arrow.down { color: #f87171; }
.wallet-row-amount { font-size: 0.8125rem; font-weight: 800; color: hsl(var(--foreground)); }

/* --- Profile Card --- */
.profile-card {
  display: flex; align-items: center; gap: 1rem; padding: 1.25rem;
}
.profile-card .profile-avatar {
  width: 3.5rem; height: 3.5rem; border-radius: 1rem; overflow: hidden;
  border: 2px solid hsl(var(--border)); background: hsl(var(--muted));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-card .profile-avatar span {
  font-size: 1.25rem; font-weight: 800; color: hsl(var(--muted-foreground));
  background: conic-gradient(from 200deg, hsl(var(--pink-dark)), hsl(var(--yellow)), hsl(var(--blue-dark)), hsl(var(--pink-dark)));
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.profile-card .profile-info { flex: 1; min-width: 0; }
.profile-card .profile-name { font-weight: 800; color: hsl(var(--foreground)); letter-spacing: -0.01em; }
.profile-card .profile-username { font-size: 0.75rem; color: hsl(var(--muted-foreground)); font-weight: 600; }
.profile-card .profile-badges { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.375rem; flex-wrap: wrap; }
.profile-card .profile-analytics {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.75rem; border-radius: 0.75rem;
  background: hsl(var(--accent) / 0.1); color: hsl(var(--accent));
  font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}

/* --- Completion Bar --- */
.completion-bar-wrap { padding: 0.75rem 1.25rem; }
.completion-text { display: flex; justify-content: space-between; margin-bottom: 0.375rem; }
.completion-label { font-size: 0.8125rem; font-weight: 700; }
.completion-pct { font-size: 0.75rem; font-weight: 800; color: hsl(var(--accent)); }
.completion-bar { background: hsl(var(--muted)); border-radius: 999px; height: 0.5rem; overflow: hidden; }
.completion-fill { height: 100%; border-radius: 999px; background: hsl(var(--accent)); }
.completion-hint { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); margin-top: 0.25rem; }

/* --- Referral Card --- */
.referral-card { padding: 1.25rem; }
.referral-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.referral-icon-box {
  width: 2rem; height: 2rem; border-radius: 0.75rem;
  background: hsl(var(--accent) / 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
}
.referral-title { font-size: 0.875rem; font-weight: 800; color: hsl(var(--foreground)); letter-spacing: -0.01em; }
.referral-sub { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.referral-link-box {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem; border-radius: 0.75rem;
  background: hsl(var(--muted) / 0.5); border: 1px solid hsl(var(--border));
}
.referral-link-text { flex: 1; font-size: 0.75rem; font-weight: 600; color: hsl(var(--foreground)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.referral-code { font-size: 0.75rem; color: hsl(var(--muted-foreground)); margin-top: 0.5rem; font-weight: 500; }
.referral-code strong { font-weight: 800; color: hsl(var(--foreground)); }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; font-size: 0.625rem; font-weight: 700;
  padding: 0.125rem 0.5rem; border-radius: 999px;
}
.badge-approved { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-pending { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }
.badge-declined { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-default { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); }
.role-badge { font-size: 0.625rem; font-weight: 700; padding: 0.125rem 0.5rem; border-radius: 999px; flex-shrink: 0; }
.role-member { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.role-admin { background: #fce7f3; color: #be185d; }

.badge-circle {
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: hsl(var(--accent) / 0.1); border: 1px solid hsl(var(--accent) / 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}

/* --- Grid Utilities --- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-1-2 { grid-template-columns: 2fr 1fr; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: hsl(var(--muted-foreground)); }
.font-bold { font-weight: 700; }
.font-black { font-weight: 800; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.w-full { width: 100%; }
.hidden { display: none; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-w-7xl { max-width: 80rem; }

/* --- Section Title --- */
.section-title {
  font-size: 0.875rem; font-weight: 800; margin-bottom: 0.75rem;
  color: hsl(var(--foreground)); letter-spacing: -0.01em;
}
.section-sub { font-size: 0.75rem; color: hsl(var(--muted-foreground)); font-weight: 600; }

/* --- Chart Placeholder --- */
.chart-placeholder {
  background: hsl(var(--muted));
  border-radius: 0.75rem;
  height: 180px; display: flex;
  align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem; font-weight: 600;
}

/* --- Avatar --- */
.avatar {
  width: 4rem; height: 4rem; border-radius: 1rem;
  background: hsl(var(--muted)); display: flex;
  align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 800;
  color: hsl(var(--muted-foreground));
  overflow: hidden;
}
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; border-radius: 0.75rem; }
.avatar-lg { width: 6rem; height: 6rem; font-size: 2rem; }

/* --- Separator --- */
.separator { border: none; border-top: 1px solid hsl(var(--border)); margin: 1rem 0; }

/* --- Notification Bell --- */
.notification-bell { font-size: 1.25rem; cursor: pointer; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-1-2 { grid-template-columns: 1fr; }
  .md-hidden { display: none; }
  .md-show { display: block; }
}

/* --- Landing Page Specific --- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: hsl(var(--card) / 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; }
.header-nav { display: flex; gap: 1.5rem; }
.header-nav a { font-weight: 600; font-size: 0.875rem; color: hsl(var(--muted-foreground)); transition: color 0.15s; }
.header-nav a:hover { color: hsl(var(--foreground)); }
.header-actions { display: flex; gap: 0.75rem; }

.hero { position: relative; padding: 5rem 0 4rem; text-align: center; overflow: hidden; }
.floating-shapes { position: absolute; inset: 0; pointer-events: none; }
.float-shape { position: absolute; animation: float-kid ease-in-out infinite; }
.hero-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.hero-badge { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.375rem 1rem; border-radius: 999px; background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); margin-bottom: 1.5rem; }
.hero h1 { font-size: 2.75rem; font-weight: 900; line-height: 1.15; margin-bottom: 1.25rem; }
.hero-highlight { background: conic-gradient(from 200deg, hsl(var(--pink-dark)), hsl(var(--yellow)), hsl(var(--blue-dark)), hsl(var(--pink-dark))); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-desc { font-size: 1.0625rem; color: hsl(var(--muted-foreground)); margin-bottom: 2rem; line-height: 1.7; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; margin-bottom: 3rem; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; }
.stat { text-align: center; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 900; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: hsl(var(--muted-foreground)); }

.features { padding: 4rem 0; }
.features .section-title { text-align: center; font-size: 2rem; margin-bottom: 2.5rem; }
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.feature-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 2rem 1.5rem; text-align: center; box-shadow: var(--shadow-card); transition: transform 0.2s, box-shadow 0.2s; }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-elevated); }
.feature-icon { font-size: 2.5rem; display: block; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1rem; font-weight: 800; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); line-height: 1.6; }

.how-it-works { padding: 4rem 0; background: hsl(var(--secondary)); }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.step-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 2rem; text-align: center; position: relative; box-shadow: var(--shadow-card); }
.step-number { position: absolute; top: -0.75rem; left: 50%; transform: translateX(-50%); width: 1.75rem; height: 1.75rem; border-radius: 50%; background: hsl(var(--accent)); color: #fff; font-weight: 800; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; }
.step-emoji { font-size: 2.5rem; display: block; margin-bottom: 1rem; }
.step-card h3 { font-weight: 800; margin-bottom: 0.5rem; }
.step-card p { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); line-height: 1.6; }

.cta-section { padding: 4rem 0; }
.cta-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 0.5rem); padding: 3rem 2rem; text-align: center; box-shadow: var(--shadow-elevated); }
.cta-card h2 { font-size: 1.75rem; font-weight: 900; margin-bottom: 0.75rem; }
.cta-card p { font-size: 1rem; color: hsl(var(--muted-foreground)); margin-bottom: 1.5rem; }

.site-footer { border-top: 1px solid hsl(var(--border)); padding: 2.5rem 0; }
.footer-inner { text-align: center; }
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.footer-tagline { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); margin-bottom: 1rem; }
.footer-nav { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.footer-nav a { font-size: 0.8125rem; font-weight: 600; color: hsl(var(--muted-foreground)); transition: color 0.15s; }
.footer-nav a:hover { color: hsl(var(--foreground)); }
.footer-copy { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

@media (max-width: 768px) {
  .header-nav { display: none; }
  .hero h1 { font-size: 2rem; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; gap: 1rem; }
  .hero-actions { flex-direction: column; align-items: center; }
}
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
}
