/* =====================================================
   AFIF MART — style.css
   Mobile-first, tampilan seperti aplikasi Android.
   Tanpa framework, tanpa CDN. Semua ditulis sendiri.
   ===================================================== */

:root {
  --primary: #c62828;
  --primary-dark: #9e1f1f;
  --primary-light: #fdecec;
  --accent: #ff9800;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #15803d;
  --success-bg: #e8f5e9;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --bottomnav-h: 64px;
  --appbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  padding-bottom: calc(var(--bottomnav-h) + 12px); /* ruang untuk bottom nav */
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ UTILITAS ============ */
.container { max-width: 960px; margin: 0 auto; padding: 0 14px; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; } .mb-3 { margin-bottom: 22px; }
.hidden { display: none !important; }

/* ============ APP BAR (atas) ============ */
.appbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--appbar-h);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.appbar-inner {
  max-width: 960px; margin: 0 auto; padding: 0 12px;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; flex: 1; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: #fff;
}
.brand-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { display: block; font-weight: 400; font-size: 11px; opacity: .85; }
.icon-btn {
  position: relative;
  background: transparent; border: 0; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
  width: 42px; height: 42px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(255,255,255,.15); }
.badge-count {
  position: absolute; top: 2px; right: 2px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ============ DRAWER (menu samping) ============ */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  opacity: 0; visibility: hidden; transition: opacity .25s;
  z-index: 90;
}
.drawer-overlay.show { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 85vw;
  background: #fff; z-index: 100;
  transform: translateX(-105%); transition: transform .25s ease;
  display: flex; flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,.2);
}
.drawer.open { transform: translateX(0); }
.drawer-head { background: var(--primary); color: #fff; padding: 18px 16px; }
.drawer-head strong { font-size: 17px; display: block; }
.drawer-head span { font-size: 12px; opacity: .85; }
.drawer nav { padding: 8px 0; overflow-y: auto; flex: 1; }
.drawer nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; color: var(--text); font-size: 15px;
}
.drawer nav a:hover { background: var(--primary-light); text-decoration: none; }
.drawer nav a .di { width: 24px; text-align: center; }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ============ BOTTOM NAVIGATION ============ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--bottomnav-h);
  background: #fff; border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.bottomnav a:hover { text-decoration: none; }
.bottomnav a.active { color: var(--primary); }
.bn-icon { font-size: 21px; line-height: 1; }

/* ============ ANNOUNCEMENT BAR ============ */
.announce {
  background: var(--accent); color: #fff;
  text-align: center; font-size: 13px; font-weight: 600;
  padding: 8px 12px;
}

/* ============ HERO ============ */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border-radius: 0 0 20px 20px;
  padding: 30px 18px 34px; text-align: center;
  margin-bottom: 18px;
}
.hero h1 { font-size: 24px; line-height: 1.3; margin-bottom: 8px; }
.hero p { opacity: .92; font-size: 14px; max-width: 560px; margin: 0 auto 16px; }
.hero-banner { border-radius: var(--radius); margin: 0 auto 14px; max-height: 220px; object-fit: cover; width: 100%; max-width: 640px; }

/* ============ KARTU & GRID PRODUK ============ */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 12px; }
.section-title { font-size: 18px; font-weight: 700; }
.section-link { font-size: 13px; font-weight: 600; }

