/* ==== GLOBAL ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", "Inter", sans-serif;
}

body, html {
  height: 100%;
  width: 100%;
  background: #f2f2f2;
  color: #111827;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* scroll hanya di app-main */
}

/* ==== HEADER ala PayPal ==== */
.app-header {
  background: linear-gradient(90deg, #003087, #0070ba);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-weight: 900;
  font-size: 20px;
  color: #fff;
}

.titles .title {
  font-weight: 700;
  font-size: 16px;
}
.titles .subtitle {
  font-size: 12px;
  color: #d1d5db;
}

/* ==== MAIN ==== */
.app-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  overflow-y: auto; /* scroll konten utama */
}

/* Card / Container */
.card {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.1);
}

/* ==== Stats ==== */
.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat {
  flex: 1 1 120px;
  background: linear-gradient(135deg, #f9fafc, #f3f6fb);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}
.stat .label {
  font-size: 12px;
  color: #6b7280;
}
.stat .value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 6px;
  color: #003087;
}

/* ==== Fields ==== */
label.field {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 8px 0 4px;
}
input, select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}
input:focus, select:focus {
  border-color: #0070ba;
  box-shadow: 0 0 0 2px rgba(0,112,186,0.25);
  outline: none;
}

/* ==== Rows ==== */
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.col {
  flex: 1 1 100px;
}
.col.short {
  max-width: 120px;
}

/* ==== Buttons ala PayPal ==== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: 0.25s;
  flex: 1 1 auto;
}
.btn.primary {
  background: linear-gradient(90deg,#0070ba,#003087);
  color: #fff;
}
.btn.ghost {
  background: #f1f5f9;
  color: #1e293b;
}
.btn:hover {
  transform: scale(1.05);
}

/* ==== QR Wrap ==== */
.qwrap {
  background: #f9fafb;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  border: 1px dashed #cbd5e1;
}

/* ==== Invoice (Struk Supermarket Realistis + Zigzag + QRIS Tengah) ==== */
.invoice {
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.3;
  color: #111827;
  border: 1px solid #e5e7eb;
}

.invoice-header {
  text-align: center;
  margin-bottom: 8px;
}
.invoice-header .store-name {
  font-weight: 700;
  font-size: 16px;
}
.invoice-header .store-info {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.2;
}

.invoice-body {
  margin-top: 6px;
}
.invoice-items {
  width: 100%;
  border-top: 1px dashed #d1d5db;
  border-bottom: 1px dashed #d1d5db;
  margin: 6px 0;
  padding: 4px 0;
}
.invoice-items .item {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
}
.invoice-items .item .name {
  flex: 1 1 auto;
  padding-right: 8px;
}
.invoice-items .item .qty, 
.invoice-items .item .price {
  flex: 0 0 auto;
  text-align: right;
  width: 40px;
}

.invoice-totals {
  margin-top: 6px;
}
.invoice-totals .row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
  font-weight: 600;
}
.invoice-totals .total {
  font-size: 14px;
  font-weight: 700;
  border-top: 1px dashed #d1d5db;
  padding-top: 4px;
  margin-top: 4px;
}

/* Zigzag line menggunakan border-image */
.zigzag-line {
  border-top: 4px solid transparent;
  border-image: repeating-linear-gradient(
    45deg,
    #d1d5db,
    #d1d5db 4px,
    transparent 4px,
    transparent 8px
  ) 1;
  margin: 6px 0;
}

.invoice-qr {
  text-align: center;
  margin-top: 10px;
}
.invoice-qr img {
  display: inline-block;
  width: 120px;
  height: 120px;
}
.invoice-qr .note {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}

.invoice-footer {
  text-align: center;
  font-size: 10px;
  color: #6b7280;
  margin-top: 10px;
  border-top: 1px dashed #d1d5db;
  padding-top: 6px;
}

/* Optional: Zigzag di bawah struk */
.invoice::after {
  content: "";
  display: block;
  margin-top: 8px;
  border-top: 4px solid transparent;
  border-image: repeating-linear-gradient(
    45deg,
    #d1d5db,
    #d1d5db 4px,
    transparent 4px,
    transparent 8px
  ) 1;
}


/* ==== Action Buttons di bawah invoice ==== */
.invoice-actions {
  display: flex;
  justify-content: space-between; /* space antar button */
  gap: 8px; /* jarak antar button */
  margin: 12px auto;
  max-width: 360px;
}

.invoice-actions .btn {
  flex: 1; /* semua button sama lebar */
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: 0.25s;
}

.invoice-actions .btn.primary {
  background: linear-gradient(135deg,#0070ba,#003087);
  color: #fff;
}
.invoice-actions .btn.ghost {
  background: #f1f5f9;
  color: #111827;
}
.invoice-actions .btn:hover {
  transform: scale(1.05);
}

/* ==== History Table ==== */
.history-wrap {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
}
#historyTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#historyTable tr:nth-child(odd) {
  background: #f9fafb;
}
#historyTable td, #historyTable th {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

/* ==== Footer Nav ala PayPal ==== */
.app-footer {
  background: #003087;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  position: sticky;
  bottom: 0;
  z-index: 20;
}
.app-footer button {
  flex: 1 1 auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  border: none;
  background: none;
  color: #e2e8f0;
  cursor: pointer;
  transition: 0.3s;
}
.app-footer button.active {
  color: #fff;
  font-weight: 600;
  transform: scale(1.1);
}
.app-footer i {
  font-size: 18px;
  margin-bottom: 4px;
}

/* ==== Modal ==== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal .box {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from {opacity:0; transform:scale(0.95);}
  to {opacity:1; transform:scale(1);}
}

/* ==== Floating Fullscreen Button ==== */
.btn-float {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: linear-gradient(135deg, #0070ba, #003087);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  z-index: 100;
  display: none; /* default: sembunyi di semua halaman */
}
.btn-float:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.full-invoice .btn-float {
  bottom: 20px;
}

/* ==== Fullscreen Invoice Mode ==== */
.full-invoice body,
.full-invoice html {
  background: #fff;
  overflow: auto;
}
.full-invoice .app-header,
.full-invoice .app-footer {
  display: none !important;
}
.full-invoice .app-main {
  padding: 0 !important;
}
.full-invoice .invoice {
  max-width: none !important;
  width: 100% !important;
  min-height: 100vh;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 20px;
}

