/* ============================================
   PPOB App - Mobile Native CSS
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --secondary: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #1e293b;
  --gray: #64748b;
  --light-gray: #f1f5f9;
  --border: #e2e8f0;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 50px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --nav-h: 64px;
  --bottom-h: 70px;
}

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

html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  background: #f8fafc;
  color: var(--dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Mobile App Shell ---- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--white);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.1);
}

/* ---- Top Nav Bar ---- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.top-bar .top-bar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
  flex: 1;
  text-align: center;
}
.top-bar .btn-back, .top-bar .btn-icon {
  width: 40px; height: 40px;
  border: none; background: var(--light-gray);
  border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; color: var(--dark);
  font-size: 18px; flex-shrink: 0;
  text-decoration: none;
}
.top-bar .btn-back:hover, .top-bar .btn-icon:hover {
  background: var(--border);
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--bottom-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; text-decoration: none; color: var(--gray);
  font-size: 10px; font-weight: 500; padding: 8px 16px;
  border-radius: var(--radius-sm); transition: all .2s;
  min-width: 60px;
}
.bottom-nav a i { font-size: 22px; transition: all .2s; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--primary); }
.bottom-nav a.active i { color: var(--primary); }
.bottom-nav a.active span { color: var(--primary); font-weight: 700; }
.bottom-nav .nav-center-btn {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px;
  box-shadow: 0 4px 14px rgba(99,102,241,.5);
  margin-top: -20px;
  transition: transform .15s;
}
.bottom-nav .nav-center-btn:hover { transform: scale(1.08); color: #fff; }

/* ---- Page Content ---- */
.page-content {
  padding: 0 0 calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom, 0px));
}
.page-content.no-bottom { padding-bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom, 0px)); }

