@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

:root {
  --pink: #ef608c;          /* hồng đào dịu theo tông KhangBaby */
  --pink-dark: #d84a75;
  --bg: #fdf4f7;            /* nền trắng ánh hồng nhạt */
  --card: #ffffff;
  --text: #2b2b33;
  --muted: #8a8a94;
  --line: #f4dde5;
  --green: #2bb673;
  --shadow: 0 4px 18px rgba(216, 74, 117, .10);
}

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

body {
  font-family: 'Be Vietnam Pro', -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 14px; }

/* Header */
header {
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  color: #fff;
  padding: 16px 0;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
header .wrap { display: flex; align-items: center; justify-content: space-between; }
header h1 { font-size: 20px; display: flex; gap: 8px; align-items: center; }
header .links a { color: #fff; text-decoration: none; font-size: 13px; margin-left: 14px; opacity: .9; }
header .links a:hover { opacity: 1; text-decoration: underline; }

.cart-btn {
  background: #fff; color: var(--pink-dark); border: none;
  padding: 8px 14px; border-radius: 20px; font-weight: 600;
  cursor: pointer; font-size: 14px;
}

/* Banner gioi thieu CTV */
.ref-banner {
  background: #fff8e6; border: 1px solid #ffe3a3; color: #9a6b00;
  padding: 10px 14px; border-radius: 10px; margin: 14px 0; font-size: 14px;
  display: none;
}

/* Luoi san pham */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin: 18px 0 40px; }
.product {
  background: var(--card); border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  border: 1px solid var(--line); transition: transform .15s, box-shadow .15s;
}
.product:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(216, 74, 117, .18); }
.product .emoji { font-size: 46px; text-align: center; margin: 6px 0 10px; }
.product .pimg { width: 100%; height: 130px; object-fit: contain; border-radius: 10px; margin-bottom: 8px; background: #fafafa; }
.product h3 { font-size: 14px; min-height: 38px; }
.product .desc { font-size: 12px; color: var(--muted); margin: 4px 0 8px; min-height: 30px; }
.product .price { color: var(--pink-dark); font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.btn {
  background: var(--pink); color: #fff; border: none; border-radius: 10px;
  padding: 10px; font-weight: 600; cursor: pointer; font-size: 14px; width: 100%;
  transition: background .15s;
}
.btn:hover { background: var(--pink-dark); }
.btn.ghost { background: #fff; color: var(--pink-dark); border: 1.5px solid var(--pink); }
.btn.green { background: var(--green); }
.btn:disabled { opacity: .5; cursor: default; }

/* Modal chung */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: flex-start; justify-content: center;
  padding: 30px 14px; z-index: 100; overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 440px;
  padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal .close { float: right; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }

/* Gio hang */
.cart-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item .ci-name { flex: 1; font-size: 14px; }
.cart-item .ci-name small { color: var(--muted); display: block; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 26px; height: 26px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 15px; }
.cart-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; margin: 14px 0; }

/* Form */
label { display: block; font-size: 13px; margin: 10px 0 4px; font-weight: 600; }
input, select {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--pink); }

/* QR thanh toan */
.qr-box { text-align: center; }
.qr-box img { width: 240px; height: 240px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.pay-info { background: var(--bg); border-radius: 10px; padding: 12px; margin: 12px 0; font-size: 14px; text-align: left; }
.pay-info div { display: flex; justify-content: space-between; padding: 3px 0; }
.pay-info b { color: var(--pink-dark); }

/* Bang so lieu */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--card); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.stat .n { font-size: 22px; font-weight: 700; color: var(--pink-dark); }
.stat .l { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #fff0f5; font-size: 12px; }
.badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.paid { background: #e3f6ec; color: var(--green); }
.badge.pending { background: #fff3cd; color: #9a6b00; }

.center { text-align: center; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 18px; border-radius: 24px;
  font-size: 14px; z-index: 200; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.link-copy { display: flex; gap: 8px; margin-top: 6px; }
.link-copy input { font-size: 13px; }

.page-title { margin: 20px 0 6px; font-size: 22px; }
.card-box { background: #fff; border-radius: 14px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }

/* Thanh tim kiem */
.searchbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 0; position: sticky; top: 56px; z-index: 40; }
.searchbar input { border-radius: 24px; border: 1.5px solid var(--line); padding: 11px 16px; }

/* Banner */
.banner { background: linear-gradient(135deg, #fff0f5, #ffe0ea); color: var(--pink-dark); border-radius: 14px; padding: 16px 18px; margin: 16px 0; font-weight: 600; text-align: center; box-shadow: var(--shadow); }

/* Chip danh muc (cu - van dung o cho khac neu can) */
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.chip { white-space: nowrap; border: 1.5px solid var(--line); background: #fff; color: var(--text); padding: 8px 16px; border-radius: 20px; font-size: 14px; cursor: pointer; font-family: inherit; }
.chip.on { background: var(--pink); color: #fff; border-color: var(--pink); }

/* Bo cuc 2 cot: danh muc trai + san pham phai */
.shop-layout { display: flex; gap: 14px; align-items: flex-start; margin-top: 6px; }
.sidebar {
  width: 200px; flex-shrink: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; box-shadow: var(--shadow);
  position: sticky; top: 116px;
}
.sidebar-title { font-weight: 700; font-size: 14px; padding: 6px 10px 8px; color: var(--pink-dark); }
.cat-item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 11px 12px; border-radius: 10px; font-size: 14.5px; cursor: pointer;
  font-family: inherit; color: var(--text); margin-bottom: 2px; transition: background .12s;
}
.cat-item:hover { background: #fff2f6; }
.cat-item.on { background: var(--pink); color: #fff; font-weight: 600; }
.content { flex: 1; min-width: 0; }
.content .grid { margin: 0 0 40px; }

/* Danh muc con (hang bim) */
.subcats { margin: 2px 0 4px 6px; padding-left: 8px; border-left: 2px solid var(--line); }
.sub-item {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  width: 100%; text-align: left; border: none; background: transparent;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; cursor: pointer;
  font-family: inherit; color: var(--text); margin-bottom: 1px;
}
.sub-item:hover { background: #fff2f6; }
.sub-item.on { background: #ffe3ec; color: var(--pink-dark); font-weight: 600; }
.sub-item .cnt { color: var(--muted); font-size: 11px; font-weight: 400; }
.sub-item.on .cnt { color: var(--pink-dark); }

/* Thanh chon size */
.size-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.size-label { font-size: 13px; color: var(--muted); margin-right: 2px; }
.szchip {
  border: 1.5px solid var(--line); background: #fff; color: var(--text);
  padding: 6px 14px; border-radius: 18px; font-size: 13px; cursor: pointer;
  font-family: inherit; font-weight: 600;
}
.szchip.on { background: var(--pink); color: #fff; border-color: var(--pink); }

@media (max-width: 640px) {
  .shop-layout { gap: 8px; }
  .sidebar { width: 116px; padding: 6px; top: 108px; border-radius: 12px; }
  .sidebar-title { font-size: 12px; padding: 4px 6px 6px; }
  .cat-item { padding: 10px 8px; font-size: 13px; }
  .content .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
}

/* Dang nhap */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--pink), var(--pink-dark)); }
.login-card { background: #fff; border-radius: 18px; padding: 30px 26px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.login-logo { font-size: 24px; font-weight: 700; text-align: center; color: var(--pink-dark); }
.login-err { color: var(--pink-dark); font-size: 14px; margin-top: 10px; text-align: center; min-height: 18px; }

/* Trang mua nhanh 1 san pham */
.buy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.buy-media { display: flex; align-items: center; justify-content: center; background: #fafafa; border-radius: 12px; min-height: 220px; }
.buy-media img { max-width: 100%; max-height: 260px; object-fit: contain; }
.buy-media .emoji-lg { font-size: 90px; }
.price-lg { color: var(--pink-dark); font-weight: 700; font-size: 26px; margin: 8px 0; }
@media (max-width: 640px) { .buy-grid { grid-template-columns: 1fr; } }
.qr-box .link-copy { margin-top: 10px; }

/* Chon phuong thuc thanh toan */
.pay-methods { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.pay-opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff;
  transition: border-color .15s, background .15s;
}
.pay-opt .pico { font-size: 24px; }
.pay-opt b { font-size: 14px; display: block; }
.pay-opt small { color: var(--muted); font-size: 12px; }
.pay-opt span:nth-child(2) { flex: 1; }
.pay-opt .pradio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.pay-opt.selected { border-color: var(--pink); background: #fff6f9; }
.pay-opt.selected .pradio { border-color: var(--pink); background: radial-gradient(var(--pink) 45%, #fff 50%); }
.ok-check { font-size: 54px; text-align: center; margin-bottom: 6px; }
