/* Genexys Rewards - shared styles for customer pages and the staff app */

:root {
  --brand: #7c3a1d;
  --brand-dark: #4a200f;
  --brand-ink: #ffffff;
  --accent: #f6c453;
  --bg: #faf6f1;
  --card: #ffffff;
  --text: #1f1a17;
  --muted: #6f655d;
  --line: #ebe3da;
  --good: #1f8a4c;
  --bad: #b42318;
  --radius: 16px;
  --shadow: 0 6px 22px rgba(60, 35, 20, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.45;
  min-height: 100vh; display: flex; flex-direction: column;
}
button, input, select { font: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* ---------- Top bar + tabs ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--brand); color: var(--brand-ink);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand__dot { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--accent); color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.brand__name { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__btn { background: rgba(255,255,255,.16); color: inherit; border: 0; border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }

.tabs { display: flex; gap: 4px; background: var(--card); border-bottom: 1px solid var(--line); padding: 6px 12px; position: sticky; top: 0; z-index: 5; }
.tabs button { flex: 1; background: none; border: 0; padding: 10px 6px; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: 15px; cursor: pointer; }
.tabs button.is-on { background: var(--bg); color: var(--brand); }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px 8px; flex: 1; outline: none; }

/* ---------- Blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 18px; margin: 0 0 12px; }
.card h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow, .grow { flex: 1; min-width: 0; }
.page-title { font-size: 22px; margin: 4px 0 4px; }
.page-sub { margin: 0 0 16px; color: var(--muted); }
.notice { background: #fff7e6; color: #7a4f00; border: 1px solid #f3d79a; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.error-box { background: #fdecea; color: var(--bad); border: 1px solid #f5c2bd; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=tel], input[type=number], input[type=password] {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--text);
}
input:focus { outline: none; border-color: var(--brand); }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input-prefix input { padding-left: 46px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; transition: transform .06s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--accent { background: var(--accent); color: var(--brand-dark); }
.btn--ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn--wa { background: #25d366; color: #fff; }
.btn--danger { background: #fff; color: var(--bad); border-color: #f1c9c5; }
.btn--block { width: 100%; }
.btn--big { min-height: 64px; font-size: 19px; border-radius: 16px; }
.btn--sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.linkbtn { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 6px 0; text-decoration: underline; }
.btn + .btn { margin-top: 10px; }
.row .btn + .btn { margin-top: 0; }

/* ---------- Customer card ---------- */
.points-card {
  background: linear-gradient(145deg, var(--brand), var(--brand-dark)); color: #fff;
  border-radius: 20px; padding: 22px 20px; box-shadow: 0 14px 30px rgba(74, 32, 15, .3);
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.points-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(246, 196, 83, .14); }
.points-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; position: relative; z-index: 1; }
.points-card__biz { font-weight: 700; font-size: 15px; opacity: .92; }
.points-card__member { font-size: 13px; opacity: .85; text-align: right; }
.points-card__num { font-size: 56px; font-weight: 800; line-height: 1; margin: 18px 0 2px; color: var(--accent); transition: transform .3s ease; }
.points-card__num.bump { transform: scale(1.15); }
.points-card__label { opacity: .85; font-size: 15px; }
.progress { height: 10px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; margin: 18px 0 8px; }
.progress__bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease; }
.points-card__next { font-size: 14px; opacity: .92; }

.qr-card { text-align: center; }
.qr-box { width: 220px; height: 220px; margin: 4px auto 10px; padding: 10px; background: #fff; border: 2px solid var(--line); border-radius: 14px; }
.qr-box img, .qr-box canvas { width: 100% !important; height: 100% !important; display: block; image-rendering: pixelated; }

.ready { background: #eaf7ef; border: 1.5px solid #b7e3c7; color: #145c33; border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600; }

.reward { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.reward:first-of-type { border-top: 0; }
.reward__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); font-size: 19px; flex: none; }
.reward__name { font-weight: 700; }
.reward__cost { font-size: 14px; color: var(--muted); }
.tag { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; white-space: nowrap; }
.tag--ok { background: #eaf7ef; color: var(--good); }
.tag--lock { background: var(--bg); color: var(--muted); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.history li:first-child { border-top: 0; }
.plus { color: var(--good); font-weight: 700; white-space: nowrap; }
.minus { color: var(--bad); font-weight: 700; white-space: nowrap; }

/* ---------- Staff: scanner + customer panel ---------- */
.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #111; margin-bottom: 12px; min-height: 260px; }
.scanner video { width: 100% !important; display: block; }
#reader { width: 100%; }
#reader img[alt="Info icon"], #reader__dashboard_section_csr span { display: none !important; }

.member-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; background: var(--accent); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; }
.member-head__pts { margin-left: auto; text-align: right; }
.member-head__pts strong { display: block; font-size: 26px; color: var(--brand); line-height: 1.1; }

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.price-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 76px; padding: 10px; border-radius: 14px; cursor: pointer;
  background: #fff; border: 2px solid var(--line); color: var(--text);
  transition: transform .06s ease, border-color .15s ease;
}
.price-btn:active { transform: scale(.97); border-color: var(--brand); }
.price-btn strong { font-size: 20px; color: var(--brand); }
.price-btn span { font-size: 14px; color: var(--muted); }
.price-btn[disabled] { opacity: .5; }

.redeem-list .btn { width: 100%; justify-content: space-between; }
.redeem-list .btn + .btn { margin-top: 8px; }

.list-item { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 0; text-align: left; color: var(--text); }
.list-item:first-of-type { border-top: 0; }
button.list-item { cursor: pointer; }
.list-item .avatar { width: 36px; height: 36px; font-size: 14px; }

/* ---------- Owner ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 24px; line-height: 1.15; color: var(--brand); }
.stat span { font-size: 13px; color: var(--muted); }
.cust { padding: 12px 0; border-top: 1px solid var(--line); }
.cust:first-of-type { border-top: 0; }
.cust__line { display: flex; align-items: center; gap: 10px; }
.cust__name { font-weight: 700; }
.cust__meta { font-size: 13px; color: var(--muted); }
.cust__pts { margin-left: auto; font-weight: 800; color: var(--brand); white-space: nowrap; }
.cust__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.edit-row { display: grid; grid-template-columns: 1fr 100px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.edit-row input { padding: 10px 12px; }
.edit-row .btn { min-height: 44px; padding: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 30px);
  background: #1f1a17; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 30; max-width: calc(100% - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-good { background: var(--good); }
.toast.is-bad { background: var(--bad); }

.credit { text-align: center; font-size: 13px; color: var(--muted); padding: 18px 16px 26px; }
.credit a { color: inherit; font-weight: 600; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .price-grid { grid-template-columns: repeat(3, 1fr); }
}
