:root {
  --primary-dark: #0d2137;
  --primary: #1a3a5c;
  --primary-medium: #2563eb;
  --primary-light: #3b82f6;
  --accent-blue: #60a5fa;
  --accent-green: #10b981;
  --accent-gold: #f59e0b;
  --bg-light: #f0f4f8;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-white: #ffffff;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #10b981;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============ AUTH PAGES ============ */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-medium) 100%);
  padding: 20px;
}

.auth-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.5s ease-out;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-img {
  margin-bottom: 12px;
}

.auth-logo-img img {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.auth-logo h1 {
  font-size: 24px;
  color: var(--primary-dark);
  font-weight: 800;
}

.auth-logo .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-card h2 {
  font-size: 20px;
  margin-bottom: 24px;
  color: var(--primary-dark);
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
  background: var(--bg-white);
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary-medium);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-medium), var(--primary));
  color: var(--text-white);
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #059669);
  color: var(--text-white);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: var(--text-white);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-medium);
  color: var(--primary-medium);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--primary-medium);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

/* ============ MAIN APP LAYOUT ============ */
.app-container {
  min-height: 100vh;
  padding-bottom: 70px;
}

.app-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--text-white);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
}

.header-balance {
  font-size: 14px;
  opacity: 0.9;
}

.header-balance span {
  font-weight: 700;
  color: var(--accent-gold);
}

.page-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 160px;
  animation: fadeIn 0.3s ease-out;
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
  border: none;
  background: none;
  font-size: 10px;
}

.nav-item.active {
  color: var(--primary-medium);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item span {
  font-weight: 600;
}

/* ============ HOME PAGE ============ */
.balance-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-medium));
  color: var(--text-white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.4s ease-out;
}

.balance-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.balance-label {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.balance-amount {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 16px;
}

.balance-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-item {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.stat-label {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  margin-top: 8px;
}

.plan-card-mini {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideUp 0.3s ease-out;
}

.plan-card-mini .plan-name {
  font-weight: 600;
  font-size: 14px;
}

.plan-card-mini .plan-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.plan-card-mini .plan-daily {
  color: var(--accent-green);
  font-weight: 700;
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.bonus-banner {
  background: linear-gradient(135deg, var(--accent-gold), #d97706);
  color: var(--text-white);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: pulse 2s infinite;
}

.bonus-banner .text {
  font-size: 14px;
  font-weight: 600;
}

/* ============ HOME PLANS GRID ============ */
.home-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.home-plan-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: slideUp 0.4s ease-out;
}

.home-plan-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  transform: scale(1.1);
  transform-origin: center center;
}

.home-plan-info {
  padding: 10px 8px;
  text-align: center;
}

.home-plan-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-plan-price {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary-medium);
}

.home-plan-return {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 2px;
}

.home-plan-btn {
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--primary-medium), var(--primary));
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.home-plan-btn:active {
  opacity: 0.8;
}

/* 7th card alone in last row */
.home-plans-grid .home-plan-card:nth-child(7) {
  grid-column: 1 / -1;
  max-width: 50%;
  justify-self: center;
}

/* Home top logo */
.home-top-logo {
  text-align: center;
  padding: 12px 0 8px;
}

.home-top-logo img {
  width: 180px;
  height: 180px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.home-top-logo .brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 6px;
}

/* ============ PACKAGES ============ */
.packages-grid {
  display: grid;
  gap: 14px;
}

.package-card {
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text-white);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: slideUp 0.4s ease-out;
}

