/* ==========================================================
   NSHTGHL - PHASE 3: MONETIZATION, PAYMENTS & AFFILIATE
   - Instant Online Checkout (Paymob)
   - Affiliate & Referral Dashboard, Wallet & Payout System
   ========================================================== */

/* Affiliate Hero Banner */
.affiliate-hero-card {
  background: radial-gradient(circle at 15% 25%, rgba(37, 99, 235, 0.22) 0%, rgba(15, 23, 42, 0.95) 75%);
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.affiliate-hero-card::after {
  content: "";
  position: absolute;
  top: -50px;
  left: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* The banner background is dark in both themes, so its text must stay light
   (in light mode it inherited dark text and was nearly unreadable). */
.affiliate-hero-card { color: #e2e8f0; }
.affiliate-hero-card .feature-view-title { color: #ffffff; }
.affiliate-hero-card .feature-view-subtitle { color: #cbd5e1; }
.affiliate-hero-card .feature-view-subtitle strong { color: #ffffff; }
.affiliate-hero-card .share-pills-row > span { color: #cbd5e1 !important; }
.affiliate-hero-card .referral-link-input { color: #93c5fd; }
.affiliate-hero-card .share-pill-btn { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; border-color: rgba(255, 255, 255, 0.22); }

[dir="ltr"] .affiliate-hero-card::after {
  left: auto;
  right: -50px;
}

/* Affiliate Referral Link Generator Box */
.referral-link-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Icon + link column: may shrink on 320px screens (the input used to push the box off-screen). */
.referral-link-box > div:first-child { min-width: 0; flex: 1 1 220px !important; }

.referral-link-input {
  background: transparent;
  border: none;
  color: var(--tx-primary);
  font-family: 'Consolas', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  width: 100%;
  outline: none;
  direction: ltr;
  text-align: left;
}

.share-pills-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.share-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-share-whatsapp {
  background: rgba(37, 211, 102, 0.15);
  color: var(--tx-whatsapp);
  border-color: rgba(37, 211, 102, 0.35);
}
.btn-share-whatsapp:hover {
  background: #25d366;
  color: #fff;
}

.btn-share-telegram {
  background: rgba(0, 136, 204, 0.15);
  color: var(--tx-telegram);
  border-color: rgba(0, 136, 204, 0.35);
}
.btn-share-telegram:hover {
  background: #0088cc;
  color: #fff;
}

.btn-share-linkedin {
  background: rgba(10, 102, 194, 0.15);
  color: var(--tx-linkedin);
  border-color: rgba(10, 102, 194, 0.35);
}
.btn-share-linkedin:hover {
  background: #0a66c2;
  color: #fff;
}

/* KPI Stats 4-Grid */
.affiliate-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.affiliate-stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.affiliate-stat-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  transform: translateY(-2px);
}

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.icon-wallet { background: rgba(16, 185, 129, 0.15); color: var(--tx-emerald); }
.icon-friends { background: rgba(37, 99, 235, 0.15); color: var(--tx-primary); }
.icon-conversions { background: rgba(245, 158, 11, 0.15); color: var(--tx-gold); }
.icon-bonus-days { background: rgba(139, 92, 246, 0.15); color: var(--tx-purple); }

.stat-metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Instant Checkout Segmented Toggle */
.checkout-mode-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  margin-bottom: 1.5rem;
  gap: 0.35rem;
}

.checkout-mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.checkout-mode-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Online Checkout Gateway Selectors */
.online-gateways-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.online-gateway-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
}

.online-gateway-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.online-gateway-card.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.gateway-badge-popular {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-gradient);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
}

.gateway-card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.gateway-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.gateway-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Affiliate Ledger Table */
.affiliate-table-wrap {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 1.25rem;
}

.affiliate-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}

[dir="ltr"] .affiliate-table {
  text-align: left;
}

.affiliate-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.9rem 1.2rem;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
}

.affiliate-table td {
  padding: 0.9rem 1.2rem;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.affiliate-table tr:last-child td {
  border-bottom: none;
}

/* Payout Modal Form */
.payout-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 1.5rem;
}
[data-theme="light"] .checkout-mode-switcher { background: #f1f5f9; }
