/* =========================================================
   Neko Shop — Design tokens
   Palette: Ink #14141A, Paper #FAF9F6, Neko Red #E6394A,
            Manga Gray #2B2B31, Line #E7E4DE, Gold #F2A93B
   Display: Zen Kaku Gothic New / Body: Inter / Data: JetBrains Mono
   ========================================================= */

:root {
  --ink: #14141a;
  --paper: #faf9f6;
  --paper-dim: #f1efe9;
  --red: #e6394a;
  --red-dark: #c22638;
  --gray-dark: #2b2b31;
  --line: #e7e4de;
  --gold: #f2a93b;
  --white: #ffffff;
  --radius: 14px;
  --font-display: 'Zen Kaku Gothic New', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-card: 0 2px 10px rgba(20, 20, 26, 0.06);
  --shadow-modal: 0 -6px 24px rgba(20, 20, 26, 0.18);
}

/* ---------- Night mode ---------- */
html.dark {
  --ink: #f1efe9;
  --paper: #14141a;
  --paper-dim: #1e1e24;
  --line: #2f2f37;
  --white: #202027;
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 -6px 24px rgba(0, 0, 0, 0.5);
}
html.dark body { background: var(--paper); color: var(--ink); }
html.dark .price-old { color: #8a877f; }
html.dark .cat-tab { background: var(--paper-dim); color: var(--ink); }
html.dark img { filter: brightness(0.92); }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 76px;
  position: relative;
  background: var(--paper);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(8px);
  z-index: 20;
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.topbar-detail { justify-content: space-between; }
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand-mark {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--red);
  font-size: 20px;
  letter-spacing: -1px;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 16px;
  position: relative;
}
.icon-btn:active { background: var(--paper-dim); }
.cart-icon-btn { position: relative; }
.cart-badge, .nav-cart-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--red);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  font-family: var(--font-mono);
}
.cart-badge.hidden, .nav-cart-badge.hidden { display: none; }

/* style.css ထဲက halftone-band ကို ဒီလိုပြင်ပါ */
.halftone-band {
  height: 26px;
  margin: 0 16px;
  background-image: radial-gradient(circle, var(--ink) 1.1px, transparent 1.2px);
  background-size: 7px 7px;
  -webkit-mask-image: linear-gradient(100deg, transparent 0%, black 15%, black 55%, transparent 75%);
  mask-image: linear-gradient(100deg, transparent 0%, black 15%, black 55%, transparent 75%);
  opacity: 0.35;
  position: relative; /* ✅ ဒါကို ထည့်လိုက်ပါ */
}

/* ---------- Category tabs ---------- */
.cat-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px 4px;
  overflow-x: auto;
}
.cat-tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--paper-dim);
  color: var(--ink);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.cat-tab.active { background: var(--ink); color: var(--white); }

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 16px 20px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  padding: 10px 14px 20px;
}
.product-card {
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  transition: transform 0.12s ease;
}
.product-card:active { transform: scale(0.98); }
.product-card-img-wrap { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--paper-dim); }
.product-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.discount-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--red);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
}
.product-card-body { padding: 7px 8px 9px; }
.product-card-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-prices { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.price-main { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--ink); }
.price-old { font-family: var(--font-mono); font-size: 10px; color: #9a978f; text-decoration: line-through; }

/* ---------- Detail page ---------- */
.detail-image-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--paper-dim); }
.detail-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.detail-discount-tag {
  position: absolute; top: 14px; left: 14px;
  background: var(--red); color: var(--white);
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  padding: 4px 9px; border-radius: 7px;
}
.detail-body { padding: 18px 18px 100px; }
.detail-name { font-family: var(--font-display); font-size: 20px; margin: 0 0 8px; }
.detail-price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.detail-price-row .price-main { font-size: 22px; }
.detail-price-row .price-old { font-size: 14px; }
.detail-desc { font-size: 14px; line-height: 1.6; color: #4d4a44; margin-bottom: 20px; }
.option-block { margin-bottom: 20px; }
.option-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #8a877f; margin-bottom: 10px; }
.option-pills { display: flex; flex-wrap: wrap; gap: 9px; }
.option-pill {
  padding: 8px 16px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  background: var(--white);
}
.option-pill.selected { border-color: var(--red); color: var(--red); background: #fdeef0; }
.qty-counter {
  display: inline-flex; align-items: center; gap: 18px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 16px;
}
.qty-counter button { font-size: 13px; width: 22px; }
#qty-value { font-family: var(--font-mono); font-weight: 700; min-width: 18px; text-align: center; }

/* ---------- DETAIL PAGE FIX (Add to Cart Button) ---------- */
.detail-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--line);
    z-index: 30;
    box-sizing: border-box;
    /* Bottom nav နဲ့ မထပ်အောင် padding ထည့်မယ် */
    margin-bottom: 76px; 
}