/* ---- Hero / Balance Card ---- */
.balance-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #7c3aed 100%);
  margin: 16px;
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.balance-card::before {
  content: ''; position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.balance-card::after {
  content: ''; position: absolute;
  bottom: -60px; left: -30px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.balance-card .balance-label {
  font-size: 12px; opacity: .8; font-weight: 500; letter-spacing: .4px;
}
.balance-card .balance-amount {
  font-size: 28px; font-weight: 800; margin: 4px 0 16px;
  letter-spacing: -0.5px;
}
.balance-card .balance-actions {
  display: flex; gap: 10px; position: relative; z-index: 1;
}
.balance-card .btn-balance {
  flex: 1; padding: 10px;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: var(--radius-sm);
  color: #fff; font-size: 13px; font-weight: 600;
  text-align: center; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s;
  backdrop-filter: blur(4px);
}
.balance-card .btn-balance:hover {
  background: rgba(255,255,255,.25); color: #fff;
}
.balance-card .user-greeting { font-size: 13px; opacity: .8; margin-bottom: 2px; }
.balance-card .user-name { font-size: 16px; font-weight: 700; }

/* ---- Service Grid ---- */
.section-title {
  font-size: 15px; font-weight: 700; color: var(--dark);
  padding: 16px 16px 8px;
}
.service-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 0 12px 8px;
}
.service-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.service-item:hover { background: var(--light-gray); transform: scale(1.04); }
.service-item .svc-icon {
  width: 48px; height: 48px;
  background: var(--primary-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--primary);
}
.service-item .svc-label {
  font-size: 11px; font-weight: 600; color: var(--dark);
  text-align: center; line-height: 1.3;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.card-body { padding: 16px; }
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
}
.card-header .card-title { font-size: 14px; font-weight: 700; margin: 0; }

/* ---- Transaction List ---- */
.trx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: background .1s;
}
.trx-item:last-child { border-bottom: none; }
.trx-item:hover { background: var(--light-gray); }
.trx-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.trx-icon.success { background: #d1fae5; color: var(--success); }
.trx-icon.pending { background: #fef3c7; color: var(--warning); }
.trx-icon.failed  { background: #fee2e2; color: var(--danger); }
.trx-info { flex: 1; min-width: 0; }
.trx-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trx-sub  { font-size: 12px; color: var(--gray); margin-top: 1px; }
.trx-amount { font-size: 14px; font-weight: 700; text-align: right; white-space: nowrap; }
.trx-amount.debit  { color: var(--danger); }
.trx-amount.credit { color: var(--success); }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px;
  font-weight: 600; color: var(--dark);
  margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font);
  color: var(--dark); background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.input-group {
  display: flex; align-items: stretch;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.input-group .input-addon {
  padding: 0 14px;
  background: var(--light-gray);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex; align-items: center;
  font-size: 15px; font-weight: 600; color: var(--gray);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none; transition: all .15s;
  -webkit-appearance: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--dark);
}
.btn-outline:hover { background: var(--light-gray); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: var(--radius-sm); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

/* ---- Badges & Chips ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: var(--light-gray); color: var(--gray); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }

/* ---- Divider ---- */
.divider {
  height: 1px; background: var(--border);
  margin: 0;
}
.divider-space {
  height: 8px; background: var(--light-gray);
}

/* ---- Auth Pages ---- */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #6366f1 0%, #4f46e5 40%, #7c3aed 100%);
  display: flex; align-items: flex-end;
}
.auth-sheet {
  width: 100%; background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 28px 24px 40px;
  min-height: 65vh;
}
.auth-logo {
  text-align: center; margin-bottom: 24px;
  position: absolute; top: 40px; left: 0; right: 0;
}
.auth-logo i { font-size: 48px; color: #fff; }
.auth-logo .brand { font-size: 22px; font-weight: 800; color: #fff; margin-top: 6px; }
.auth-title { font-size: 22px; font-weight: 800; color: var(--dark); margin: 0 0 4px; }
.auth-sub   { font-size: 14px; color: var(--gray); margin-bottom: 24px; }

/* ---- Product Select Cards ---- */
.product-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer; transition: all .15s;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.product-card:hover { border-color: var(--primary); background: var(--primary-light); }
.product-card.selected { border-color: var(--primary); background: var(--primary-light); }
.product-card .pc-name { font-size: 14px; font-weight: 600; }
.product-card .pc-price { font-size: 13px; color: var(--primary); font-weight: 700; margin-left: auto; }

/* ---- Skeleton Loader ---- */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Overlay / Modal ---- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex; align-items: flex-end;
  justify-content: center;
}
.bottom-sheet {
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 40px;
  width: 100%; max-width: 480px;
  max-height: 80vh; overflow-y: auto;
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

/* ---- Stats Row ---- */
.stats-row {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 16px 16px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.stat-card .stat-label { font-size: 12px; color: var(--gray); font-weight: 500; }
.stat-card .stat-value { font-size: 20px; font-weight: 800; color: var(--dark); margin-top: 2px; }
.stat-card .stat-icon {
  font-size: 20px; margin-bottom: 6px;
}

/* ---- Promo Banner ---- */
.promo-scroll {
  display: flex; gap: 10px;
  padding: 0 16px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.promo-scroll::-webkit-scrollbar { display: none; }
.promo-item {
  flex-shrink: 0; width: 240px; height: 100px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}

/* ---- Pinpad ---- */
.pin-display {
  display: flex; gap: 12px;
  justify-content: center; margin: 20px 0;
}
.pin-dot {
  width: 14px; height: 14px;
  border: 2px solid var(--primary);
  border-radius: 50%; transition: background .15s;
}
.pin-dot.filled { background: var(--primary); }

/* ---- Utility ---- */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-gray    { color: var(--gray); }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.fw-semibold  { font-weight: 600; }
.fs-sm        { font-size: 12px; }
.fs-xs        { font-size: 11px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.p-0  { padding: 0 !important; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--gray);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }

/* ---- Phone Category (Pulsa/Data) ---- */
#product-list {
  max-height: 460px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#product-list::-webkit-scrollbar { width: 4px; }
#product-list::-webkit-scrollbar-track { background: transparent; }
#product-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ---- Desktop frame (desktop tetap ada frame mobile) ---- */
@media (min-width: 480px) {
  body { background: #e2e8f0; }
}
