:root {
  --blue: #0b69ff;
  --red: #ff214f;
  --yellow: #ffd400;
  --bg: #f8faff;
  --card: #fff;
}

/* ---------------- GLOBAL ---------------- */
html,
body {
  min-height: 100vh;
  margin: 0;
  font-family: "Inter", system-ui, Arial, sans-serif;
  background: var(--bg);
  color: #222;
}

body{
  display:flex;
  flex-direction:column;
}

/* ---------------- HEADER ---------------- */
.topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 10px 18px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  color: white;
  gap: 6px;
}

.topbar h1.app-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.bot-credit {
  margin-top: 4px;
  font-size: 13px;
  text-align: center;
}

.bot-credit a {
  color: #fff;
  text-decoration: none;
  margin: 0 4px;
  font-weight: 500;
}

.bot-credit a:hover {
  text-decoration: underline;
}

/* ===================== SEARCH BAR ===================== */
.searchBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  max-width: 650px;
  margin: 14px auto;
  padding: 0 10px;
  background: #fff;
  border-radius: 50px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  position: relative;
}

/* Input utama */
.searchBar input {
  flex: 1;
  padding: 12px 110px 12px 18px;
  border-radius: 50px;
  border: none;
  font-size: 16px;
  outline: none;
  background: transparent;
}

/* Tombol X di kanan input */
#clearBtn {
  position: absolute;
  right: 90px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #777;
  display: none;
}

#clearBtn:hover {
  color: #000;
}

/* Tombol Cari & Kamera */
#searchBtn,
#scanBtn {
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

#searchBtn {
  right: 46px;
  background: var(--yellow);
  color: #000;
}

#scanBtn {
  right: 5px;
  background: var(--blue);
  color: white;
}

#searchBtn:hover,
#scanBtn:hover {
  transform: translateY(-50%) scale(1.05);
  opacity: 0.9;
}

/* RESPONSIVE - HP */
@media (max-width: 768px) {
  .searchBar {
    max-width: 95%;
    padding: 0 6px;
  }

  .searchBar input {
    font-size: 15px;
    padding: 11px 100px 11px 14px;
  }

  #searchBtn,
  #scanBtn {
    width: 40px;
    height: 40px;
  }

  #clearBtn {
    right: 85px;
  }

  .topbar {
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .topbar h1.app-title {
    font-size: 18px;
  }

  .bot-credit {
    font-size: 12px;
    flex-wrap: wrap;
    display: flex;
    justify-content: center;
    gap: 4px;
    text-align: center;
  }
}

/* ---------------- CONTAINER ---------------- */
.container {
  flex: 1;
  display: flex;
  gap: 18px;
  padding: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.list {
  flex: 1;
  min-width: 320px;
  max-width: 600px;
  background: var(--card);
  padding: 14px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

/* Tombol switch 2/3 kolom */
.gridSwitcher {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}

.gridSwitcher button {
  flex: 1;
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.gridSwitcher button:hover {
  background: #f3f3f3;
}

/* ---------------- PRODUK LIST ---------------- */
ul.produkList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  transition: all 0.2s;
  background: #fff;
}

.item:hover {
  background: #f9f9f9;
  transform: scale(1.02);
}

.item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
}

.meta .name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.meta .plu {
  font-size: 12px;
  color: #666;
}

/* 2 kolom di HP */
ul.produkList.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* 3 kolom di HP, kartu lebih kecil */
ul.produkList.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

ul.produkList.cols-3 .item {
  padding: 6px;
  gap: 6px;
}

ul.produkList.cols-3 .item img {
  width: 48px;
  height: 48px;
}

ul.produkList.cols-3 .meta .name {
  font-size: 12px;
  line-height: 1.2;
}

ul.produkList.cols-3 .meta .plu {
  font-size: 11px;
}

ul.produkList.cols-3 .priceBox .priceNormal,
ul.produkList.cols-3 .priceBox .pricePromo {
  font-size: 12px;
}

/* ---------------- HARGA ---------------- */
.priceBox {
  margin-top: 4px;
}

.priceWrap {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

/* Normal: hitam, besar */
.priceNormal {
  font-size: 18px;
  font-weight: 700;
  color: #000;
}

/* Promo: biru, besar */
.pricePromo {
  font-size: 18px;
  font-weight: 800;
  color: #0b69ff;
}

/* Coret */
.oldPrice {
  font-size: 12px;
  color: #888;
  text-decoration: line-through;
}

/* Badge diskon */
.discBadge {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #ff214f;
  border-radius: 4px;
  padding: 2px 5px;
}

/* Harga di detail */
.priceDetail {
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

/* Total harga di detail: merah dan tebal */
#totalPriceBox {
  color: #ff214f;      /* merah */
  font-weight: 800;
  font-size: 20px;
}


/* ---------------- DETAIL PRODUK ---------------- */
.big {
  display: block;
  width: 100%;
  min-height: 220px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #f7f7f7;
  border: 1px solid #eee;
}

.plu {
  font-size: 13px;
  color: #555;
  margin-top: 4px;
}

.barcodeBox {
  margin-top: 10px;
  text-align: center;
}

.barcodeBox img {
  width: 80%;
  max-width: 300px;
  height: auto;
}

/* Qty */
.qtyBox {
  margin-top: 6px;
  font-size: 14px;
}

.qtyBox input {
  width: 100px;
  padding: 4px 6px;
}

/* Deskripsi */
.descBox {
  margin-top: 10px;
  font-size: 14px;
  color: #333;
}

.descBox h4 {
  margin-bottom: 4px;
  color: var(--blue);
}

/* ---------------- SCANNER CAMERA ---------------- */
.scannerBox {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.98);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 9999;
  padding: 10px;
  overflow: hidden;
}

.scannerBox h3 {
  margin: 0 0 10px 0;
  color: var(--blue);
  font-size: 18px;
}

.hidden {
  display: none !important;
}

#reader {
  width: 90%;
  max-width: 360px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
}

