/* ============================================================
   POS — Customer Facing Styles
   ພື້ນຫຼັງ: ສີຂຽວເຂັ້ມ | ແຖບ: ສີສົ້ມ | ປຸ່ມ: ແດງ / ຟ້າ / ເຫຼືອງ
   ເມນູຫຼັກ: Font Phetsarath OT 18px Bold ສີດຳ
   ============================================================ */

:root {
  --green: #065f36;          /* ສີຂຽວເຂັ້ມ (ພື້ນຫຼັກ) */
  --green-dark: #04402a;
  --green-light: #0a7a47;
  --orange: #ff8f00;         /* ສີສົ້ມ (ແຖບ) */
  --orange-dark: #ef6c00;
  --red: #e53935;
  --red-dark: #c62828;
  --blue: #1e88e5;
  --blue-dark: #1565c0;
  --yellow: #fdd835;
  --yellow-dark: #f9a825;
  --cream: #fffdf5;
  --ink: #111;
  --font: 'Phetsarath OT', 'Phetsarath', 'Noto Sans Lao', 'Leelawadee UI', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 18px;
  color: var(--ink);
  background: var(--green);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: var(--font); font-size: 16px; }
a { color: inherit; }

[hidden] { display: none !important; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  padding: 11px 20px;
  font-size: 17px; font-weight: 700;
  color: #fff;
  text-decoration: none;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
  box-shadow: 0 3px 0 rgba(0,0,0,.22);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-red    { background: var(--red); }
.btn-red:active { background: var(--red-dark); }
.btn-blue   { background: var(--blue); }
.btn-blue:active { background: var(--blue-dark); }
.btn-yellow { background: var(--yellow); color: #111; }
.btn-yellow:active { background: var(--yellow-dark); }
.btn-orange { background: var(--orange); color: #111; }
.btn-green  { background: var(--green-light); }
.btn-ghost  { background: #ffffff33; color: #111; border: 2px solid rgba(0,0,0,.15); box-shadow: none; }
.btn-sm { padding: 7px 13px; font-size: 15px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------------- Top bar (ສີສົ້ມ) ---------------- */
.topbar {
  background: linear-gradient(180deg, var(--orange), var(--orange-dark));
  border-bottom: 4px solid #c25e00;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  position: sticky; top: 0; z-index: 60;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--green);
  color: #fff; display: grid; place-items: center;
  font-size: 26px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.brand h1 { font-size: 22px; font-weight: 800; color: #111; line-height: 1.1; }
.brand span { font-size: 13px; color: #5b3200; font-weight: 600; }

/* ເມນູຫຼັກ: Phetsarath OT 18 Bold ສີດຳ */
.mainmenu {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-left: auto;
}
.mainmenu a, .mainmenu button {
  font-family: 'Phetsarath OT', 'Phetsarath', 'Noto Sans Lao', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #000;                 /* ຕົວອັກສອນສີດຳ */
  background: transparent;
  border: 2px solid transparent;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.mainmenu a:hover, .mainmenu button:hover { background: rgba(255,255,255,.45); border-color: rgba(0,0,0,.15); }
.mainmenu a.active { background: var(--yellow); border-color: #c9a400; }

.top-actions { display: flex; gap: 8px; align-items: center; }

.cart-btn { position: relative; }
.badge {
  background: var(--red); color: #fff;
  min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 12px;
  display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 800;
}

/* ---------------- Search bar (ສີສົ້ມ) ---------------- */
.searchbar {
  background: var(--orange-dark);
  border-bottom: 3px solid #b35200;
  padding: 10px 16px;
}
.searchbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.searchbar input[type="text"] {
  flex: 1; min-width: 220px;
  padding: 11px 16px;
  border: 3px solid #111;
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
}
.searchbar select {
  padding: 11px 12px;
  border: 3px solid #111;
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------- Layout ---------------- */
.container { max-width: 1200px; margin: 0 auto; width: 100%; padding: 20px 16px 40px; }

/* Hero banner */
.hero {
  background:
    radial-gradient(1000px 300px at 15% -50%, rgba(255,255,255,.18), transparent),
    linear-gradient(120deg, var(--green-light), var(--green-dark));
  border: 4px solid var(--orange);
  border-radius: 20px;
  color: #fff;
  padding: 30px 28px;
  margin-bottom: 22px;
  display: flex; gap: 20px; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
}
.hero h2 { font-size: 30px; font-weight: 800; margin-bottom: 8px; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
.hero p { font-size: 17px; opacity: .95; max-width: 640px; line-height: 1.6; }
.hero .hero-emoji { font-size: 74px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }

/* Category chips */
.cats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: var(--yellow);
  color: #111;
  border: 3px solid #b8860b;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700; font-size: 16px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.chip:hover { transform: translateY(-2px); }
.chip.active { background: var(--orange); border-color: #7a4a00; color: #000; }

.section-title {
  color: var(--yellow);
  font-size: 22px; font-weight: 800;
  margin: 6px 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 3px; background: var(--orange); border-radius: 3px; }

/* ---------------- Product grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.card {
  background: var(--cream);
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #0a3d24;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 14px 26px rgba(0,0,0,.45); }
.card-img { position: relative; aspect-ratio: 4/3; background: #eee; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.stock-tag {
  position: absolute; top: 8px; left: 8px;
  background: var(--green); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.6);
}
.stock-tag.out { background: var(--red); }
.cat-tag {
  position: absolute; top: 8px; right: 8px;
  background: var(--orange); color: #111;
  font-size: 12px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px;
}
.card-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 17px; font-weight: 700; line-height: 1.4; min-height: 48px; }
.price { color: var(--red-dark); font-size: 21px; font-weight: 800; }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1; }

.empty {
  text-align: center; color: #eafff2;
  padding: 50px 20px; font-size: 18px;
  background: rgba(0,0,0,.18);
  border: 3px dashed rgba(255,255,255,.35);
  border-radius: 16px;
}

/* ---------------- Overlay / Modal / Drawer ---------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(2px);
  z-index: 90;
}

.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.modal-box {
  background: var(--cream);
  border-radius: 18px;
  width: min(880px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border: 4px solid var(--orange);
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-head {
  background: linear-gradient(180deg, var(--orange), var(--orange-dark));
  padding: 13px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 5;
  border-bottom: 3px solid #b35200;
}
.modal-head h2 { font-size: 20px; font-weight: 800; color: #111; }
.modal-close {
  background: var(--red); color: #fff;
  border: none; width: 36px; height: 36px;
  border-radius: 50%; font-size: 19px; font-weight: 800;
  cursor: pointer; line-height: 1;
}
.modal-body { padding: 20px; }

/* ---------------- Product detail ---------------- */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.detail-img {
  position: relative;
  border-radius: 14px; overflow: hidden;
  border: 3px solid var(--green-dark);
  background: #fff;
  aspect-ratio: 1/1;
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.zoom-hint {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  pointer-events: none;
}
.detail-info h2 { font-size: 25px; font-weight: 800; margin-bottom: 8px; }
.detail-info .price { font-size: 30px; display: block; margin: 10px 0; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  background: var(--green-light); color: #fff;
  padding: 5px 13px; border-radius: 999px;
  font-size: 14px; font-weight: 700;
}
.tag.stock { background: var(--blue); }
.tag.out { background: var(--red); }
.detail-desc {
  background: #f2f7ef; border-left: 5px solid var(--green-light);
  padding: 12px 14px; border-radius: 0 10px 10px 0;
  font-size: 16px; line-height: 1.7; margin-bottom: 16px;
  min-height: 70px;
}
.qty-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.qty-row label { font-weight: 700; }
.stepper {
  display: inline-flex; align-items: center;
  border: 3px solid var(--green-dark);
  border-radius: 10px; overflow: hidden;
  background: #fff;
}
.stepper button {
  width: 42px; height: 42px;
  background: var(--yellow); border: none;
  font-size: 22px; font-weight: 800; cursor: pointer;
}
.stepper button:hover { background: var(--yellow-dark); }
.stepper input {
  width: 64px; height: 42px; border: none; text-align: center;
  font-weight: 800; font-size: 18px;
  border-left: 3px solid var(--green-dark); border-right: 3px solid var(--green-dark);
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Lightbox (ຂະຫຍາຍຮູບ) ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 130;
  background: rgba(0,0,0,.92);
  display: flex; flex-direction: column;
}
.lightbox-bar {
  background: var(--orange);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px;
  flex-wrap: wrap;
}
.lightbox-bar strong { color: #111; margin-right: 8px; }
.lightbox-stage {
  flex: 1; overflow: hidden;
  display: grid; place-items: center;
  cursor: grab;
  touch-action: none;
}
.lightbox-stage.dragging { cursor: grabbing; }
.lightbox-stage img {
  max-width: 92%; max-height: 92%;
  user-select: none;
  transition: transform .08s linear;
  will-change: transform;
}

/* ---------------- Cart drawer ---------------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(430px, 100%);
  background: var(--cream);
  z-index: 110;
  display: flex; flex-direction: column;
  border-left: 5px solid var(--orange);
  box-shadow: -12px 0 40px rgba(0,0,0,.5);
  transform: translateX(105%);
  transition: transform .25s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  background: linear-gradient(180deg, var(--orange), var(--orange-dark));
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid #b35200;
}
.drawer-head h2 { font-size: 20px; font-weight: 800; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px; }
.drawer-foot { border-top: 3px solid var(--green-dark); padding: 14px 16px; background: #f6f9f1; }

.cart-item {
  display: grid; grid-template-columns: 68px 1fr auto;
  gap: 10px; align-items: center;
  background: #fff;
  border: 2px solid #d9e3d2;
  border-radius: 12px;
  padding: 9px;
  margin-bottom: 10px;
}
.cart-item img { width: 68px; height: 68px; object-fit: cover; border-radius: 9px; border: 2px solid var(--green-dark); }
.cart-item h4 { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.cart-item .ci-price { color: var(--red-dark); font-weight: 800; font-size: 15px; }
.ci-qty { display: inline-flex; align-items: center; border: 2px solid var(--green-dark); border-radius: 8px; overflow: hidden; margin-top: 6px; }
.ci-qty button { width: 30px; height: 30px; background: var(--yellow); border: none; font-weight: 800; font-size: 17px; cursor: pointer; }
.ci-qty span { min-width: 36px; text-align: center; font-weight: 800; background: #fff; height: 30px; display: grid; place-items: center; font-size: 15px; }
.ci-remove {
  background: var(--red); color: #fff; border: none;
  width: 34px; height: 34px; border-radius: 9px;
  font-size: 17px; cursor: pointer; font-weight: 800;
}
.cart-empty { text-align: center; padding: 46px 12px; color: #6b7a66; }
.cart-empty .big { font-size: 60px; display: block; margin-bottom: 10px; }

.total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 21px; font-weight: 800;
  margin-bottom: 12px;
}
.total-row .amount { color: var(--red-dark); font-size: 25px; }

/* ---------------- Checkout ---------------- */
.steps { display: flex; gap: 8px; padding: 14px 20px 0; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 130px;
  background: #e3e9df; color: #6b7a66;
  border-radius: 10px; padding: 9px 12px;
  font-size: 15px; font-weight: 700; text-align: center;
}
.step.active { background: var(--green-light); color: #fff; }
.step.done { background: var(--yellow); color: #111; }

.form-grid { display: grid; gap: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 16px; }
.field label .req { color: var(--red); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 13px;
  border: 3px solid #cdd8c6;
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--blue);
}
.hint { font-size: 13.5px; color: #6b7a66; margin-top: 5px; }
.error-text { color: var(--red-dark); font-size: 14px; font-weight: 700; margin-top: 5px; }

.map-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.map-tools input { flex: 1; min-width: 190px; padding: 10px 12px; border: 3px solid #cdd8c6; border-radius: 10px; }
#map {
  width: 100%; height: 300px;
  border: 4px solid var(--green-dark);
  border-radius: 14px;
  margin-top: 10px;
  z-index: 1;
}
.loc-status { font-size: 14.5px; font-weight: 700; margin-top: 8px; color: var(--green-dark); }

/* Payment */
.pay-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.pay-card {
  border: 4px solid #d3ddd0;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, transform .12s ease;
}
.pay-card:hover { transform: translateY(-2px); }
.pay-card.selected { border-color: var(--blue); background: #eaf3ff; }
.pay-card .pc-icon { font-size: 40px; display: block; margin-bottom: 6px; }
.pay-card .pc-name { font-weight: 800; font-size: 17px; }
.pay-card .pc-desc { font-size: 13.5px; color: #587061; margin-top: 4px; }

.qr-panel {
  background: #f4fbf4;
  border: 3px dashed var(--green-light);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.qr-panel h4 { margin-bottom: 10px; font-size: 17px; }
.qr-img {
  width: 230px; height: 230px;
  margin: 0 auto 10px;
  background: #fff;
  border: 4px solid var(--green-dark);
  border-radius: 12px;
  display: grid; place-items: center;
  overflow: hidden;
}
.qr-img img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { font-size: 14px; color: #6b7a66; padding: 14px; text-align: center; line-height: 1.6; }

.slip-upload {
  border: 3px dashed var(--blue);
  background: #eaf3ff;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  margin-top: 14px;
}
.slip-upload input[type="file"] { display: none; }
.slip-preview {
  margin-top: 12px;
  position: relative;
  display: inline-block;
}
.slip-preview img {
  width: 220px; max-height: 300px; object-fit: contain;
  border: 3px solid var(--green-dark); border-radius: 10px; background: #fff;
}
.slip-preview .remove-slip {
  position: absolute; top: -10px; right: -10px;
  background: var(--red); color: #fff; border: none;
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-weight: 800;
}

.order-summary {
  background: #f2f7ef;
  border-radius: 12px;
  border: 2px solid #d9e3d2;
  padding: 14px;
  margin-top: 16px;
}
.order-summary h4 { margin-bottom: 10px; }
.sum-line { display: flex; justify-content: space-between; font-size: 15.5px; padding: 4px 0; }
.sum-total {
  display: flex; justify-content: space-between;
  border-top: 3px solid var(--green-dark);
  margin-top: 8px; padding-top: 9px;
  font-size: 20px; font-weight: 800;
}
.sum-total .amount { color: var(--red-dark); }

.nav-buttons { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.nav-buttons .btn { flex: 1; min-width: 150px; }

/* Success */
.success-box { text-align: center; padding: 26px 14px; }
.success-box .big { font-size: 76px; display: block; margin-bottom: 12px; animation: pop .3s ease; }
.success-box h3 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.order-code {
  display: inline-block;
  background: var(--green); color: #fff;
  font-size: 22px; font-weight: 800;
  padding: 10px 22px; border-radius: 12px;
  margin: 12px 0;
  letter-spacing: 1px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(120px);
  background: #111; color: #fff;
  border: 3px solid var(--orange);
  padding: 13px 22px;
  border-radius: 12px;
  font-weight: 700; font-size: 16px;
  z-index: 200;
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  max-width: 92vw; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok { border-color: var(--green-light); }
.toast.err { border-color: var(--red); }

/* ---------------- Footer ---------------- */
.footer {
  margin-top: auto;
  background: linear-gradient(180deg, var(--orange), var(--orange-dark));
  border-top: 4px solid #b35200;
  color: #111;
  padding: 18px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 15.5px;
}
.footer .foot-links { display: flex; gap: 16px; justify-content: center; margin-top: 8px; flex-wrap: wrap; font-size: 14.5px; }
.footer a { color: #111; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .pay-options { grid-template-columns: 1fr; }
  .mainmenu { order: 3; width: 100%; margin-left: 0; justify-content: center; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand h1 { font-size: 18px; }
  .hero h2 { font-size: 23px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-body h3 { font-size: 15px; min-height: 42px; }
  .price { font-size: 18px; }
  .nav-buttons .btn { min-width: 120px; }
}

/* Print (ບິນສຳເລັດ) */
@media print {
  .topbar, .searchbar, .footer, .nav-buttons, .modal-close, .lightbox { display: none !important; }
  body { background: #fff; }
}
