/* =========================================================
   KasirKu — Stylesheet
   Daftar isi:
   1. Variabel & Reset
   2. Layout (header, sidebar, main)
   3. Komponen (panel, form, tombol, tabel)
   4. Halaman Kasir (keranjang, pembayaran)
   5. Utilitas (toast, stok rendah)
   6. Modal & popup
   7. Halaman login
   8. Responsif
   ========================================================= */


/* ---------- 1. Variabel & Reset ---------- */
:root {
  --bg: #f4f6fb;
  --panel: #fff;
  --ink: #182230;
  --muted: #718096;
  --line: #e7ebf2;
  --brand: #315efb;
  --green: #159768;
  --red: #d94b4b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* hilangkan kotak/shadow biru saat disentuh di HP */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 {
  font-size: 24px;
  margin: 0 0 5px;
}

h2 {
  font-size: 17px;
  margin: 0 0 15px;
}

.sub {
  color: var(--muted);
  margin: 0 0 22px;
}


/* ---------- 2. Layout ---------- */

/* Header */
header {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-size: 20px;
  font-weight: 800;
}

.brand span {
  color: var(--brand);
}

.hamb {
  width: 40px;
  height: 40px;
  background: #eef1f8;
  color: #24334b;
  font-size: 21px;
  padding: 0;
}

/* Shell & Sidebar */
.shell {
  display: flex;
  min-height: calc(100vh - 64px);
}

aside {
  width: 245px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 13px;
  transition: .2s;
  flex-shrink: 0;
}

aside.closed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
}

.navlabel {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 12px;
}

.navbtn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #526174;
  padding: 12px;
  border-radius: 9px;
  margin: 3px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.navbtn.active {
  background: #edf1ff;
  color: var(--brand);
}

/* Konten utama */
main {
  width: min(1100px, 100%);
  padding: 26px;
  margin: 0 auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}


/* ---------- 3. Komponen ---------- */

/* Panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 3px 12px #17255408;
  margin-bottom: 18px;
}

/* Judul panel + tombol aksi */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.panel-head h2 {
  margin: 0;
}

/* Form */
label {
  display: block;
  font-size: 13px;
  color: #526174;
  margin: 0 0 5px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid #dce2ec;
  border-radius: 9px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #315efb18;
}

.field {
  margin-bottom: 13px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

/* Tombol */
button {
  border: 0;
  border-radius: 9px;
  padding: 11px 14px;
  font: 600 14px system-ui;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  outline: none;
  box-shadow: none;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--brand); /* hanya muncul saat navigasi keyboard */
  outline-offset: 2px;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.secondary {
  background: #edf1ff;
  color: #294bd1;
}

.danger {
  background: #fff0f0;
  color: var(--red);
}

.green {
  background: var(--green);
}

.btn-block {
  width: 100%;
  margin-top: 8px;
}

.logout {
  margin-left: auto;
}

.row-actions {
  display: flex;
  gap: 6px;
}

/* Tabel */
.scroll {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 22px;
}


/* ---------- 4. Halaman Kasir ---------- */

/* Keranjang */
.cartline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cartline small {
  color: var(--muted);
}

.qty {
  display: flex;
  align-items: center;
  gap: 7px;
}

.qty button {
  padding: 4px 9px;
}

.totalrow {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.grand {
  font-size: 20px;
  font-weight: 800;
  border-top: 1px solid var(--line);
  margin-top: 7px;
  padding-top: 14px;
}

/* Pembayaran */
.paygrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.changebox {
  background: #eefaf5;
  border: 1px solid #c9efdf;
  border-radius: 11px;
  padding: 13px;
}

.changebox strong {
  display: block;
  color: #087b51;
  font-size: 23px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}


/* ---------- 5. Utilitas ---------- */
.low {
  color: var(--red);
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #182230;
  color: #fff;
  padding: 11px 17px;
  border-radius: 10px;
  display: none;
  z-index: 30;
}


/* ---------- 6. Modal & popup ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #18223099;
  animation: fade-in .18s ease;
}

.modal[hidden] {
  display: none;
}

.modal-box {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 50px #18223040;
  animation: pop-in .22s ease;
}

.modal-text {
  color: var(--muted);
  margin: 0 0 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.danger-solid {
  background: var(--red);
  color: #fff;
}

/* Popup berhasil + animasi centang */
.modal-success {
  text-align: center;
  padding: 28px 22px 22px;
}

.modal-success h2 {
  margin: 14px 0 4px;
  font-size: 20px;
}

.modal-success p {
  margin: 0 0 18px;
  color: var(--muted);
}

.check {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  animation: check-pop .4s .8s ease;
}

.check-circle {
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  transform-origin: 26px 26px;
  transform: rotate(-90deg);
  animation: draw .5s ease forwards;
}

.check-mark {
  stroke: var(--green);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw .35s .45s ease forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes check-pop {
  50% { transform: scale(1.12); }
}


/* ---------- 7. Halaman login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 30px 26px;
  box-shadow: 0 3px 12px #17255408;
}

.login-card .brand {
  text-align: center;
  font-size: 30px;
  margin-bottom: 4px;
}

.login-card .sub {
  text-align: center;
  margin-bottom: 24px;
}

.pass-wrap {
  position: relative;
}

.pass-wrap input {
  padding-right: 104px;
}

.pass-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
}

.login-error {
  min-height: 20px;
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--red);
}


/* ---------- 8. Responsif ---------- */
@media (max-width: 760px) {
  aside {
    position: fixed;
    z-index: 4;
    top: 64px;
    bottom: 0;
    box-shadow: 8px 0 20px #17255412;
  }

  main {
    padding: 18px 12px;
  }

  .panel {
    padding: 15px;
  }

  .paygrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .grid2 {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 21px;
  }
}
