/* ============== RESET & BASE ============== */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

@font-face {
  font-family: 'Vazir';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazir';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg-1: #0a0220;
  --bg-2: #14072f;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-2: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);

  --text: #ffffff;
  --text-mute: #a89db8;
  --text-soft: #d4cce0;

  --primary: #9d4edd;
  --primary-2: #c77dff;
  --accent: #ff6b9d;
  --gold: #ffd93d;
  --green: #06d6a0;
  --red: #ef476f;
  --blue: #4ea8de;

  --gradient-1: linear-gradient(135deg, #9d4edd 0%, #c77dff 50%, #ff6b9d 100%);
  --gradient-2: linear-gradient(135deg, #4ea8de 0%, #9d4edd 100%);
  --gradient-gold: linear-gradient(135deg, #ffd93d 0%, #ff8c42 100%);
  --gradient-card: linear-gradient(145deg, rgba(157,78,221,0.15) 0%, rgba(255,107,157,0.08) 100%);

  --shadow-soft: 0 10px 40px rgba(157,78,221,0.15);
  --shadow-glow: 0 0 40px rgba(199,125,255,0.3);
}

html, body {
  font-family: 'Vazir', system-ui, -apple-system, sans-serif;
  background: var(--bg-1);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
body { padding-bottom: 90px; }

/* ============== BACKGROUND ============== */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(ellipse at top, var(--bg-2) 0%, var(--bg-1) 50%, #050111 100%);
}
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.4;
  animation: floatBlob 20s ease-in-out infinite;
}
.blob-1 { width: 400px; height: 400px; background: var(--primary); top: -100px; right: -100px; }
.blob-2 { width: 350px; height: 350px; background: var(--accent); bottom: -100px; left: -100px; animation-delay: -7s; }
.blob-3 { width: 300px; height: 300px; background: var(--blue); top: 40%; left: 40%; animation-delay: -14s; }

@keyframes floatBlob {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(50px,-50px) scale(1.1); }
  66% { transform: translate(-30px,40px) scale(0.95); }
}

.grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ============== APP SHELL ============== */
.app {
  max-width: 480px; margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

/* ============== TOP BAR ============== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 6px; margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--gradient-1);
  display: grid; place-items: center;
  font-size: 24px;
  box-shadow: var(--shadow-glow);
  animation: pulse 3s ease-in-out infinite;
}
.brand h1 { font-size: 18px; font-weight: 700; }
.brand p { font-size: 11px; color: var(--text-mute); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 20px; cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover { background: var(--bg-card-2); transform: scale(1.05); }

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(199,125,255,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 50px rgba(199,125,255,0.7); }
}

/* ============== HERO CARD ============== */
.hero-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-strong);
  border-radius: 24px; padding: 20px;
  margin-bottom: 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}
.hero-card::before {
  content: ''; position: absolute; top: -50%; right: -30%;
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(199,125,255,0.3) 0%, transparent 70%);
  pointer-events: none;
}
.hero-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px;
}
.hero-top h2 { font-size: 18px; font-weight: 700; margin-top: 4px; }
.muted { color: var(--text-mute); font-size: 12px; }

.status-pill {
  font-size: 11px; padding: 6px 12px; border-radius: 100px;
  background: rgba(6,214,160,0.15); color: var(--green);
  border: 1px solid rgba(6,214,160,0.3);
  font-weight: 600;
}
.status-pill.warn { background: rgba(255,193,7,0.15); color: #ffc107; border-color: rgba(255,193,7,0.3); }
.status-pill.err { background: rgba(239,71,111,0.15); color: var(--red); border-color: rgba(239,71,111,0.3); }

.balance-box {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.balance-box p { font-size: 11px; color: var(--text-mute); margin-bottom: 4px; }
.balance-box h3 { font-size: 22px; font-weight: 700; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.wallet-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--gradient-1);
  display: grid; place-items: center; font-size: 24px;
}

.hero-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }

.primary-btn {
  background: var(--gradient-1); color: white;
  border: none; padding: 13px; border-radius: 14px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 6px 20px rgba(157,78,221,0.4);
}
.primary-btn:active { transform: scale(0.98); }
.primary-btn.full { width: 100%; margin-top: 10px; }

.ghost-btn {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border-strong); padding: 13px;
  border-radius: 14px; font-weight: 600; font-size: 13px;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.ghost-btn:active { transform: scale(0.98); }
.ghost-btn.full { width: 100%; }