.product-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.product-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.pc-cover { aspect-ratio: 4/3; background: #e9ebee; overflow: hidden; position: relative; }
.pc-cover img { width: 100%; height: 100%; object-fit: cover; }
.pc-cover .noimg { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 34px; color: #b9bec7; }
.pc-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
}
.pc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.pc-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.pc-name { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-name a { color: var(--text); }
.price { font-size: 16px; font-weight: 800; color: var(--primary); }
.price-strike { font-size: 12px; color: var(--muted); text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.pc-foot { margin-top: auto; padding-top: 6px; }

/* ============ TOMBOL ============ */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 700; text-align: center;
  padding: 12px 20px; border-radius: 10px;
  transition: background .15s;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-wa { background: #1faa53; color: #fff; }
.btn-muted { background: #e5e7eb; color: var(--text); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: var(--bottomnav-h);
  z-index: 55; padding: 10px 14px;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}
.sticky-cta .price { font-size: 19px; }
.sticky-cta .btn { flex: 1; }

/* ============ FORM ============ */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-family: inherit; background: #fff; color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { min-height: 110px; resize: vertical; }
select.form-control { appearance: auto; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkline { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.checkline input { width: 18px; height: 18px; }

/* ============ ALERT & BADGE ============ */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbdfc2; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f3c2c2; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #bcd3f7; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f0dcae; }

.badge-status {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.st-pending { background: var(--warning-bg); color: var(--warning); }
.st-verifikasi { background: var(--info-bg); color: var(--info); }
.st-lunas { background: var(--success-bg); color: var(--success); }
.st-ditolak { background: var(--danger-bg); color: var(--danger); }

/* ============ DETAIL PRODUK ============ */
.detail-cover { border-radius: var(--radius); overflow: hidden; background: #e9ebee; margin-bottom: 14px; }
.detail-cover img { width: 100%; max-height: 380px; object-fit: cover; }
.detail-title { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.chip {
  display: inline-block; padding: 5px 12px; border-radius: 20px;
  background: #eef0f3; color: var(--text); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); cursor: pointer;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.detail-price { font-size: 24px; font-weight: 800; color: var(--primary); margin: 8px 0; }
.detail-desc { font-size: 14.5px; }
.detail-desc h1,.detail-desc h2,.detail-desc h3 { margin: 14px 0 8px; font-size: 17px; }
.detail-desc p { margin-bottom: 10px; }
.detail-desc ul,.detail-desc ol { margin: 0 0 10px 20px; }
.detail-desc img { border-radius: 8px; margin: 8px 0; }
.info-box { background: var(--info-bg); border: 1px solid #bcd3f7; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-top: 14px; }

/* ============ KERANJANG ============ */
.cart-item {
  display: flex; gap: 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; margin-bottom: 10px; align-items: center;
}
.cart-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #e9ebee; }
.cart-item .ci-body { flex: 1; min-width: 0; }
.cart-item .ci-name { font-weight: 600; font-size: 14px; }
.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 17px; font-weight: 800; padding: 14px 4px;
}

/* ============ PEMBAYARAN / ORDER ============ */
.code-box {
  background: #1c1c1e; color: #fff; border-radius: var(--radius);
  padding: 18px; text-align: center; margin-bottom: 14px;
}
.code-box .cb-label { font-size: 12px; opacity: .75; text-transform: uppercase; letter-spacing: 1px; }
.code-box .cb-code { font-size: 24px; font-weight: 800; letter-spacing: 1.5px; margin: 6px 0; }
.bank-item {
  display: flex; gap: 12px; align-items: center;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 10px; background: #fff;
}
.bank-item .bi-bank { font-weight: 800; font-size: 15px; }
.bank-item .bi-num { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.bank-item .bi-name { font-size: 13px; color: var(--muted); }
.bank-item .btn { margin-left: auto; flex-shrink: 0; }

.steps { counter-reset: step; margin: 6px 0 4px 4px; }
.steps li { list-style: none; position: relative; padding: 0 0 14px 34px; font-size: 14px; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.timeline { margin: 10px 0 4px 4px; }
.timeline .tl-item { position: relative; padding: 0 0 16px 30px; font-size: 14px; }
.timeline .tl-item::before {
  content: ""; position: absolute; left: 8px; top: 22px; bottom: -2px; width: 2px; background: var(--border);
}
.timeline .tl-item:last-child::before { display: none; }
.timeline .tl-dot {
  position: absolute; left: 2px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #cfd4da;
}
.timeline .tl-item.done .tl-dot { background: var(--success); }
.timeline .tl-item.now .tl-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }

.proof-img { border-radius: 10px; border: 1px solid var(--border); max-height: 320px; object-fit: contain; background: #fff; }

.dl-item {
  display: flex; gap: 12px; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff;
}
.dl-item .dl-name { font-weight: 600; font-size: 14px; }
.dl-item .dl-meta { font-size: 12px; color: var(--muted); }
.license-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #1c1c1e; color: #7CFFB2;
  padding: 10px 14px; border-radius: 8px; font-size: 15px; letter-spacing: 1px;
  display: inline-block; margin-top: 6px; word-break: break-all;
}

/* ============ PENCARIAN & FILTER ============ */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar .form-control { border-radius: 20px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chips .chip { white-space: nowrap; }
button.chip { font-family: inherit; }

/* ============ FOOTER ============ */
.footer { margin-top: 30px; background: #1c1c1e; color: #d7d7d7; padding: 26px 0 14px; font-size: 13.5px; }
.footer h4 { color: #fff; font-size: 15px; margin-bottom: 10px; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.footer-links a { color: #d7d7d7; }
.footer-bottom { border-top: 1px solid #333; padding-top: 12px; text-align: center; font-size: 12.5px; color: #9a9a9a; }

/* ============ ADMIN ============ */
.admin-shell { min-height: 100vh; }
body.admin-body { padding-bottom: 0; background: #eef0f3; }
.admin-topbar {
  position: sticky; top: 0; z-index: 50;
  background: #1c1c1e; color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; height: 56px;
  width: 100%; max-width: 100vw;
  overflow: hidden; /* isi tidak boleh keluar dari bar */
  box-sizing: border-box;
}
.admin-topbar .brand-name {
  font-size: 15px; font-weight: 700;
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Grup kanan (nama admin + tombol Keluar): selalu satu baris, tidak terpotong */
.admin-topbar .topbar-right {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.admin-topbar .topbar-right form { margin: 0; display: inline-flex; }
@media (max-width: 640px) {
  /* Di layar kecil: sembunyikan embel-embel agar muat */
  .admin-topbar .brand-name .muted { display: none; }
  .admin-topbar .topbar-right .small { display: none; } /* tampilkan hanya tombol Keluar */
  .admin-topbar { gap: 8px; padding: 0 10px; }
}
.admin-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  background: #1c1c1e; color: #d7d7d7; z-index: 100;
  transform: translateX(-105%); transition: transform .25s;
  display: flex; flex-direction: column;
}
.admin-sidebar.open { transform: translateX(0); }
.admin-sidebar .as-head { padding: 18px 16px; color: #fff; font-weight: 800; border-bottom: 1px solid #333; }
.admin-sidebar nav { padding: 10px 0; overflow-y: auto; flex: 1; }
.admin-sidebar nav a {
  display: flex; gap: 12px; align-items: center;
  padding: 11px 18px; color: #d7d7d7; font-size: 14.5px;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: #2c2c2e; color: #fff; text-decoration: none; }
.admin-main { padding: 16px 14px 40px; }
.admin-main h1.page-title { font-size: 21px; margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card .sc-num { font-size: 26px; font-weight: 800; color: var(--primary); }
.stat-card .sc-label { font-size: 13px; color: var(--muted); }

.table-responsive { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data th { background: #f7f8fa; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #e9ebee; }

/* ============ RESPONSIVE: tablet & desktop ============ */
@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .hero h1 { font-size: 30px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 992px) {
  body { font-size: 15.5px; }
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .sticky-cta { display: none; } /* di desktop tombol beli ada di konten */
  .desktop-cta { display: inline-block !important; }
  .drawer { display: none; }
  .drawer-overlay { display: none; }
  #btn-drawer { display: none; }

  /* Admin: sidebar permanen di desktop */
  .admin-sidebar { transform: none; }
  .admin-main { margin-left: 240px; padding: 24px 28px 60px; }
  #btn-admin-menu { display: none; }
}

@media (max-width: 991px) {
  .desktop-cta { display: none; }
}
