/* ═══════════════════════════════════════════════════════════
   styles.css — TokoKu global stylesheet
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:        #0a0f1e;
  --bg2:       #111827;
  --bg3:       #1e293b;
  --card:      #141d2e;
  --border:    #1e293b;
  --accent:    #6366f1;
  --accent2:   #818cf8;
  --green:     #10b981;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --cyan:      #06b6d4;
  --text:      #f1f5f9;
  --muted:     #64748b;
  --muted2:    #94a3b8;
  --radius:    14px;
  --radius-sm: 8px;
  --nav-h:     64px;
  --bottom-h:  68px;
  --font:      'Plus Jakarta Sans', sans-serif;
  --mono:      'JetBrains Mono', monospace;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); font-family: var(--font); color: var(--text); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
#app        { display: flex; flex-direction: column; height: 100dvh; }

#offline-banner {
  display: none;
  background: var(--yellow)22; border-bottom: 1px solid var(--yellow)44;
  text-align: center; font-size: 11px; color: var(--yellow); padding: 5px;
}
#offline-banner.show { display: block; }

#topbar {
  height: var(--nav-h); background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; flex-shrink: 0;
  backdrop-filter: blur(12px); position: relative; z-index: 10;
}
#topbar .logo {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
#topbar .logo p{
  font-size:8px;
  text-align:center;
  display:block;
  margin-top:5px;
}

#topbar .page-title { font-size: 15px; font-weight: 600; flex: 1; }

#sync-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
#sync-dot    { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
#sync-dot.online  { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
#sync-dot.syncing { background: var(--yellow); animation: spin-dot 1s linear infinite; }

#content     { flex: 1; overflow-y: auto; padding: 16px 16px 80px; scroll-behavior: smooth; }
#content::-webkit-scrollbar { display: none; }

#bottomnav {
  height: var(--bottom-h); background: var(--bg2); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around; flex-shrink: 0;
  padding: 0 2px; padding-bottom: env(safe-area-inset-bottom); overflow: hidden;
}

/* ── Nav buttons ────────────────────────────────────────────────────────── */
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 1px; border: none; background: none; cursor: pointer;
  color: var(--muted); transition: color .2s; font-family: var(--font);
  flex: 1; min-width: 0; max-width: 20%; box-sizing: border-box;
}
.nav-btn.active { color: var(--accent2); }
.nav-btn svg    { width: 17px; height: 17px; flex-shrink: 0; }
.nav-btn span   { font-size: 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; text-align: center; }

