/* ═══════════════════════════════════════════════
   QASH — Premium UI Redesign (v2)
   ═══════════════════════════════════════════════ */


:root {
  /* Core Colors */
  --green: #00E676;
  --green-dark: #00C853;
  --green-dim: rgba(0, 230, 118, 0.12);
  --green-glow: rgba(0, 230, 118, 0.3);
  
  --gold: #FFC400;
  --gold-dim: rgba(255, 196, 0, 0.12);
  
  --danger: #FF5252;
  --danger-dim: rgba(255, 82, 82, 0.12);
  
  --info: #448AFF;
  --info-dim: rgba(68, 138, 255, 0.12);
  
  /* Theme Backgrounds */
  --bg: #090B0E;
  --bg-gradient: radial-gradient(circle at top right, #0F1823 0%, #090B0E 100%);
  --bg2: #11151A;
  --card: rgba(20, 25, 33, 0.7);
  --card-solid: #141921;
  --card-hover: rgba(25, 31, 40, 0.9);
  
  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --border-green: rgba(0, 230, 118, 0.25);
  
  /* Text */
  --text: #F0F4F8;
  --text-muted: #8B9BB4;
  
  /* Layout */
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-drop: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(0, 230, 118, 0.15);
  --transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: 90px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.03em; }

/* ── Animations ────────────────────────────── */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 10px rgba(0,230,118,0.2); } 50% { box-shadow: 0 0 25px rgba(0,230,118,0.4); } }
@keyframes rotateGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.animate-in { animation: fadeInUp 0.4s ease both; }
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ── Navigation ────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 11, 14, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-logo {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fff, var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.05em;
}
.topbar-balance {
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid var(--border-green);
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green);
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(17, 21, 26, 0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  text-decoration: none;
  gap: 4px;
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; stroke: var(--text-muted); fill: none; stroke-width: 2; transition: var(--transition); }
.nav-item span { font-size: 0.65rem; font-weight: 600; color: var(--text-muted); transition: var(--transition); }
.nav-item.active svg { stroke: var(--green); filter: drop-shadow(0 0 5px var(--green-glow)); }
.nav-item.active span { color: var(--green); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--green); border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 8px var(--green-glow);
}

/* ── UI Components ─────────────────────────── */
.page { padding: 20px; max-width: 500px; margin: 0 auto; }

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-light); background: var(--card-hover); }

.btn {
  display: block; width: 100%; padding: 16px; border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; transition: var(--transition);
  text-align: center; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.2);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(0, 230, 118, 0.35); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,82,82,0.3); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; width: auto; display: inline-block; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
}
.badge-green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,230,118,0.2); }
.badge-gold { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(255,196,0,0.2); }
.badge-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,82,82,0.2); }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ── Forms ─────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.form-input {
  width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); font-family: inherit; font-size: 1rem; transition: var(--transition);
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-dim); outline: none; }
.form-input::placeholder { color: rgba(255,255,255,0.3); }

/* ── Modals ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-bottom: none;
  border-radius: 24px 24px 0 0; width: 100%; max-width: 500px; padding: 24px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-drop);
  animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 5px; background: rgba(255,255,255,0.2); border-radius: 3px; margin: 0 auto 24px; }

/* ── Hero Balance ──────────────────────────── */
.balance-hero {
  background: linear-gradient(135deg, rgba(20,25,33,0.8) 0%, rgba(10,15,20,0.9) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px 24px; text-align: center; position: relative; overflow: hidden; margin-bottom: 24px;
}
.balance-hero::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at center, rgba(0,230,118,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.balance-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 8px; }
.balance-amount {
  font-size: 2.8rem; font-weight: 900; color: #fff; letter-spacing: -0.04em; line-height: 1.1;
  text-shadow: 0 0 20px rgba(255,255,255,0.1);
}
.balance-currency { font-size: 0.9rem; color: var(--green); font-weight: 700; margin-top: 8px; }

/* ── Stats Grid ────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: var(--transition); display: flex; flex-direction: column; justify-content: space-between;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; margin-bottom: 12px; }
.stat-value { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.stat-value.green { color: var(--green); }

/* ── Task Elements ─────────────────────────── */
.task-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 12px; transition: var(--transition); position: relative; overflow: hidden;
}
.task-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green); opacity: 0.5;
}
.task-reward { font-size: 1.1rem; font-weight: 800; color: var(--green); }
.task-progress-bar { height: 6px; background: rgba(0,0,0,0.3); border-radius: 3px; margin: 12px 0; overflow: hidden; }
.task-progress-fill { height: 100%; background: linear-gradient(90deg, var(--green-dark), var(--green)); border-radius: 3px; }

