/* =============================================
   EarnApp - Main Stylesheet
   Mobile-first, App-like Design
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --primary: #7C3AED;
  --primary-dark: #5B21B6;
  --primary-light: #A78BFA;
  --secondary: #06B6D4;
  --accent: #F59E0B;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --bg: #0F0F1A;
  --bg2: #16162A;
  --bg3: #1E1E35;
  --card: #1A1A2E;
  --card2: #22223B;
  --border: rgba(124,58,237,0.2);
  --text: #F1F5F9;
  --text2: #94A3B8;
  --text3: #64748B;
  --nav-h: 64px;
  --glow: 0 0 20px rgba(124,58,237,0.3);
  --glow-accent: 0 0 20px rgba(245,158,11,0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

[data-theme="light"] {
  --bg: #F0F2FF;
  --bg2: #E8EAFF;
  --bg3: #DDDEFF;
  --card: #FFFFFF;
  --card2: #F8F9FF;
  --border: rgba(124,58,237,0.15);
  --text: #1E1B4B;
  --text2: #4C4F6B;
  --text3: #9394A5;
  --shadow: 0 4px 24px rgba(124,58,237,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ---- Typography ---- */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; }
.mono { font-family: 'JetBrains Mono', monospace; }
.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Utility ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.hidden { display: none !important; }

/* ---- App Layout ---- */
#app-wrapper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

@media (min-width: 1024px) {
  #app-wrapper {
    max-width: 100%;
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 60px 1fr;
  }
}

/* ---- Top Header ---- */
.top-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.app-logo {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.header-right { display: flex; align-items: center; gap: 12px; }

.notif-btn {
  position: relative;
  background: var(--bg3);
  border: none;
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.notif-btn:hover { background: var(--border); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.avatar-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  height: 64px;
  z-index: 100;
  backdrop-filter: blur(12px);
  padding: 0 8px;
}

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text3);
  font-size: 10px;
  font-weight: 600;
  transition: all 0.2s;
  padding: 6px 0;
  border-radius: 12px;
  position: relative;
}
.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--primary-light); }
.nav-item.active i { color: var(--primary-light); }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px; height: 4px;
  background: var(--primary-light);
  border-radius: 50%;
}

/* ---- Desktop Sidebar ---- */
.sidebar {
  display: none;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .sidebar { display: flex; flex-direction: column; }
}

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: var(--bg3); color: var(--text); }
.sidebar-nav a.active { background: rgba(124,58,237,0.1); color: var(--primary-light); border-left-color: var(--primary); }
.sidebar-nav a i { width: 20px; text-align: center; font-size: 16px; }

/* ---- Main Content ---- */
.main-content {
  padding: 16px;
  padding-bottom: 80px;
  min-height: calc(100vh - var(--nav-h));
}

@media (min-width: 1024px) {
  .main-content {
    padding-bottom: 16px;
    max-width: 900px;
  }
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--glow); }