/* ============== STATS ROW ============== */
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 18px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 10px;
  text-align: center; backdrop-filter: blur(10px);
}
.stat-card span { font-size: 22px; display: block; margin-bottom: 4px; }
.stat-card b { font-size: 16px; display: block; }
.stat-card small { font-size: 10px; color: var(--text-mute); }

/* ============== SECTIONS ============== */
.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 18px 4px 12px;
}
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head button {
  background: none; border: none; color: var(--primary-2);
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}

.page-title {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 4px 18px;
}
.page-title h2 { font-size: 18px; font-weight: 700; }
.page-title p { font-size: 12px; color: var(--text-mute); }
.back-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 20px; cursor: pointer;
  display: grid; place-items: center;
}

/* ============== CATEGORY GRID (home) ============== */
.category-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 18px;
  cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
  backdrop-filter: blur(10px);
}
.cat-card:active { transform: scale(0.97); }
.cat-card .cat-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center; font-size: 26px;
  margin-bottom: 10px;
}
.cat-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.cat-card p { font-size: 11px; color: var(--text-mute); }
.cat-card .cat-count {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,0.4); border-radius: 100px;
  padding: 3px 10px; font-size: 10px; color: var(--text-soft);
  font-weight: 700;
}

/* ============== CATEGORY LIST (shop) ============== */
.category-list { display: flex; flex-direction: column; gap: 10px; }
.cat-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all 0.2s;
}
.cat-row:active { transform: scale(0.98); background: var(--bg-card-2); }
.cat-row .row-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center; font-size: 26px; flex-shrink: 0;
}
.cat-row .row-info { flex: 1; min-width: 0; }
.cat-row h3 { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.cat-row p { font-size: 11px; color: var(--text-mute); }
.cat-row .row-arrow { color: var(--text-mute); font-size: 22px; }

/* ============== PLANS GRID ============== */
.plans-grid { display: flex; flex-direction: column; gap: 10px; }
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
  cursor: pointer; transition: all 0.2s;
}
.plan-card:active { transform: scale(0.99); }
.plan-card .plan-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.plan-card h3 { font-size: 14px; font-weight: 700; }
.plan-card .plan-price {
  background: var(--gradient-1); color: white;
  padding: 6px 12px; border-radius: 100px;
  font-size: 12px; font-weight: 700;
}
.plan-card p {
  font-size: 12px; color: var(--text-mute);
  line-height: 1.7; white-space: pre-line;
  max-height: 60px; overflow: hidden;
}

/* ============== GIFTS GRID ============== */
.gift-note {
  background: rgba(255,217,61,0.1);
  border: 1px solid rgba(255,217,61,0.25);
  border-radius: 14px; padding: 12px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.gift-note span { font-size: 20px; }
.gift-note p { font-size: 12px; color: var(--text-soft); }

.gifts-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.gift-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-strong);
  border-radius: 18px; padding: 14px;
  text-align: center; cursor: pointer;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
.gift-card:active { transform: scale(0.97); }
.gift-card::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
}
.gift-img {
  width: 80px; height: 80px;
  margin: 0 auto 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  display: grid; place-items: center;
  position: relative;
  border: 1px solid var(--border);
}
.gift-img img {
  width: 60px; height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(199,125,255,0.4));
  animation: floatGift 3s ease-in-out infinite;
}
@keyframes floatGift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.gift-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.gift-card .gift-stars {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,217,61,0.15);
  color: var(--gold);
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700;
  margin-bottom: 8px;
}
.gift-card .gift-price {
  font-size: 13px; font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ============== PROMO CARD ============== */
.promo-card {
  background: var(--gradient-2);
  border-radius: 20px; padding: 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(78,168,222,0.3);
  position: relative; overflow: hidden;
}
.promo-card::before {
  content: '🎁'; position: absolute;
  font-size: 120px; opacity: 0.08;
  top: -20px; left: -10px;
}
.promo-card h3 { font-size: 15px; margin-bottom: 4px; }
.promo-card p { font-size: 11px; opacity: 0.95; }
.promo-card button {
  background: white; color: var(--primary);
  border: none; padding: 10px 16px; border-radius: 12px;
  font-weight: 700; font-size: 12px; cursor: pointer;
  white-space: nowrap; font-family: inherit;
}

.info-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
  display: flex; align-items: center; gap: 10px;
}
.info-banner span { font-size: 22px; }
.info-banner b { font-size: 13px; }
.info-banner p { font-size: 11px; color: var(--text-mute); }

/* ============== WALLET ============== */
.wallet-card {
  background: var(--gradient-1);
  border-radius: 22px; padding: 24px;
  text-align: center; margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
}
.wallet-card p { font-size: 12px; opacity: 0.9; margin-bottom: 6px; }
.wallet-card h2 { font-size: 26px; font-weight: 700; }

