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

:root {
  --bg: #0A1628;
  --bg-soft: #0F1F35;
  --primary: #1E90FF;
  --primary-light: #00BFFF;
  --card: #FFFFFF;
  --text-dark: #0A1628;
  --text-light: #FFFFFF;
  --text-muted: #8B9BB4;
  --success: #22C55E;
  --danger: #EF4444;
  --border: #1E3050;
}

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

body {
  padding-bottom: 70px;
  padding-top: 60px;
}

/* ============ HEADER ============ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.header-title h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
}

.header-title span {
  font-size: 11px;
  color: var(--text-muted);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}

.icon-btn:active { background: var(--bg-soft); }

/* ============ PAGE ============ */
.page {
  display: none;
  padding: 16px;
  animation: fadeIn 0.2s;
}

.page.active { display: block; }

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

.page-title {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--text-light);
}

/* ============ HERO ============ */
.hero {
  position: relative;
  padding: 24px 20px;
  background: linear-gradient(135deg, #0F1F35 0%, #1E3A5F 100%);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.hero-text h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.hero-text h2 span { color: var(--primary-light); }
.hero-text p { color: var(--text-muted); font-size: 13px; }

/* ============ PROMO CARD ============ */
.promo-card {
  background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 50%, #0C4A6E 100%);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.promo-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(0,191,255,0.15) 0%, transparent 70%);
}

.promo-content { position: relative; z-index: 1; }

.promo-content h3 {
  font-size: 20px;
  color: #fff;
  font-style: italic;
}

.promo-content h2 {
  font-size: 28px;
  color: var(--primary-light);
  font-style: italic;
  font-weight: 900;
  margin-bottom: 4px;
}

.promo-content p {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
}

.promo-badge {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(0,191,255,0.5);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.trust-badges {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.trust-badges span {
  font-size: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 5px 10px;
  border-radius: 20px;
  color: #fff;
}

/* ============ SEARCH ============ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 14px;
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ============ FILTER ============ */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
}

/* ============ PRODUCT GRID ============ */
.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.product-card {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s;
}

.product-img {
  width: 100%;
  aspect-ratio: 16/10;
  background: #E5E7EB;
  overflow: hidden;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-info {
  padding: 10px;
}

.product-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 4px;
}

.price {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.stock-badge {
  font-size: 9px;
  color: var(--success);
  background: #DCFCE7;
  padding: 3px 7px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-badge.empty {
  color: var(--danger);
  background: #FEE2E2;
}

.btn-buy {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-buy:active { background: #1873CC; }

.btn-buy:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
}

/* ============ PROFILE ============ */
.profile-header {
  text-align: center;
  padding: 20px 0;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 12px;
}

.profile-header h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.membership {
  display: inline-block;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.balance-card {
  background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.balance-label {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
}

.balance-amount {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 14px;
}

.btn-topup {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.profile-menu {
  background: var(--bg-soft);
  border-radius: 14px;
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
}

.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--bg); }

/* ============ ORDERS ============ */
.order-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.order-name {
  font-size: 14px;
  font-weight: 700;
}

.order-status {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.status-SUCCESS { background: #DCFCE7; color: #15803D; }
.status-PENDING { background: #FEF3C7; color: #A16207; }
.status-FAILED, .status-EXPIRED { background: #FEE2E2; color: #B91C1C; }

.order-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.order-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 18px;
}

.nav-item label {
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

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

/* ============ MODAL ============ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
  background: var(--bg-soft);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  position: relative;
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 50%;
}

.modal-close:active { background: var(--bg); }

.checkout-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-light);
  text-align: center;
  margin-bottom: 20px;
}

.checkout-method {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.checkout-method label {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
}

.checkout-method input[type="radio"] {
  accent-color: var(--primary);
  width: 18px; height: 18px;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:active { background: #1873CC; }
.btn-primary:disabled { background: #475569; cursor: not-allowed; }

.btn-secondary {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  margin-top: 10px;
}

.qris-img {
  width: 100%;
  max-width: 260px;
  margin: 0 auto 16px;
  display: block;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.qris-total {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-light);
  margin-bottom: 8px;
}

.qris-status {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ============ TOPUP ============ */
.topup-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.topup-opt {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.topup-opt.active {
  background: var(--primary);
  border-color: var(--primary);
}

.topup-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
}

.topup-input::placeholder { color: var(--text-muted); }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  transition: transform 0.3s;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* ============ LOADING ============ */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}