/* ============================================================
   AGRO MEAT SHOP - POS (base styles)
   ============================================================ */
:root {
  --am-primary: #b22222;
  --am-accent: #1c6e4a;
  --am-dark: #1c1c1c;
  --am-soft: #f6f6f4;
}

body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }

/* store brand */
.brand-title { font-weight: 800; letter-spacing: .5px; }
.brand-tag { font-size: .72rem; opacity: .9; }
/* alamat toko di header (ikon pin + teks rata kanan) */
.brand-address { display: flex; align-items: flex-start; justify-content: flex-end; gap: .4rem; font-size: .72rem; line-height: 1.4; opacity: .92; text-align: right; }
.brand-address i { font-size: .9rem; line-height: 1.1; margin-top: .1rem; }
.brand-address span { max-width: 40ch; }

/* ---------- kasir layout generic ---------- */
/* Layar kasir mengisi persis satu viewport di bawah header (flex kolom penuh);
   kalau tidak, panel kanan memanjang ~seukuran header melewati viewport dan
   blok "total + BAYAR" jatuh tertutup `.am-fkbar` (fixed 62px) — kasir harus
   scroll dulu. `.kasir-wrap` hanya ada di `kasir/kasir.php`, jadi scoping
   `body:has(> .kasir-wrap)` aman untuk halaman POS lain. */