.card-glass {
  background: rgba(26,26,46,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---- Balance Card ---- */
.balance-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), #8B5CF6);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  border: none;
}
.balance-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.balance-card::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}
.balance-label { font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.balance-amount { font-size: 32px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.balance-sub { font-size: 12px; opacity: 0.7; margin-top: 4px; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}
@media (min-width: 600px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
  font-size: 18px;
}
.stat-value { font-size: 18px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 20px;
}
.section-title { font-size: 16px; font-weight: 700; }
.section-link { font-size: 13px; color: var(--primary-light); text-decoration: none; }

/* ---- Task Items ---- */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.task-item:hover { border-color: var(--primary); box-shadow: var(--glow); }
.task-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.task-info { flex: 1; }
.task-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.task-desc { font-size: 12px; color: var(--text3); }
.task-reward { font-size: 14px; font-weight: 700; color: var(--success); font-family: 'JetBrains Mono', monospace; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-family: 'Sora', sans-serif;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.5); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #DC2626); color: white; }
.btn-warning { background: linear-gradient(135deg, var(--warning), #D97706); color: white; }
.btn-outline { background: transparent; color: var(--primary-light); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: rgba(124,58,237,0.1); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---- Floating Action Button ---- */
.fab {
  position: fixed;
  bottom: 80px; right: 16px;
  z-index: 200;
}
.fab-main {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), #D97706);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245,158,11,0.5);
  border: none;
  transition: all 0.3s;
}
.fab-main:hover { transform: scale(1.1) rotate(45deg); }
.fab-items {
  position: absolute;
  bottom: 60px; right: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s;
}
.fab.open .fab-items { opacity: 1; pointer-events: all; transform: translateY(0); }
.fab.open .fab-main { transform: rotate(45deg); }
.fab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.fab-item-btn {
  width: 42px; height: 42px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  font-size: 16px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.fab-item-label {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Sora', sans-serif;
  transition: all 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.form-control::placeholder { color: var(--text3); }
.input-group { position: relative; }
.input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 16px;
}
.input-group .form-control { padding-left: 40px; }
.input-suffix {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  cursor: pointer;
}

/* ---- Packages ---- */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) { .packages-grid { grid-template-columns: repeat(4, 1fr); } }

.package-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.package-card.active, .package-card:hover { border-color: var(--primary); box-shadow: var(--glow); }
.package-card.vip { border-color: #6f42c1; }
.package-badge {
  position: absolute;
  top: 8px; right: -20px;
  background: var(--accent);
  color: #111;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 28px;
  transform: rotate(45deg);
  text-transform: uppercase;
}
.package-icon { font-size: 28px; margin-bottom: 8px; }
.package-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.package-price { font-size: 18px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.package-feature { font-size: 11px; color: var(--text3); margin-top: 6px; line-height: 1.8; }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Sora', sans-serif;
}
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---- Leaderboard ---- */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.rank-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg, #FFD700, #FFA500); color: #111; }
.rank-2 { background: linear-gradient(135deg, #C0C0C0, #A0A0A0); color: #111; }
.rank-3 { background: linear-gradient(135deg, #CD7F32, #A0522D); color: #fff; }

/* ---- Spin Wheel ---- */
.spin-container { text-align: center; padding: 20px 0; }
.spin-wheel-wrap {
  position: relative;
  display: inline-block;
  margin: 0 auto;
}
#spinWheel { border-radius: 50%; box-shadow: 0 0 40px rgba(124,58,237,0.5); }
.spin-pointer {
  position: absolute;
  top: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.spin-btn-wrap { margin-top: 20px; }

/* ---- VIP Badge ---- */
.vip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, #6f42c1, #9d4edd);
  color: white;
}

/* ---- Progress Bar ---- */
.progress-bar {
  background: var(--bg3);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.6s ease;
}

/* ---- Toast Notifications ---- */
#toast-container {
  position: fixed;
  bottom: 80px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 300px;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: slideInRight 0.3s ease;
  font-size: 13px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  width: 100%; max-width: 480px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 24px; max-width: 440px; }
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* ---- Skeleton Loader ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--card2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---- Referral Section ---- */
.referral-code-box {
  background: var(--bg3);
  border: 1.5px dashed var(--primary);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary-light);
  cursor: pointer;
  transition: all 0.2s;
}
.referral-code-box:hover { border-color: var(--secondary); box-shadow: var(--glow); }

/* ---- Withdraw Form ---- */
.method-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.method-btn {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 600;
}
.method-btn.active { border-color: var(--primary); background: rgba(124,58,237,0.1); color: var(--primary-light); }
.method-icon { font-size: 22px; margin-bottom: 4px; }

/* ---- Ads Section ---- */
.ads-progress {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.ads-count { font-size: 28px; font-weight: 800; color: var(--accent); font-family: 'JetBrains Mono', monospace; }

/* ---- Transaction List ---- */
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tx-info { flex: 1; }
.tx-title { font-size: 13px; font-weight: 600; }
.tx-time { font-size: 11px; color: var(--text3); margin-top: 2px; }
.tx-amount { font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.tx-amount.credit { color: var(--success); }
.tx-amount.debit { color: var(--danger); }

/* ---- Auth Pages ---- */
.auth-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 8px; font-size: 32px; font-weight: 800; }
.auth-tagline { text-align: center; color: var(--text3); font-size: 14px; margin-bottom: 28px; }

/* ---- Status Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }

/* ---- Dark mode toggle ---- */
.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px;
  display: flex;
  cursor: pointer;
  width: 48px;
  height: 26px;
  position: relative;
  align-items: center;
}
.theme-toggle::after {
  content: '';
  width: 18px; height: 18px;
  background: var(--primary);
  border-radius: 50%;
  position: absolute;
  left: 4px;
  transition: left 0.3s;
}
[data-theme="light"] .theme-toggle::after { left: 26px; }

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(124,58,237,0.3); }
  50% { box-shadow: 0 0 30px rgba(124,58,237,0.6); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.animate-fade { animation: fadeIn 0.4s ease forwards; }
.animate-pulse-glow { animation: pulse-glow 2s infinite; }
.animate-float { animation: float 3s ease infinite; }

/* ---- Page Transitions ---- */
.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn 0.3s ease; }

/* ---- Loading Spinner ---- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollable X for tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}
table th { color: var(--text3); font-weight: 600; }
table tr:hover td { background: var(--bg3); }

/* ---- Admin Layout ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}
.admin-main {
  margin-left: 240px;
  flex: 1;
  padding: 24px;
  min-height: 100vh;
}
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 16px; }
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ---- Misc ---- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text3); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary-light); }
.font-bold { font-weight: 700; }
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 50%; }

/* ============================================================
   EXTENDED STYLES — v2 additions
   ============================================================ */

/* ---- Light theme fixes ---- */
[data-theme="light"] .top-header         { background: #fff; border-bottom: 1px solid rgba(124,58,237,0.12); }
[data-theme="light"] .sidebar            { background: #fff; border-right: 1px solid rgba(124,58,237,0.12); }
[data-theme="light"] .admin-sidebar      { background: #fff; border-right: 1px solid rgba(124,58,237,0.12); }
[data-theme="light"] .bottom-nav         { background: rgba(255,255,255,0.95); border-top: 1px solid rgba(124,58,237,0.12); }
[data-theme="light"] .balance-card       { box-shadow: 0 8px 32px rgba(124,58,237,0.2); }
[data-theme="light"] .modal-sheet        { background: #fff; }
[data-theme="light"] .modal-overlay      { background: rgba(0,0,0,0.35); }
[data-theme="light"] .toast              { background: #fff; color: var(--text); box-shadow: 0 4px 24px rgba(0,0,0,0.12); }
[data-theme="light"] table thead         { background: rgba(124,58,237,0.06); }
[data-theme="light"] table tbody tr:hover{ background: rgba(124,58,237,0.03); }
[data-theme="light"] .form-control       { background: #f8f9ff; border-color: rgba(124,58,237,0.2); color: var(--text); }
[data-theme="light"] .form-control:focus { border-color: var(--primary); background: #fff; }
[data-theme="light"] .btn-secondary      { background: #ededff; color: var(--text); border-color: rgba(124,58,237,0.2); }
[data-theme="light"] .auth-card          { background: #fff; box-shadow: 0 8px 40px rgba(124,58,237,0.1); }
[data-theme="light"] .stat-card          { background: #fff; }
[data-theme="light"] .task-card          { background: #fff; }
[data-theme="light"] .lb-row             { background: #fff; }
[data-theme="light"] .sidebar-nav a      { color: var(--text2); }
[data-theme="light"] .sidebar-nav a:hover,
[data-theme="light"] .sidebar-nav a.active { background: rgba(124,58,237,0.08); color: var(--primary); }
[data-theme="light"] .admin-sidebar a    { color: var(--text2); }
[data-theme="light"] .admin-sidebar a:hover,
[data-theme="light"] .admin-sidebar a.active { background: rgba(124,58,237,0.08); color: var(--primary); }
[data-theme="light"] .nav-item           { color: var(--text3); }
[data-theme="light"] .nav-item.active    { color: var(--primary); }
[data-theme="light"] .chip               { background: #ededff; border-color: rgba(124,58,237,0.2); }
[data-theme="light"] .earn-progress      { background: rgba(0,0,0,0.08); }
[data-theme="light"] .task-done-bar      { background: rgba(0,0,0,0.08); }

/* ---- Notification badge pulse ---- */
.notif-badge {
  animation: badge-pulse 2s ease infinite;
}
@keyframes badge-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

/* ---- Admin table improvements ---- */
.table-wrap table { border-collapse: collapse; width: 100%; }
.table-wrap thead th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table-wrap tbody td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover { background: rgba(124,58,237,0.03); }

/* ---- Admin sidebar nav ---- */
.admin-sidebar .sidebar-logo {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 800;
}
.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  border-radius: 8px;
  margin: 2px 8px;
  transition: all 0.2s;
}
.admin-sidebar nav a:hover  { background: rgba(124,58,237,0.08); color: var(--primary-light); }
.admin-sidebar nav a.active { background: rgba(124,58,237,0.12); color: var(--primary-light); font-weight: 700; }
.admin-sidebar nav a i      { width: 18px; text-align: center; font-size: 14px; }
.admin-sidebar .sidebar-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  padding: 12px 24px 4px;
}

/* ---- Section header ---- */
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 10px; }
.section-title  { font-size: 14px; font-weight: 700; }
.section-link   { font-size: 12px; color: var(--primary-light); text-decoration: none; }
.section-link:hover { text-decoration: underline; }

/* ---- Info box ---- */
.info-box {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
}
.info-box ol, .info-box ul { padding-left: 18px; margin-top: 6px; }
.info-box code {
  background: rgba(0,0,0,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  word-break: break-all;
}
.info-box code.block {
  display: block;
  padding: 8px 10px;
  margin-top: 6px;
  border-radius: 6px;
  background: rgba(0,0,0,0.25);
}

/* ---- Hint text ---- */
.hint { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.5; }

/* ---- Method select (deposit) ---- */
.method-select { display: grid; gap: 10px; margin-bottom: 16px; }
.method-btn {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.method-btn:hover  { border-color: var(--primary); }
.method-btn.active { border-color: var(--primary); background: rgba(124,58,237,0.08); }
.method-icon { font-size: 28px; margin-bottom: 6px; }

/* ---- Withdraw method cards ---- */
.withdraw-method {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}
.withdraw-method:hover  { border-color: var(--primary); }
.withdraw-method.active { border-color: var(--primary); background: rgba(124,58,237,0.08); }

/* ---- Auth pages ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-icon { font-size: 40px; display: block; margin-bottom: 10px; }
.auth-logo h1 { font-size: 22px; font-weight: 800; }
.auth-logo p  { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ---- Spin page ---- */
.spin-container     { display: flex; flex-direction: column; align-items: center; }
.spin-wheel-wrap    { position: relative; margin-bottom: 20px; }
.spin-pointer       { text-align: center; font-size: 24px; margin-bottom: 4px; color: var(--accent); }
.spin-btn-wrap      { text-align: center; width: 100%; }

/* ---- VIP badge ---- */
.vip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

/* ---- Leaderboard ---- */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 6px;
}
.rank-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  background: var(--bg3);
  flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg,#FFD700,#FFA500); color: #000; }
.rank-2 { background: linear-gradient(135deg,#C0C0C0,#94A3B8); color: #000; }
.rank-3 { background: linear-gradient(135deg,#CD7F32,#D97706); color: #fff; }

/* ---- Badge btn-info ---- */
.btn-info { background: rgba(6,182,212,0.15); color: var(--info); border: 1px solid var(--info); }
.btn-info:hover { background: rgba(6,182,212,0.25); }

/* ---- Package cards ---- */
.pkg-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.pkg-card:hover       { transform: translateY(-3px); box-shadow: var(--glow); }
.pkg-card.recommended { border-color: var(--primary); }
.pkg-badge {
  position: absolute; top: 12px; right: -22px;
  background: var(--primary);
  color: white; font-size: 10px; font-weight: 700;
  padding: 3px 28px; transform: rotate(35deg);
}
.pkg-icon  { font-size: 36px; margin-bottom: 10px; }
.pkg-name  { font-size: 18px; font-weight: 800; }
.pkg-price { font-size: 28px; font-weight: 900; font-family: 'JetBrains Mono', monospace; }
.pkg-price span { font-size: 14px; font-weight: 400; color: var(--text3); }
.pkg-features { list-style: none; margin: 14px 0; text-align: left; }
.pkg-features li { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; padding: 4px 0; }
.pkg-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

/* ---- Scroll to top btn ---- */
#scrollTop {
  position: fixed; bottom: 80px; right: 16px;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(124,58,237,0.9);
  color: white; border: none; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  font-size: 14px; z-index: 100;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  transition: opacity 0.3s;
}
#scrollTop.visible { display: flex; }

/* ---- Responsive tweaks ---- */
@media (max-width: 480px) {
  .earn-summary { grid-template-columns: 1fr 1fr 1fr; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .sum-cards    { grid-template-columns: 1fr; }
  .auth-card    { padding: 24px 18px; }
  .admin-stat-grid { grid-template-columns: repeat(2,1fr); }
}