/* ---------- Buttons ---------- */
.btn-black {
  background: var(--ink); color: var(--white);
  padding: 13px 20px; border-radius: 12px;
  font-weight: 700; font-size: 14px;
}
.btn-black:active { background: #000; }
.btn-outline {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 13px 20px; border-radius: 12px;
  font-weight: 700; font-size: 14px;
}
.btn-full { width: 100%; }

/* ---------- Cart page ---------- */
.cart-list { padding: 8px 16px 160px; display: flex; flex-direction: column; gap: 12px; }
.cart-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px;
}
.cart-row-check {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 11px; color: var(--white);
}
.cart-row-check.checked { background: var(--red); border-color: var(--red); }
.cart-row-num {
  font-family: var(--font-mono); font-size: 11px; color: #b0ada4;
  width: 16px; text-align: center; flex-shrink: 0;
}
.cart-row img { width: 58px; height: 58px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.cart-row-info { flex: 1; min-width: 0; }
.cart-row-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.cart-row-meta { font-size: 11px; color: #8a877f; margin-bottom: 4px; }
.cart-row-bottom { display: flex; justify-content: space-between; align-items: center; }
.cart-row-price { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.cart-row-delete { color: var(--red); font-size: 12px; font-weight: 600; }

.cart-empty { text-align: center; padding: 80px 20px; color: #8a877f; }
.cart-empty i { font-size: 40px; margin-bottom: 14px; color: var(--line); }
.cart-empty .btn-black { margin-top: 16px; }

.cart-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  z-index: 30;
  /* Bottom nav နဲ့ မထပ်အောင် အောက်ကနေ နေရာလွတ်ပေးမယ် */
  margin-bottom: 76px;
}
.cart-total-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 10px; color: #4d4a44; }
#cart-total-amount { font-family: var(--font-mono); font-weight: 700; color: var(--ink); font-size: 15px; }
.cart-footer-actions { display: flex; gap: 10px; }
.cart-footer-actions button { flex: 1; }

.select-all-btn { font-size: 12px; font-weight: 600; color: var(--red); }

/* ---------- Checkout sheet ---------- */
.checkout-sheet { padding-bottom: 24px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  margin-bottom: 16px;
}
.checkout-form { display: flex; flex-direction: column; gap: 14px; }
.checkout-form label { font-size: 12px; font-weight: 600; color: #6b6862; display: flex; flex-direction: column; gap: 6px; }
.checkout-form input, .checkout-form select, .checkout-form textarea {
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; color: var(--ink); background: var(--white);
}
.checkout-form textarea { resize: vertical; min-height: 60px; }
.pay-number-box {
  background: var(--paper-dim); border-radius: 10px; padding: 10px 13px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--red-dark);
}
.receipt-preview { width: 100%; max-height: 200px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); }
.checkout-total-row { display: flex; justify-content: space-between; font-size: 14px; padding-top: 6px; border-top: 1px dashed var(--line); }
#checkout-total-amount { font-family: var(--font-mono); font-weight: 700; }

/* ---------- Success modal ---------- */
.success-sheet { text-align: center; padding: 32px 24px calc(24px + env(safe-area-inset-bottom)); }
.success-sheet i { font-size: 48px; color: var(--red); margin-bottom: 14px; }
.success-sheet h2 { font-family: var(--font-display); margin: 0 0 6px; }
#success-order-id { font-family: var(--font-mono); font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.success-note { font-size: 13px; color: #8a877f; margin: 0 0 20px; }

/* ---------- Categories page ---------- */
.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
.category-card {
  background: var(--gray-dark);
  color: var(--white);
  border-radius: var(--radius);
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.category-card-url { font-family: var(--font-mono); font-size: 11px; opacity: 0.45; letter-spacing: 0.08em; }
.category-card-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }

/* ---------- Account page ---------- */
.account-hero { display: flex; flex-direction: column; align-items: center; padding: 32px 16px 20px; }
.avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--gray-dark); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 12px;
}
.account-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.account-phone { font-family: var(--font-mono); font-size: 12px; color: #8a877f; margin-top: 4px; }
.account-menu { padding: 8px 16px; display: flex; flex-direction: column; }
.account-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 6px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 500; text-align: left;
}
.account-row span:first-of-type { flex: 1; }
.account-row i:first-child { width: 18px; color: #8a877f; }
.account-row i:last-child { font-size: 12px; color: #cfccc4; }
.account-row-danger { color: var(--red); }
.account-row-danger i:first-child { color: var(--red); }
.account-footer { text-align: center; font-size: 11px; color: #b0ada4; padding: 24px 16px; }

/* ---------- Orders list ---------- */
.orders-list { padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
.order-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.order-card-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.order-card-id { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.order-status {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px;
  text-transform: capitalize;
}
.order-status.pending { background: #fef3e0; color: var(--gold); }
.order-status.approved { background: #e5f5ea; color: #2e9e5b; }
.order-status.shipped { background: #e6f0fb; color: #2f6fd6; }
.order-status.cancelled { background: #fbe7e8; color: var(--red-dark); }
.order-card-items { font-size: 12px; color: #6b6862; margin-bottom: 8px; }
.order-card-total { font-family: var(--font-mono); font-weight: 700; font-size: 13px; text-align: right; }
.orders-empty { text-align: center; padding: 60px 20px; color: #8a877f; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; color: #a9a69f;
  position: relative; padding: 4px 0;
}
.nav-item i { font-size: 18px; }
.nav-item.active { color: var(--red); }

/* ---------- Pages / routing ---------- */
.page { display: none; }
.page.active { display: block; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-60px);
  background: var(--ink); color: var(--white);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  z-index: 200; opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: 90%; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- Search Page (Inside Index) ---------- */
#page-search {
    padding: 0;
    background: var(--white);
    min-height: 100vh;
}
.search-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}
.search-header .back-btn {
    font-size: 20px;
    cursor: pointer;
    color: var(--ink);
    margin-right: 16px;
    background: none;
    border: none;
}
.search-header input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 8px 0;
    background: transparent;
}
.search-header .clear-btn {
    font-size: 18px;
    color: #8a877f;
    cursor: pointer;
    background: none;
    border: none;
}
.search-history-box {
    padding: 12px 16px;
    border-bottom: 1px solid var(--paper-dim);
}
.search-history-box .head {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #8a877f;
    margin-bottom: 8px;
}
.search-history-box .head .clear-all {
    color: var(--red);
    cursor: pointer;
    font-weight: 600;
}
.search-history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.search-history-chips .chip {
    background: var(--paper-dim);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
}
.search-results-area {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--paper-dim);
}
.search-result-item img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
}
.search-result-item .info {
    flex: 1;
}
.search-result-item .info h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
}
.search-result-item .info p {
    font-size: 13px;
    color: #8a877f;
    margin: 0;
}
.search-not-found {
    text-align: center;
    padding: 80px 20px;
}
.search-not-found img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* ---------- Auth Modal (Beautiful) ---------- */
#authModal .login-box {
    background: var(--white);
    border-radius: 20px;
    padding: 30px 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}
#authModal .login-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--red), var(--gold));
}
#authModal .login-box h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--ink);
}
#authModal .login-box input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    font-size: 14px;
    background: var(--paper-dim);
    transition: 0.2s;
}
#authModal .login-box input:focus {
    border-color: var(--red);
    outline: none;
    background: var(--white);
}
#authModal .login-box button {
    width: 100%;
    padding: 14px;
    background: var(--ink);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 4px;
}
#authModal .login-box button:hover {
    background: var(--red);
}
#authModal .login-box .toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #6b6862;
    cursor: pointer;
}
#authModal .login-box .toggle span {
    color: var(--red);
    font-weight: 600;
}