body:has(> .kasir-wrap) { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.kasir-wrap { display: flex; height: 100vh; overflow: hidden; padding-bottom: 62px; }
body:has(> .kasir-wrap) > .kasir-wrap { height: auto; flex: 1 1 auto; min-height: 0; }
.kasir-left { flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; }
.kasir-right { width: 430px; min-width: 390px; display: flex; flex-direction: column; border-left: 1px solid #ddd; }

.prod-scroll { flex: 1 1 auto; overflow-y: auto; padding: .5rem; }
.cat-tabs { display: flex; gap: .35rem; flex-wrap: wrap; padding: .5rem .5rem 0; }
.cat-tab { border: 1px solid #d8d8d8; border-radius: .45rem; padding: .45rem .8rem; font-weight: 600; cursor: pointer; transition: .15s; user-select: none; flex: 0 0 auto; white-space: nowrap; }
.cat-tab.active { color: #fff; border-color: var(--am-primary); background: var(--am-primary); }

.prod-grid { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.tile {
  border: 1px solid #e2e2e2; border-radius: .6rem; padding: .5rem .45rem;
  background: #fff; cursor: pointer; text-align: center; transition: .12s; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.tile:hover { border-color: var(--am-primary); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.12); }
.tile .t-icon { font-size: 1.7rem; line-height: 1; }
.tile .t-name { font-size: .78rem; font-weight: 600; min-height: 2.2em; margin: .2rem 0 .1rem; }
.tile .t-price { font-size: .78rem; color: var(--am-primary); font-weight: 700; }
.tile .t-unit { font-size: .68rem; color: #888; }

.cart-scroll { flex: 1 1 auto; overflow-y: auto; }
.cart-tbl { width: 100%; font-size: .78rem; }
.cart-tbl thead { position: sticky; top: 0; background: #f1f1ef; }
.cart-tbl th, .cart-tbl td { padding: .3rem .4rem; vertical-align: middle; border-bottom: 1px solid #eee; }
.cart-tbl .qty-input { width: 74px; text-align: right; font-weight: 700; }
.cart-note { font-size: .72rem; color: #8a6d3b; font-style: italic; }

.total-tbl { width: 100%; font-size: .8rem; }
.total-tbl td { padding: .22rem .4rem; }
.total-tbl .t-label { color: #555; }
.total-tbl .t-total { font-size: 1.5rem; font-weight: 800; text-align: right; }

.ppn-badge { font-size: .62rem; vertical-align: super; }

.fkeys { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; padding: .5rem; background: #ececea; }
.fkey { border: 1px solid #d3d3d0; background: #fff; border-radius: .45rem; padding: .52rem .3rem; font-size: .74rem; font-weight: 700; cursor: pointer; text-align: center; }
.fkey:hover { background: #f3f3f1; }
.fkey.danger { color: var(--am-primary); }
.fkey.success { color: var(--am-accent); }

.pay-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.pay-btn { border: 1px solid #dcdcdc; border-radius: .6rem; padding: 1rem; background: #fff; cursor: pointer; text-align: center; transition: .12s; }
.pay-btn:hover { border-color: var(--am-primary); background: #fff6f6; }
.pay-btn .p-icon { font-size: 1.6rem; }

.num-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.num-btn { border: 1px solid #d8d8d8; border-radius: .45rem; padding: .8rem 0; background: #fff; font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.num-btn:hover { background: #f0f0ee; }

.receipt-paper {
  font-family: "Courier New", monospace; font-size: .74rem; background: #fff;
  border: 1px dashed #bbb; padding: .6rem .7rem; max-height: 62vh; overflow: auto;
}
.receipt-paper .r-head { text-align: center; border-bottom: 1px dashed #999; padding-bottom: .3rem; margin-bottom: .3rem; }
.receipt-paper table { width: 100%; }
.receipt-paper .r-total { border-top: 1px dashed #999; margin-top: .3rem; padding-top: .3rem; }

/* ============ CETAK STRUK (thermal 58/80mm) ============ */
@media print {
  @page { size: 80mm auto; margin: 4mm; }
  body { background: #fff !important; }
  body.modal-open { overflow: visible !important; padding-right: 0 !important; }
  body.print-receipt > *:not(#receiptModal) { display: none !important; }
  #receiptModal.show {
    position: static; display: block !important; opacity: 1 !important; background: #fff;
    padding: 0; margin: 0;
  }
  #receiptModal.show .modal-dialog {
    margin: 0; transform: none !important; width: auto; max-width: none;
  }
  #receiptModal.show .modal-content { border: 0; box-shadow: none; width: auto; }
  #receiptModal.show .modal-header, #receiptModal.show .modal-footer { display: none !important; }
  #receiptModal.show .modal-body { padding: 0; overflow: visible; }
  #receiptModal.show .receipt-paper {
    max-height: none; overflow: visible; border: 0; padding: 0;
    width: 72mm; margin: 0 auto; font-size: .68rem; line-height: 1.35;
  }
  #receiptModal.show .receipt-paper table td { padding: .05rem 0; }
}

/* ============ KPI LAPORAN ============ */
/* Dipakai app/Views/kasir/laporan.php saja — bukan backoffice,
   makanya tetap di sini dan tidak ikut ke `backoffice.css`. */
.kpi-card { border: 0; border-radius: .75rem; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.kpi-card .k-label { color: #6c757d; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.kpi-card .k-val { font-size: 1.45rem; font-weight: 800; }

/* ============ CUSTOMER DISPLAY (monitor 2) ============ */
:root { --cd-primary: #b22222; --cd-bg: #101010; --cd-primary-2: #1c6e4a; }
.cd-screen { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--cd-bg); color: #fff; }
.cd-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.2rem; background: var(--cd-primary); color: #fff; font-weight: 700; }
.cd-head .cd-store { font-size: 1.2rem; }
.cd-head .cd-outlet { font-size: .85rem; opacity: .9; }
.cd-body { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
.cd-items { overflow-y: auto; padding: .8rem 1rem; }
.cd-item { display: grid; grid-template-columns: 1fr auto; gap: 0 .8rem; padding: .55rem .4rem; border-bottom: 1px solid rgba(255,255,255,.14); font-size: 1.05rem; }
.cd-item-name { font-weight: 600; }
.cd-item-name small { color: #ffd27d; font-style: italic; }
.cd-item-qty { font-size: .85rem; color: #c8c8c8; opacity: .85; }
.cd-item-total { grid-column: 2; font-weight: 800; }
.cd-idle { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 90%; color: #9aa; gap: .4rem; text-align: center; }
.cd-idle i { font-size: 4rem; opacity: .55; }
.cd-idle-title { font-size: 2.6rem; font-weight: 800; letter-spacing: 2px; }
.cd-side { background: var(--cd-primary); color: #fff; padding: 1.1rem; display: flex; flex-direction: column; justify-content: center; }
.cd-total-label { text-transform: uppercase; letter-spacing: 2px; font-size: 1rem; opacity: .9; }
.cd-total { font-size: 3.4rem; font-weight: 900; line-height: 1.1; word-break: break-word; text-shadow: 0 2px 6px rgba(0,0,0,.3); }
.cd-sub-line { display: flex; justify-content: space-between; font-size: .92rem; opacity: .95; margin-top: .25rem; }
.cd-member { margin-top: .7rem; background: #fff; color: var(--cd-primary); font-weight: 700; border-radius: .5rem; padding: .4rem .6rem; text-align: center; font-size: .9rem; }
.cd-brand { margin-top: auto; font-weight: 800; text-align: center; letter-spacing: 1px; padding-top: 1rem; }
.cd-social { text-align: center; font-size: .78rem; opacity: .85; }
.cd-pop { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: var(--cd-primary-2); color: #fff; font-size: 3rem; font-weight: 900; z-index: 50; }
.cd-pop.show { display: flex; }

/* ============ SCANNER HP (mobile barcode -> kasir) ============ */
.scan-screen { --scn-bg: #0c0e12; min-height: 100vh; background: var(--scn-bg); color: #fff; display: flex; flex-direction: column; }
.scn-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 1rem; background: #15181e; font-weight: 800; letter-spacing: .5px; }
.scn-status { font-size: .72rem; padding: .2rem .5rem; border-radius: 999px; font-weight: 700; }
.scn-status.on { background: #1c6e4a; color: #fff; }
.scn-status.off { background: #7a2323; color: #fff; }
.scn-body { flex: 1; display: flex; flex-direction: column; gap: .6rem; padding: .8rem 1rem .9rem; }
.scn-about { font-size: .88rem; color: #cfd4da; }
.scn-reader { width: 100%; border-radius: .6rem; overflow: hidden; background: #000; border: 1px solid #2a2f38; }
.scn-reader video { width: 100% !important; }
.scn-reader canvas { max-width: 100%; }
.scn-last { min-height: 2rem; font-size: 1rem; text-align: center; padding: .45rem; border: 1px dashed #3a4150; border-radius: .5rem; color: #ffd27d; overflow-wrap: anywhere; }
.scn-actions { align-items: stretch; }

@media (max-width: 900px) {
  .cd-body { display: block; overflow-y: auto; min-height: 0; }
  .cd-items { max-height: 55vh; }
  .cd-side { display: flex; justify-content: flex-start; }
  .cd-total { font-size: 2.4rem; }
  .cd-brand { margin-top: 1rem; }
}
@media (max-width: 560px) {
  .cd-total { font-size: 1.9rem; }
  .cd-item-name small { display: none; }
  .cd-head .cd-store { font-size: 1rem; }
}

@media (max-width: 1100px) {
  .kasir-right { width: 360px; min-width: 320px; }
}