/* ── Pill Tabs ─────────────────────────────── */
.pill-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px; scrollbar-width: none; }
.pill-tab {
  padding: 10px 20px; border-radius: 30px; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--card); border: 1px solid var(--border); color: var(--text-muted); transition: var(--transition);
}
.pill-tab.active { background: var(--green); color: #000; border-color: var(--green); box-shadow: 0 4px 12px rgba(0,230,118,0.3); }

/* ── Providers (MTN/Airtel) ────────────────── */
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.provider-card {
  border: 2px solid var(--border) !important; border-radius: var(--radius) !important; padding: 16px 12px !important;
  text-align: center; cursor: pointer; transition: var(--transition); color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.provider-card:hover {
  border-color: var(--border-light) !important;
  background: rgba(255, 255, 255, 0.03);
}
.provider-card.selected {
  border-color: var(--green) !important; background: var(--green-dim); color: var(--text);
  box-shadow: 0 0 15px rgba(0,230,118,0.15);
}
.provider-card.selected:hover {
  border-color: var(--green) !important;
  background: var(--green-dim);
}
.provider-logo-container {
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px;
  transition: var(--transition);
}
.provider-card:hover .provider-logo-container {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}
.provider-card.selected .provider-logo-container {
  background: rgba(0, 230, 118, 0.05);
  border-color: rgba(0, 230, 118, 0.15);
}
.provider-logo {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 6px;
}
.provider-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}
.provider-card.selected .provider-name {
  color: var(--green);
}

/* ── Transactions ──────────────────────────── */
.tx-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.tx-item:last-child { border-bottom: none; }
.tx-icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.tx-credit { background: var(--green-dim); color: var(--green); }
.tx-debit { background: var(--danger-dim); color: var(--danger); }
.tx-pending { background: var(--gold-dim); color: var(--gold); animation: pulseGlow 2s infinite; }
.tx-amount { font-size: 1rem; font-weight: 800; }
.tx-amount.credit { color: var(--green); }

/* ── Toasts ────────────────────────────────── */
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; width: 90%; max-width: 400px; pointer-events: none; }
.toast {
  padding: 16px 20px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600;
  background: rgba(20,25,33,0.95); backdrop-filter: blur(10px); border: 1px solid var(--border);
  box-shadow: var(--shadow-drop); animation: toastIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
}
.toast-success { border-left: 4px solid var(--green); }
.toast-error { border-left: 4px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── Skeletons ─────────────────────────────── */
.skeleton-loader { display: flex; flex-direction: column; gap: 12px; }
.skeleton-card {
  height: 100px; border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s linear infinite;
}

/* ── Poll Waiting UI ───────────────────────── */
.payment-waiting {
  text-align: center; padding: 20px 0;
}
.spinner {
  width: 50px; height: 50px; border: 4px solid var(--border); border-top-color: var(--green);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Referrals ─────────────────────────────── */
.referral-code-box {
  background: rgba(0,0,0,0.2); border: 2px dashed var(--border-green); border-radius: var(--radius);
  padding: 24px; text-align: center; margin: 16px 0; position: relative; overflow: hidden;
}
.referral-code { font-size: 2.2rem; font-weight: 900; letter-spacing: 0.2em; color: var(--green); }/* Mobile-first refinements */
html { width: 100%; overflow-x: hidden; }
body { width: 100%; overflow-x: hidden; }
img, svg { max-width: 100%; }
button, input, select, textarea { min-width: 0; }

@media (max-width: 600px) {
  body {
    min-height: 100dvh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    background-attachment: scroll;
  }
  .page {
    width: 100%;
    max-width: none;
    padding: 16px;
  }
  .topbar {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  }
  .topbar-logo { font-size: 1.3rem; }
  .topbar-balance { max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  h1 { font-size: clamp(1.55rem, 8vw, 2rem); }
  h2 { font-size: clamp(1.3rem, 6vw, 1.65rem); }
  .card { padding: 16px; border-radius: 16px; }
  .balance-hero { padding: 24px 16px; }
  .balance-amount { font-size: clamp(2rem, 12vw, 2.8rem); overflow-wrap: anywhere; }
  .modal-overlay { padding-top: env(safe-area-inset-top, 0px); }
  .modal {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  .form-input { min-height: 48px; font-size: 16px; }
  .btn { min-height: 48px; padding: 14px 16px; }
  .provider-card { min-height: 104px; padding: 12px 8px !important; }
  .provider-logo-container { height: 44px; }
  #toast-container {
    top: calc(10px + env(safe-area-inset-top, 0px));
    width: calc(100% - 24px);
  }
  .toast { padding: 14px 16px; overflow-wrap: anywhere; }
  .referral-code { font-size: clamp(1.35rem, 8vw, 2.2rem); letter-spacing: 0.12em; }
  .tx-item { gap: 10px; }
}

@media (max-width: 350px) {
  .provider-grid, .stat-grid { grid-template-columns: 1fr; }
  .nav-item span { font-size: 0.58rem; }
.task-card-interactive { cursor: pointer; }
.task-card-interactive:active { transform: scale(0.99); }