/* style.css ထဲက ဒီအပိုင်းကို ရှာပြီး အစားထိုးပါ */
#authModal .login-box .close-btn {
    position: absolute;
    top: 12px;
    right: 16px; /* ✅ ညာဘက်ထောင့်မှာ ကပ်နေအောင် */
    font-size: 20px;
    color: #8a877f;
    cursor: pointer;
    background: none;
    border: none;
    /* ✅ အောက်ပါ line ၃ ကြောင်းကို ထည့်ပါ */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(4,1fr); max-width:1200px; } .category-nav { justify-content:center; } }
/* ===== MODAL FIX (Checkout, Auth) ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal.open {
    display: flex;
}
.modal-inner {
    background: var(--white);
    width: 94%;
    max-width: 480px;
    border-radius: 20px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.3s ease;
    position: relative;
    padding: 24px 20px 20px;  /* padding ကို ပိုထည့်လိုက်ပါ */
}

.checkout-sheet {
    padding-bottom: 24px;
}
@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== RECEIPT INPUT FIX ===== */
#receipt-input {
    font-family: var(--font-body);
    color: var(--ink);
    padding: 10px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--white);
    width: 100%;
}
.product-card.out-of-stock { opacity: 0.55; }
.product-card.out-of-stock .product-card-img-wrap img { filter: grayscale(60%); }
/* Honeypot — visually hidden but still present in the raw DOM/HTML for bots to "see" */
.honeypot-data {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  left: -9999px !important;
}
/* Scrolling Banner Animation */
@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}