.package-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.package-card.p1 { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.package-card.p2 { background: linear-gradient(135deg, #1e3a5f, #2563eb); }
.package-card.p3 { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.package-card.p4 { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.package-card.p5 { background: linear-gradient(135deg, #b45309, #f59e0b); }
.package-card.p6 { background: linear-gradient(135deg, #be123c, #fb7185); }
.package-card.p7 { background: linear-gradient(135deg, #0d2137, #1e40af); }

.package-card::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.package-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 22px;
}

.package-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.package-price {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
}

.package-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.package-detail-item {
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}

.package-detail-item .label {
  font-size: 10px;
  opacity: 0.8;
  text-transform: uppercase;
}

.package-detail-item .value {
  font-size: 16px;
  font-weight: 700;
}

.package-buy-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(255,255,255,0.5);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  z-index: 1;
}

.package-buy-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ============ DEPOSIT PAGE ============ */
.deposit-methods {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.method-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease-out;
}

.method-card h3 {
  font-size: 16px;
  color: var(--primary-dark);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.copy-btn {
  padding: 4px 12px;
  background: var(--primary-medium);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--primary);
}

.copy-btn.copied {
  background: var(--accent-green);
}

.detail-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.detail-row-inline .detail-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-bold {
  font-weight: 800;
  color: var(--danger);
  font-size: 15px;
  text-align: center;
  padding: 12px;
  background: #fef2f2;
  border-radius: var(--radius-sm);
  border: 2px solid #fecaca;
  margin-bottom: 16px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  margin-top: 12px;
}

.upload-zone:hover {
  border-color: var(--primary-medium);
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-zone .icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-zone .text {
  font-size: 14px;
  color: var(--text-muted);
}

.upload-zone .filename {
  font-size: 13px;
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 6px;
}

/* ============ WITHDRAW PAGE ============ */
.withdraw-info {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
}

.fee-breakdown {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}

.fee-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.fee-row.total {
  border-top: 2px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
  font-size: 16px;
}

/* ============ TEAM PAGE ============ */
.team-referral-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-medium));
  color: var(--text-white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  animation: slideUp 0.3s ease-out;
}

.team-referral-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.referral-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.referral-link-box .link {
  flex: 1;
  font-size: 13px;
  word-break: break-all;
  opacity: 0.9;
}

.team-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.team-stat {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.team-stat .value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-medium);
}

.team-stat .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.recruit-card {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease-out;
}

.recruit-card .name {
  font-weight: 700;
  font-size: 15px;
}

.recruit-card .info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.recruit-card .badge {
  display: inline-block;
  background: var(--accent-green);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
  font-weight: 600;
}

/* ============ PROFILE PAGE ============ */
.profile-header {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-medium));
  color: var(--text-white);
  border-radius: var(--radius);
  margin-bottom: 20px;
  animation: slideUp 0.3s ease-out;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  font-weight: 800;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
}

.profile-phone {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 4px;
}

.profile-info-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.profile-info-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary-dark);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.profile-row:last-child { border-bottom: none; }

.profile-row .label { color: var(--text-muted); }
.profile-row .value { font-weight: 600; }

/* ============ TRANSACTIONS LIST ============ */
.tx-list { margin-top: 12px; }

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: slideUp 0.3s ease-out;
}

.tx-item:last-child { border-bottom: none; }

.tx-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
  flex-shrink: 0;
}

.tx-icon.deposit { background: #dcfce7; color: #16a34a; }
.tx-icon.withdrawal { background: #fee2e2; color: #dc2626; }
.tx-icon.profit { background: #dbeafe; color: #2563eb; }
.tx-icon.bonus { background: #fef3c7; color: #d97706; }
.tx-icon.referral { background: #f3e8ff; color: #9333ea; }
.tx-icon.investment { background: #ffe4e6; color: #e11d48; }

.tx-details { flex: 1; }
.tx-desc { font-size: 13px; font-weight: 600; }
.tx-date { font-size: 11px; color: var(--text-muted); }
.tx-amount { font-weight: 700; font-size: 14px; }
.tx-amount.positive { color: var(--accent-green); }
.tx-amount.negative { color: var(--danger); }

/* ============ ADMIN ============ */
.admin-login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  padding: 20px;
}

.admin-tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 8px 0;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.admin-tab {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-white);
  color: var(--text-muted);
  transition: all 0.2s;
}

.admin-tab.active {
  background: var(--primary-medium);
  color: white;
}

.admin-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  background: #ef4444;
  color: white;
  animation: badgePulse 2s ease-in-out infinite;
}

.admin-tab.active .tab-badge {
  background: white;
  color: var(--primary-medium);
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.admin-card {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.admin-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.admin-card .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.admin-stat .value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-medium);
}

.admin-stat .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-user-detail {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.admin-user-detail h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-grid-item {
  padding: 8px;
  background: var(--bg-light);
  border-radius: 6px;
}

.detail-grid-item .label {
  font-size: 11px;
  color: var(--text-muted);
}

.detail-grid-item .value {
  font-size: 14px;
  font-weight: 600;
}

.proof-viewer {
  margin-top: 12px;
}

.proof-viewer img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.proof-viewer a {
  display: inline-block;
  padding: 8px 16px;
  background: var(--primary-medium);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

/* ============ WHATSAPP FLOAT ============ */
.whatsapp-float {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25D366;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37,211,102,0.4);
  z-index: 300;
  cursor: pointer;
  transition: transform 0.2s;
  animation: bounceIn 0.5s ease-out;
}

.whatsapp-float:hover {
  transform: scale(1.1);
}

.whatsapp-float svg {
  width: 30px;
  height: 30px;
  fill: white;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--primary-dark);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  animation: slideDown 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.toast.success { background: var(--accent-green); }
.toast.error { background: var(--danger); }

/* ============ LOADING ============ */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-medium);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ============ RESPONSIVE ============ */

/* Add safe area padding for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    height: calc(60px + env(safe-area-inset-bottom));
  }
  .app-container {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
  .whatsapp-float {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* Tablets and small desktops */
@media (min-width: 601px) {
  .page-content {
    max-width: 500px;
    padding: 20px;
    padding-bottom: 160px;
  }
  .bottom-nav {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}

/* Mobile - all sizes */
@media (max-width: 600px) {
  .auth-card {
    padding: 28px 20px;
    border-radius: 16px;
  }

  .auth-logo-img img {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .auth-logo h1 {
    font-size: 20px;
  }

  .app-header {
    padding: 12px 16px;
  }

  .header-title {
    font-size: 16px;
  }

  .header-balance {
    font-size: 12px;
  }

  .page-content {
    padding: 12px;
    padding-bottom: 160px;
  }

  /* Home plans grid */
  .home-plans-grid {
    gap: 10px;
  }

  .home-plan-img {
    height: 110px;
  }

  .home-plan-info {
    padding: 8px 6px;
  }

  .home-plan-name {
    font-size: 11px;
  }

  .home-plan-price {
    font-size: 14px;
  }

  .home-plan-return {
    font-size: 10px;
  }

  .home-plan-btn {
    padding: 7px;
    font-size: 11px;
  }

  .home-top-logo img {
    width: 120px;
    height: 120px;
    border-radius: 20px;
  }

  .home-top-logo .brand {
    font-size: 12px;
  }

  .home-plans-grid .home-plan-card:nth-child(7) {
    max-width: 50%;
  }

  /* Bottom nav - touch friendly */
  .bottom-nav {
    padding: 6px 0 4px;
  }

  .nav-item {
    padding: 6px 8px;
    min-width: 0;
    flex: 1;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .nav-item span {
    font-size: 9px;
  }

  /* Balance card */
  .balance-card {
    padding: 18px;
    border-radius: 10px;
  }

  .balance-amount {
    font-size: 28px;
  }

  .stat-value {
    font-size: 16px;
  }

  /* Package cards */
  .package-card {
    padding: 18px;
  }

  .package-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .package-name {
    font-size: 16px;
  }

  .package-price {
    font-size: 24px;
  }

  .package-detail-item .value {
    font-size: 14px;
  }

  .package-buy-btn {
    padding: 12px;
    font-size: 15px;
  }

  /* Method cards */
  .method-card {
    padding: 16px;
  }

  .method-card h3 {
    font-size: 14px;
  }

  .detail-row-inline {
    flex-wrap: wrap;
  }

  .detail-row-inline .detail-value {
    font-size: 13px;
  }

  .copy-btn {
    padding: 6px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Bonus banner */
  .bonus-banner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 14px;
  }

  /* Withdraw */
  .withdraw-info {
    font-size: 12px;
    padding: 12px;
  }

  .form-group input, .form-group select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 14px;
  }

  /* Team */
  .team-referral-card {
    padding: 16px;
  }

  .referral-link-box .link {
    font-size: 11px;
  }

  .team-stat .value {
    font-size: 20px;
  }

  /* Profile */
  .profile-header {
    padding: 20px;
  }

  .profile-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  .profile-name {
    font-size: 18px;
  }

  .profile-info-card {
    padding: 16px;
  }

  .profile-row {
    font-size: 13px;
  }

  /* Transactions */
  .tx-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
    margin-right: 10px;
  }

  .tx-desc {
    font-size: 12px;
  }

  .tx-date {
    font-size: 10px;
  }

  .tx-amount {
    font-size: 13px;
  }

  /* Admin */
  .admin-tab {
    padding: 8px 12px;
    font-size: 11px;
  }

  .admin-card {
    padding: 14px;
  }

  .admin-stat .value {
    font-size: 18px;
  }

  .admin-actions {
    gap: 4px;
  }

  .admin-actions .btn {
    font-size: 11px;
    padding: 6px 10px;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .detail-grid-item {
    padding: 6px;
  }

  .detail-grid-item .value {
    font-size: 12px;
  }

  /* WhatsApp float */
  .whatsapp-float {
    width: 50px;
    height: 50px;
    right: 12px;
  }

  .whatsapp-float svg {
    width: 26px;
    height: 26px;
  }

  /* Plan card mini */
  .plan-card-mini {
    padding: 12px;
  }

  .plan-card-mini .plan-name {
    font-size: 13px;
  }

  .plan-card-mini .plan-daily {
    font-size: 14px;
  }

  /* Section title */
  .section-title {
    font-size: 15px;
  }

  /* Recruit card */
  .recruit-card {
    padding: 12px;
  }

  /* Toast */
  .toast {
    font-size: 13px;
    padding: 10px 18px;
    max-width: 90vw;
  }

  /* Buttons */
  .btn {
    padding: 14px 20px;
    font-size: 15px;
    min-height: 48px; /* Touch target */
  }

  .btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 40px;
  }

  .btn-xs {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
  }
}

/* Very small screens (320px and below) */
@media (max-width: 320px) {
  .auth-card {
    padding: 20px 16px;
  }

  .auth-logo h1 {
    font-size: 18px;
  }

  .balance-amount {
    font-size: 24px;
  }

  .package-price {
    font-size: 20px;
  }

  .nav-item span {
    font-size: 8px;
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .home-plans-grid {
    gap: 6px;
  }

  .home-plan-img {
    height: 60px;
  }

  .home-plans-grid .home-plan-card:nth-child(7) {
    max-width: 100%;
    grid-column: 1 / -1;
  }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-container {
    padding: 10px;
  }

  .auth-card {
    padding: 16px;
  }

  .auth-logo {
    margin-bottom: 12px;
  }

  .auth-logo-img img {
    width: 48px;
    height: 48px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* Optional: uncomment to enable auto dark mode */
  /* body { background: #0f172a; color: #e2e8f0; } */
}

/* Print styles - hide nav and float */
@media print {
  .bottom-nav, .whatsapp-float, .app-header {
    display: none !important;
  }
  .app-container {
    padding-bottom: 0;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn:hover, .nav-item:hover, .package-card:hover {
    transform: none;
  }

  .package-buy-btn:active {
    background: rgba(255,255,255,0.4);
  }

  .copy-btn:active {
    transform: scale(0.95);
  }

  .nav-item:active {
    opacity: 0.7;
  }
}

/* Status badges */
.badge-pending { background: #fef3c7; color: #92400e; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-approved { background: #dcfce7; color: #16a34a; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-rejected { background: #fee2e2; color: #dc2626; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-white);
  color: var(--text-muted);
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--primary-medium);
  color: white;
}

/* Edit form */
.edit-form {
  display: grid;
  gap: 12px;
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--primary-medium);
  cursor: pointer;
  border: none;
  background: none;
  font-weight: 600;
  margin-bottom: 12px;
  padding: 4px 0;
}