/* ── Card ───────────────────────────────────────────────────────────────── */
.card    { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-sm { padding: 12px; margin-bottom: 8px; }

/* ── Stat grid ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.stat-card.s-purple::before { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.stat-card.s-green::before  { background: var(--green); }
.stat-card.s-red::before    { background: var(--red); }
.stat-card.s-yellow::before { background: var(--yellow); }
.stat-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-val   { font-size: 20px; font-weight: 800; margin-top: 4px; }
.stat-sub   { font-size: 10px; color: var(--muted2); margin-top: 2px; }

/* ── Section header ─────────────────────────────────────────────────────── */
.sec-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-title   { font-size: 13px; font-weight: 700; color: var(--muted2); text-transform: uppercase; letter-spacing: .5px; }
.sec-action  { font-size: 12px; color: var(--accent2); font-weight: 600; cursor: pointer; }

/* ── Product item ───────────────────────────────────────────────────────── */
.product-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px;
  transition: border-color .2s; cursor: pointer;
}
.product-item:active { border-color: var(--accent); }
.product-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent)22, var(--accent)11);
  border: 1px solid var(--accent)33;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px;
}
.product-info  { flex: 1; min-width: 0; }
.product-name  { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-cat   { font-size: 11px; color: var(--muted); margin-top: 1px; }
.product-price { font-size: 12px; color: var(--cyan); font-weight: 600; margin-top: 2px; font-family: var(--mono); }
.product-stock { text-align: right; flex-shrink: 0; }

.stock-badge   { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; font-family: var(--mono); }
.stock-ok      { background: var(--green)22; color: var(--green); border: 1px solid var(--green)44; }
.stock-low     { background: var(--yellow)22; color: var(--yellow); border: 1px solid var(--yellow)44; }
.stock-out     { background: var(--red)22; color: var(--red); border: 1px solid var(--red)44; }

/* ── Form ───────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 14px; }
.form-label  { font-size: 12px; font-weight: 700; color: var(--muted2); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: .3px; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 14px; padding: 11px 13px; outline: none;
  transition: border-color .2s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--accent); }
.form-textarea       { resize: none; height: 80px; }
.form-select option  { background: var(--bg2); }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ── Margin box ─────────────────────────────────────────────────────────── */
.margin-box {
  background: var(--green)11; border: 1px solid var(--green)33; border-radius: var(--radius-sm);
  padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
  transition: border-color .3s;
}
.margin-label { font-size: 12px; color: var(--muted2); }
.margin-val   { font-size: 15px; font-weight: 800; color: var(--green); font-family: var(--mono); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 700; transition: all .15s; width: 100%;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-primary:active { transform: scale(.97); opacity: .9; }
.btn-success { background: linear-gradient(135deg, var(--green), #34d399); color: #fff; }
.btn-danger  { background: var(--red)22; color: var(--red); border: 1px solid var(--red)44; }
.btn-ghost   { background: var(--bg3); color: var(--muted2); border: 1px solid var(--border); }
.btn-sm      { padding: 8px 14px; font-size: 12px; width: auto; }
.btn-row     { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ── FAB ────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: calc(var(--bottom-h) + 16px); right: 16px;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 24px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--accent)55; z-index: 20; transition: transform .2s;
}
.fab:active { transform: scale(.92); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: #00000088; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border-radius: 20px 20px 0 0; padding: 20px 16px;
  width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 18px; }
.modal-title  { font-size: 17px; font-weight: 800; margin-bottom: 18px; }

/* ── Transaction items ──────────────────────────────────────────────────── */
.tx-item       { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 8px; cursor: pointer; }
.tx-header     { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.tx-customer   { font-size: 14px; font-weight: 700; }
.tx-date       { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.tx-method     { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.tx-cash       { background: var(--green)22; color: var(--green); }
.tx-credit     { background: var(--yellow)22; color: var(--yellow); }
.tx-items-list { font-size: 12px; color: var(--muted2); margin-bottom: 8px; }
.tx-total      { font-size: 15px; font-weight: 800; font-family: var(--mono); }
.tx-status     { font-size: 11px; font-weight: 600; }
.tx-status.paid   { color: var(--green); }
.tx-status.unpaid { color: var(--yellow); }

/* ── Credit card (piutang) ──────────────────────────────────────────────── */
.credit-card     { background: linear-gradient(135deg, #1e1b4b, #312e81); border: 1px solid #4338ca55; border-radius: var(--radius); padding: 16px; margin-bottom: 8px; cursor: pointer; }
.credit-customer { font-size: 15px; font-weight: 700; }
.credit-date     { font-size: 11px; color: var(--muted2); font-family: var(--mono); }
.credit-amount   { font-size: 18px; font-weight: 800; color: var(--yellow); font-family: var(--mono); margin: 8px 0; }
.credit-items    { font-size: 12px; color: var(--muted2); }
.credit-days     { font-size: 11px; color: var(--red); font-weight: 600; margin-top: 6px; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.search-wrap  { position: relative; margin-bottom: 12px; }
.search-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 14px;
  padding: 11px 13px 11px 38px; outline: none;
}
.search-icon  { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }

/* ── Filter chips ───────────────────────────────────────────────────────── */
.filter-row  { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--border); background: var(--bg3); color: var(--muted); cursor: pointer;
}
.filter-chip.active { background: var(--accent)22; border-color: var(--accent); color: var(--accent2); }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty       { text-align: center; padding: 48px 24px; }
.empty-icon  { font-size: 48px; margin-bottom: 12px; }
.empty-text  { color: var(--muted); font-size: 14px; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(var(--bottom-h) + 16px); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 13px; font-weight: 600; z-index: 200;
  opacity: 0; transition: all .3s; white-space: nowrap; pointer-events: none;
}
#toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { border-color: var(--green)66; color: var(--green); }
#toast.error   { border-color: var(--red)66; color: var(--red); }
#toast.info    { border-color: var(--accent)66; color: var(--accent2); }

/* ── Chart ──────────────────────────────────────────────────────────────── */
.chart-bars     { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar      {
  width: 100%; border-radius: 4px 4px 0 0; min-height: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent)88);
  transition: height .5s cubic-bezier(.34, 1.56, .64, 1);
}
.chart-bar-label { font-size: 9px; color: var(--muted); font-family: var(--mono); }

/* ── Cart ───────────────────────────────────────────────────────────────── */
.cart-item   { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cart-qty    { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-family: var(--mono); font-size: 13px; width: 60px; text-align: center; color: var(--text); outline: none; }
.cart-name   { flex: 1; font-size: 13px; font-weight: 600; }
.cart-remove { color: var(--red); border: none; background: none; font-size: 18px; cursor: pointer; padding: 4px; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.section-divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes pulse    { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes spin-dot { to{transform:rotate(360deg)} }
@keyframes fadeIn   { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn .3s ease both; }
