/* =====================================================================
   Arduino Balikpapan POS — Design System
   Palette: Navy Dongker #16233F · Teal #0D9488 · Slate #64748B · Font Inter
   ===================================================================== */

:root {
  --navy: #16233F;
  --navy-700: #2A3B5C;
  --navy-900: #0B1220;
  --teal: #0D9488;
  --teal-600: #0F766E;
  --teal-tint: #E6FBF8;
  --slate: #64748B;
  --slate-400: #94A3B8;
  --bg: #F7FAFA;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-soft: #F1F5F9;

  --ok-bg: #DCFCE7; --ok-fg: #166534;
  --warn-bg: #FEF3C7; --warn-fg: #92400E;
  --danger-bg: #FEE2E2; --danger-fg: #991B1B;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.14);

  /* ---------- Motion ---------- */
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --dur-fast: .15s;
  --dur-base: .22s;
  --dur-slow: .32s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--navy);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-600); }
h1, h2, h3, h4 { margin: 0; color: var(--navy); }
input, select, textarea, button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100; height: 54px;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 12px;
}
.topbar__brand { font-weight: 700; font-size: 14px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar__brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--teal); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.topbar__brand .sub { color: var(--slate-400); font-weight: 500; }
.topbar__tabs { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.tab {
  border: none; background: rgba(255,255,255,.08); color: #CBD5E1;
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--dur-fast) var(--ease-out);
}
.tab:hover { background: rgba(255,255,255,.16); color: #fff; }
.tab:active { transform: scale(.95); }
.tab.is-active { background: var(--teal); color: #fff; }
.topbar__user { font-size: 12px; color: #CBD5E1; display: flex; align-items: center; gap: 12px; }
.topbar__user form { margin: 0; }
.linklike { background: none; border: none; color: var(--slate-400); cursor: pointer; font-size: 12px; font-weight: 600; }
.linklike:hover { color: #fff; }

/* Mobile sidebar toggle (staff pages only) */
.hamburger {
  display: none; background: rgba(255,255,255,.08); border: none; color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer; padding: 8px 10px; border-radius: 8px; flex-shrink: 0;
}
.hamburger:hover { background: rgba(255,255,255,.16); }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
  padding: 12px 18px; font-size: 14px; transition: var(--dur-fast) var(--ease-out); display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; line-height: 1;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--teal); color: #fff; box-shadow: 0 2px 8px rgba(13,148,136,.25); }
.btn--primary:hover:not(:disabled) { background: var(--teal-600); }
.btn--dark { background: var(--navy); color: #fff; }
.btn--dark:hover:not(:disabled) { background: var(--navy-700); }
.btn--ghost { background: var(--surface); color: var(--navy); border: 1px solid var(--border); }
.btn--ghost:hover:not(:disabled) { background: var(--bg); }
.btn--success { background: var(--ok-fg); color: #fff; }
.btn--danger { background: var(--danger-fg); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 12px; font-size: 12px; }
.btn--lg { padding: 15px 20px; font-size: 15px; }

/* ---------- Cards / surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card--pad { padding: 20px; }
.card--hover { transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: .2px; }
.badge--ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge--warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge--danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge--neutral { background: var(--border-soft); color: var(--slate); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.label { font-size: 12px; font-weight: 600; color: var(--navy); display: block; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; outline: none; background: #fff; color: var(--navy);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
  text-align: left; padding: 11px 14px; font-size: 11px; color: var(--slate);
  text-transform: uppercase; letter-spacing: .4px; background: var(--bg);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data tbody td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tbody tr { transition: background var(--dur-fast) var(--ease-out); }
table.data tbody tr:hover { background: #FCFDFE; }
table.data tbody tr:last-child td { border-bottom: none; }

/* ---------- Pagination (custom — no Tailwind dependency) ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pager__btn {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--navy); font-size: 13px; font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--dur-fast) var(--ease-out);
}
.pager__btn:hover { border-color: var(--teal); color: var(--teal-600); }
.pager__btn:active { transform: scale(.92); }
.pager__btn.is-active { background: var(--teal); border-color: var(--teal); color: #fff; }
.pager__btn.is-disabled { color: var(--slate-400); cursor: not-allowed; }
.pager__dots { color: var(--slate-400); font-size: 13px; padding: 0 4px; }

/* ---------- Category chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--slate);
  padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  white-space: nowrap; cursor: pointer; transition: var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip:active { transform: scale(.94); }
.chip.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Money / price ---------- */
.price { color: var(--teal-600); font-weight: 800; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px; animation: modalBackdropIn var(--dur-base) var(--ease-out);
}
.modal {
  background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto; animation: modalPopIn var(--dur-slow) var(--ease-spring);
}
.modal__title { font-size: 16px; font-weight: 800; margin-bottom: 14px; }
@keyframes modalBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPopIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- Confirm modal (styled replacement for the native browser confirm()) ---------- */
.confirm-modal { text-align: center; padding: 28px 26px 24px; max-width: 380px; width: 100%; }
.confirm-modal__icon {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 26px; background: var(--teal-tint);
}
.confirm-modal__icon--warn { background: var(--warn-bg); }
.confirm-modal__icon--danger { background: var(--danger-bg); }
.confirm-modal__title { font-size: 17px; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.confirm-modal__msg { font-size: 13.5px; color: var(--slate); line-height: 1.6; white-space: pre-line; margin-bottom: 22px; }

/* ---------- Success modal + print receipt (shared: shown after a POS checkout on
   kasir/pos.blade.php, AND after ACC-ing an online order on kasir/online.blade.php —
   kept global so both pages render it identically instead of only one of them). ---------- */
.success-modal { text-align: center; padding: 30px 26px; max-width: 380px; width: 100%; }
.success-check { width: 68px; height: 68px; border-radius: 50%; background: var(--teal-tint); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.trx-detail-card { background: var(--bg); border-radius: 12px; padding: 16px; margin: 18px 0; text-align: left; }
.trx-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 13px; }
.trx-row + .trx-row { border-top: 1px solid var(--border-soft); }
.trx-highlight { background: var(--teal-tint); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.trx-highlight + .trx-row, .trx-row + .trx-highlight { border-top: none; }

@media print {
  @page { size: 80mm auto; margin: 0; }
  body > *:not(#printReceiptWrap) { display: none !important; }
  #printReceiptWrap { display: block !important; position: static; }
  #printReceiptWrap > div { width: 100% !important; padding: 4mm; box-sizing: border-box; }
}

/* =====================================================================
   STAFF SHELL (Kasir + Admin) — desktop sidebar layout
   Light sidebar with collapsible icon-badge groups + chevrons.
   ===================================================================== */
.shell { display: flex; height: calc(100vh - 54px); position: relative; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 10px 0;
}
.sidebar__divider { height: 1px; background: var(--border); margin: 10px 16px; }

/* Flat nav item (Dashboard, Kasir flat list, "Ke Admin" ...) */
.navlink {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 16px; border: none; background: none; color: var(--slate);
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; transition: var(--dur-fast) var(--ease-out);
  border-left: 3px solid transparent; text-decoration: none;
}
.navlink:hover { background: var(--teal-tint); color: var(--navy); }
.navlink.is-active { background: var(--teal-tint); color: var(--teal-600); border-left-color: var(--teal); font-weight: 700; }
.navlink .pill { margin-left: auto; background: var(--teal); color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 10px; font-weight: 700; }

/* Small rounded icon badge, used on flat items and group headers */
.navgroup__icon {
  width: 26px; height: 26px; border-radius: 7px; background: var(--teal-tint); color: var(--teal-600);
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0;
}

/* Collapsible group (Admin sidebar), built on native <details>/<summary> */
.navgroup { border-bottom: 1px solid var(--border-soft); }
.navgroup:last-of-type { border-bottom: none; }
.navgroup__header {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--navy); list-style: none; user-select: none;
}
.navgroup__header::-webkit-details-marker { display: none; }
.navgroup__header::marker { content: ''; }
.navgroup__chevron { margin-left: auto; font-size: 10px; color: var(--slate-400); transition: transform var(--dur-base) var(--ease-out); }
.navgroup[open] > .navgroup__header .navgroup__chevron { transform: rotate(180deg); }
.navgroup__items { display: flex; flex-direction: column; padding: 2px 0 8px; }
.navgroup .navlink { padding-left: 50px; }

.main { flex: 1; overflow-y: auto; padding: 28px; animation: fadeInUp var(--dur-slow) var(--ease-out); }
.main--flush { padding: 0; overflow: hidden; display: flex; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Off-canvas sidebar backdrop (mobile) */
.sidebar-backdrop {
  position: fixed; inset: 54px 0 0 0; background: rgba(15,23,42,.45); z-index: 140;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur-base) var(--ease-out);
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; pointer-events: auto; }

/* Floating toasts (so flush layouts aren't disturbed) */
.toasts { position: fixed; top: 66px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md); animation: toastIn var(--dur-slow) var(--ease-spring); }
.toast--ok { background: var(--ok-fg); color: #fff; }
.toast--err { background: var(--danger-fg); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.page-title { font-size: 20px; font-weight: 800; margin-bottom: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat__label { font-size: 11px; color: var(--slate); margin-bottom: 8px; }
.stat__value { font-size: 22px; font-weight: 800; }
.stat__value.warn { color: var(--warn-fg); }
.stat__value.danger { color: var(--danger-fg); }

/* ---------- Bar chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars__bar { width: 100%; background: linear-gradient(180deg, #2DD4BF, var(--teal)); border-radius: 5px 5px 0 0; min-height: 3px; transition: height .3s; }
.bars__label { font-size: 10px; color: var(--slate); }

/* ---------- Toggle switch ---------- */
.switch { width: 40px; height: 23px; border-radius: 12px; background: #CBD5E1; position: relative; cursor: pointer; border: none; transition: background var(--dur-fast) var(--ease-out); flex-shrink: 0; }
.switch.on { background: var(--teal); }
.switch__knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left var(--dur-base) var(--ease-spring); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on .switch__knob { left: 19px; }

/* ---------- Product thumb placeholder ---------- */
.thumb { background: repeating-linear-gradient(45deg,#E2E8F0,#E2E8F0 8px,#F1F5F9 8px,#F1F5F9 16px); display: flex; align-items: center; justify-content: center; color: var(--slate-400); font-family: monospace; font-size: 10px; }
/* Catalogue product imagery: 16:9 */
.thumb--169 { aspect-ratio: 16 / 9; height: auto; width: 100%; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.flash--ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash--err { background: var(--danger-bg); color: var(--danger-fg); }
.flash--info { background: #DBEAFE; color: #1E40AF; }

/* ---------- Utilities ---------- */
.muted { color: var(--slate); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.empty { text-align: center; padding: 48px 0; color: var(--slate); font-size: 13px; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* Tablet: sidebar becomes an off-canvas drawer */
@media (max-width: 900px) {
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .shell { height: calc(100vh - 54px); }
  .sidebar {
    position: fixed; top: 54px; left: 0; bottom: 0; z-index: 150;
    transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-out); box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }

  /* Kasir POS: stack product grid above the transaction cart */
  .pos { flex-direction: column; overflow-y: auto; height: auto; }
  .pos__grid { overflow-y: visible; }
  .pos__cart { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}

/* Phones */
@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .topbar__brand .sub { display: none; }
  .tab { padding: 8px 11px; font-size: 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .main { padding: 14px; }
  .page-head { align-items: stretch; }
}