.charge-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 18px;
  margin-bottom: 14px;
}
.charge-card h3 { font-size: 15px; margin-bottom: 6px; }
.charge-card > p { font-size: 12px; color: var(--text-mute); margin-bottom: 12px; }

.input {
  width: 100%; padding: 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-strong);
  border-radius: 12px; color: var(--text);
  font-family: inherit; font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}
.input:focus { border-color: var(--primary); }

.payment-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 18px;
}
.payment-info.hidden { display: none; }
.payment-info h3 { font-size: 15px; margin-bottom: 14px; }
.copy-row {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; cursor: pointer;
  transition: all 0.2s;
}
.copy-row:active { background: rgba(157,78,221,0.15); }
.copy-row span { font-size: 11px; color: var(--text-mute); }
.copy-row b { font-size: 13px; direction: ltr; font-family: monospace; }
.warning-text {
  font-size: 11px; color: var(--text-mute);
  margin: 12px 0; line-height: 1.7;
  text-align: center;
}

/* ============== ORDERS ============== */
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
}
.order-card .order-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.order-card h4 { font-size: 13px; font-weight: 700; }
.order-status {
  font-size: 10px; padding: 3px 8px;
  border-radius: 100px; font-weight: 700;
}
.order-status.completed { background: rgba(6,214,160,0.15); color: var(--green); }
.order-status.pending { background: rgba(255,193,7,0.15); color: #ffc107; }
.order-status.cancelled { background: rgba(239,71,111,0.15); color: var(--red); }
.order-card .order-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-mute);
}
.order-card .order-meta b { color: var(--text-soft); }

.empty-state {
  text-align: center; padding: 40px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
}
.empty-state span { font-size: 50px; display: block; margin-bottom: 10px; }
.empty-state p { color: var(--text-mute); font-size: 13px; }

/* ============== PROFILE ============== */
.profile-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-strong);
  border-radius: 22px; padding: 24px;
  text-align: center; margin-bottom: 14px;
}
.big-avatar {
  width: 90px; height: 90px; border-radius: 26px;
  background: var(--gradient-1);
  display: grid; place-items: center;
  font-size: 42px; margin: 0 auto 12px;
  box-shadow: var(--shadow-glow);
}
.profile-card h2 { font-size: 18px; margin-bottom: 4px; }
.profile-card p { font-size: 12px; color: var(--text-mute); }

.profile-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.profile-grid > div {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
}
.profile-grid span {
  font-size: 11px; color: var(--text-mute);
  display: block; margin-bottom: 6px;
}
.profile-grid b { font-size: 14px; font-weight: 700; }

/* ============== BOTTOM NAV ============== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(20,7,47,0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  z-index: 100;
}
.bn-item {
  flex: 1; background: none; border: none; color: var(--text-mute);
  font-family: inherit; font-size: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; padding: 6px 4px; border-radius: 10px;
  transition: all 0.2s;
}
.bn-item span { font-size: 22px; }
.bn-item.active {
  color: var(--primary-2);
  background: rgba(157,78,221,0.12);
}

/* ============== MODAL ============== */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal.show { display: flex; animation: fadeIn 0.2s; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}
.modal-box {
  position: relative; z-index: 2;
  background: linear-gradient(145deg, #1a0a3a 0%, #14072f 100%);
  border: 1px solid var(--border-strong);
  border-radius: 22px; padding: 22px;
  max-width: 420px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-close {
  position: absolute; top: 12px; left: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 18px; cursor: pointer;
}

/* ============== TOAST ============== */
.toast {
  position: fixed; top: 20px; left: 50%;
  transform: translate(-50%, -100px);
  background: var(--gradient-1); color: white;
  padding: 12px 22px; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: all 0.35s; max-width: 90%;
  box-shadow: 0 10px 30px rgba(157,78,221,0.5);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: linear-gradient(135deg, #ef476f, #d62246); }
.toast.success { background: linear-gradient(135deg, #06d6a0, #048a6b); }

/* ============== LOADER ============== */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-1);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
}
.loader.hidden { display: none; }
.loader-logo {
  font-size: 60px;
  animation: pulse 1.5s ease-in-out infinite;
}
.loader p { color: var(--text-mute); font-size: 13px; }

/* ============== SKELETON ============== */
.skeleton-card {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-2) 50%, var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  height: 110px; border-radius: 18px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============== RESPONSIVE ============== */
@media (min-width: 540px) {
  .app { padding: 24px; }
}