#closeScan {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;

  background: var(--red);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;

  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

#closeScan:hover {
  opacity: 0.9;
}

/* ---------------- FOOTER ---------------- */
.footer {
  margin-top:auto;
  padding:12px 18px;
  background:#fff;
  border-top:1px solid #eee;
  text-align:center;
  font-size:13px;
  color:#666;
}

/* ---------------- EMPTY & INFO ---------------- */
.empty {
  text-align: center;
  padding: 20px;
  color: #999;
}

.info {
  text-align: center;
  padding: 10px;
  color: var(--blue);
  font-weight: 600;
}

/* ===================== HALAMAN DETAIL FULL ===================== */
.detailPage {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  box-sizing: border-box;
  padding-bottom: 80px;
  -webkit-overflow-scrolling: touch;
}

.backBtn {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  width: fit-content;
  margin-bottom: 10px;
}

.backBtn:hover {
  opacity: 0.9;
}

.detailContent {
  flex: 0 0 auto;
  background: white;
  padding: 14px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  margin-bottom: 50px;
}

@media (max-width: 768px) {
  .detailPage {
    padding: 10px;
  }

  .backBtn {
    font-size: 15px;
    padding: 7px 12px;
  }
}

/* ---------------- LOAD MORE ---------------- */
.loadMoreBtn {
  display: block;
  margin: 20px auto;
  padding: 14px 30px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background-color: #007bff;
  color: white;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.loadMoreBtn:hover {
  background-color: #0056b3;
  transform: scale(1.05);
}

.qtyInputWrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.qtyInputWrap input {
  padding-right: 22px;
}

.qtyClearBtn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #888;
}
/* History Dropdown */
.historyDropdown {
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.historyItem:hover {
  background: #f8faff !important;
}

@media (max-width: 768px) {
  .historyBtn { right: 82px !important; }
}

.rakBox {
  margin-top: 10px;
  background: #eef4ff;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
}

.rakBox pre {
  margin: 5px 0 0;
  font-family: monospace;
  white-space: pre-wrap;
}

/* 🔥 RAK BOX */
.rakBox {
  margin-top: 12px;
  text-align: center;
}

.rakTitle {
  font-weight: 700;
  margin-bottom: 6px;
  color: #0b69ff;
}

.rakContent {
  background: #f1f6ff;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  display: inline-block;
  text-align: left; /* isi tetap rapi */
}

/* 🔥 DESKRIPSI TENGAH */
.descBox {
  text-align: center;
}

.descBox p {
  text-align: center;
}

/* 🔥 SPINNER */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #ddd;
  border-top: 3px solid #0b69ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.detailFooter {
  margin-top: 20px;
  padding-top: 10px;
  font-size: 12px;
  color: #777;
  text-align: center;
  border-top: 1px solid #eee;
}

.produkLinkDetail {
  margin: 12px 0;
  text-align: center;
}

.produkLinkBtn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: white;
  background: linear-gradient(90deg, #0b69ff, #ff214f);
  box-shadow: 0 4px 12px rgba(11, 105, 255, 0.25);
  transition: all 0.2s ease;
}

.produkLinkBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(11, 105, 255, 0.35);
}

.produkLinkMini {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  color: white;
  background: linear-gradient(90deg, #0b69ff, #ff214f);
}

.detailFooter {
  margin-top: 30px;
  padding-bottom: 40px;
  text-align: center;
}

.pluRow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.pluRow .plu {
  background: #0b69ff;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

.copyPluBtn {
  border: none;
  background: #0b69ff;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.copyPluBtn:hover,
.pluRow .plu:hover {
  opacity: 0.9;
}

.copyPluMini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.copyPluMini:hover {
  transform: scale(1.1);
}

/* ================= ZOOM SCANNER ================= */

#zoom-control{
  position: fixed;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);

  display:flex;
  align-items:center;
  gap:8px;

  background:#fff;
  padding:10px 14px;
  border-radius:20px;
  box-shadow:0 0 15px rgba(0,0,0,.2);
  z-index:10000;
}

#zoom-slider{
  width:220px;
}

#zoom-value{
  min-width:32px;
  font-weight:700;
  color:#0b69ff;
}
.menuDropdown{
  position:relative;
  display:inline-block;
}

.dropdownContent{
  display:none;
  position:absolute;
  top:100%;
  left:50%;
  transform:translateX(-50%);
  min-width:220px;
  background:#fff;
  border-radius:10px;
  box-shadow:0 4px 15px rgba(0,0,0,.2);
  z-index:9999;
  overflow:hidden;
}

.dropdownContent a{
  display:block;
  padding:10px 12px;
  color:#333 !important;
  text-decoration:none;
  border-bottom:1px solid #eee;
  text-align:left;
}

.dropdownContent a:hover{
  background:#f5f5f5;
}

.menuDropdown:hover .dropdownContent{
  display:block;
}

@media(max-width:768px){
  .dropdownContent{
    left:auto;
    right:0;
    transform:none;
  }
}