:root{
  --cream: #F8F6FC;
  --ink: #2B2438;
  --ink-soft: #6E6580;
  --rose: #B2A6E8;
  --rose-deep: #6C4FA0;
  --sage: #C15FC9;
  --sage-deep: #96389E;
  --card: #FFFFFF;
  --line: #E6E1F5;
  --coral: #96389E;
}
*{box-sizing:border-box; margin:0; padding:0;}
body{
  background: var(--cream);
  color: var(--ink);
  font-family: 'Be Vietnam Pro', sans-serif;
  line-height: 1.5;
  padding-bottom: 90px;
}
h1,h2,h3, .display{
  font-family: 'Maven Pro', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}
a{ color: inherit; text-decoration: none; }
img{ max-width:100%; display:block; }

/* ---- Top bar ---- */
.topbar{
  position: sticky; top:0; z-index: 30;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  display:flex; align-items:center; justify-content:space-between;
}
.logo{
  font-family:'Maven Pro', sans-serif;
  font-weight:800; font-size:20px;
  color: var(--rose-deep);
  display:flex; align-items:center; gap:8px;
}
.logo img{ width:34px; height:34px; border-radius:9px; }
.logo .sub{ color: var(--ink-soft); font-weight:500; font-size:12px; display:block; margin-top:-2px; }
.cart-btn{
  position: relative;
  width:40px; height:40px;
  border-radius: 50%;
  background: var(--card);
  border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.cart-count{
  position:absolute; top:-4px; right:-4px;
  background: var(--coral); color:#fff;
  font-size:11px; font-weight:600;
  min-width:18px; height:18px; border-radius:9px;
  display:flex; align-items:center; justify-content:center;
  padding: 0 4px;
}

/* ---- Hero ---- */
.hero{ padding: 36px 20px 28px; position: relative; overflow: hidden; }
.hero-tag{ font-size: 13px; color: var(--sage-deep); font-weight: 600; margin-bottom: 8px; }
.hero h1{ font-size: 34px; line-height: 1.15; color: var(--ink); max-width: 320px; }
.hero h1 .accent{ color: var(--rose-deep); }
.hero p{ margin-top: 12px; color: var(--ink-soft); max-width: 300px; font-size: 15px; }
.hero-cta{
  margin-top: 20px; display:inline-flex;
  background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 14px; cursor: pointer; border: none;
}
.hero-blob{
  position:absolute; right:-40px; top:-20px;
  width: 180px; height:180px; background: var(--rose);
  opacity: 0.18; border-radius: 50%; filter: blur(2px);
}
.hero-visual{
  margin-top: 24px;
  aspect-ratio: 4/3;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.hero-visual img{ width:100%; height:100%; object-fit:cover; }

/* ---- Category chips ---- */
.chips{ display:flex; gap:10px; padding: 4px 20px 22px; overflow-x:auto; scrollbar-width:none; }
.chips::-webkit-scrollbar{ display:none; }
.chip{
  flex:0 0 auto; padding:9px 18px; border-radius: 999px;
  background: var(--card); border:1px solid var(--line);
  font-size:14px; font-weight:500; cursor:pointer; white-space:nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip.active{ background: var(--ink); color:#fff; border-color: var(--ink); }

/* ---- Product grid ---- */
.section-head{ padding: 0 20px; display:flex; align-items:baseline; justify-content:space-between; margin-bottom: 14px; }
.section-head h2{ font-size: 20px; }
.section-head span{ font-size:13px; color:var(--ink-soft); }
.grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 20px 8px; }
.card{ background: var(--card); border-radius: 18px; overflow:hidden; border: 1px solid var(--line); display:flex; flex-direction:column; cursor:pointer; }
.card-img{ aspect-ratio: 1/1; background: linear-gradient(135deg, #EDE8FA, #F6E8F7); display:flex; align-items:center; justify-content:center; overflow:hidden; }
.card-img img{ width:100%; height:100%; object-fit:cover; }
.card-body{ padding: 12px 12px 14px; display:flex; flex-direction:column; gap:6px; flex:1; }
.card-tag{ font-size: 11px; font-weight: 600; color: var(--sage-deep); }
.card-name{ font-size: 13px; font-weight:600; line-height:1.35; min-height: 36px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.card-bottom{ margin-top:auto; display:flex; align-items:center; justify-content:space-between; gap:6px; }
.card-price{ font-size: 14px; font-weight:700; color: var(--rose-deep); }
.add-btn{
  width:32px; height:32px; border-radius: 50%; background: var(--sage);
  color:#fff; border:none; font-size: 18px; line-height:1; cursor:pointer;
  display:flex; align-items:center; justify-content:center; flex:0 0 auto;
}
.add-btn:active{ transform: scale(0.92); }
.stock-out{ opacity: 0.5; }
.stock-out .add-btn{ background: var(--ink-soft); pointer-events:none; }

/* ---- Chọn phân loại sản phẩm ---- */
.variant-list{ display:flex; flex-direction:column; gap:8px; padding: 4px 0 8px; }
.variant-row{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px; border-radius:14px; border:1px solid var(--line); background:#fff;
  cursor:pointer;
}
.variant-row:active{ background: var(--cream); }
.variant-row.disabled{ opacity:0.45; pointer-events:none; }
.variant-row .vname{ font-size:14px; font-weight:600; }
.variant-row .vmeta{ font-size:12px; color:var(--ink-soft); margin-top:2px; }
.variant-row .vprice{ font-size:14px; font-weight:700; color: var(--rose-deep); white-space:nowrap; }
.product-detail-img{ width:100%; aspect-ratio:1/1; border-radius:16px; overflow:hidden; margin-bottom:14px; background: linear-gradient(135deg, #EDE8FA, #F6E8F7); }
.product-detail-img img{ width:100%; height:100%; object-fit:cover; }
.product-detail-name{ font-size:16px; font-weight:700; margin-bottom:4px; line-height:1.4; }

/* ---- Trust strip ---- */
.trust{ margin: 36px 20px 8px; background: var(--card); border:1px solid var(--line); border-radius: 18px; padding: 20px 18px; display:flex; flex-direction:column; gap:16px; }
.trust-item{ display:flex; gap:12px; align-items:flex-start; }
.trust-icon{ width:38px; height:38px; border-radius: 12px; background: var(--cream); display:flex; align-items:center; justify-content:center; font-size:18px; flex:0 0 auto; }
.trust-text b{ display:block; font-size:14px; margin-bottom:2px; }
.trust-text span{ font-size:13px; color: var(--ink-soft); }

/* ---- Footer ---- */
footer{ margin-top: 36px; padding: 26px 20px 20px; text-align:center; }
footer .fname{ font-family:'Maven Pro'; font-weight:700; color:var(--rose-deep); font-size:18px;}
footer p{ font-size:13px; color:var(--ink-soft); margin-top:6px; }

/* ---- Floating checkout bar ---- */
.float-bar{
  position: fixed; left:16px; right:16px; bottom:16px;
  background: var(--ink); color:#fff; border-radius: 999px;
  padding: 12px 10px 12px 20px; display:flex; align-items:center; justify-content:space-between;
  box-shadow: 0 10px 30px rgba(46,38,32,0.28);
  transform: translateY(120%); transition: transform .25s ease; z-index: 40;
}
.float-bar.show{ transform: translateY(0); }
.float-bar .fcount{ font-size:13px; opacity:0.85; }
.float-bar .ftotal{ font-weight:700; font-size:15px; margin-top:2px; }
.float-bar button{ background: var(--rose); color:#fff; border:none; padding:10px 18px; border-radius: 999px; font-weight:600; font-size:14px; cursor:pointer; }

/* ---- Drawer / overlay ---- */
.overlay{ position: fixed; inset:0; background: rgba(46,38,32,0.4); opacity:0; pointer-events:none; transition: opacity .2s ease; z-index: 50; }
.overlay.show{ opacity:1; pointer-events:auto; }
.drawer{
  position: fixed; left:0; right:0; bottom:0; background: var(--cream);
  border-radius: 22px 22px 0 0; max-height: 85vh; display:flex; flex-direction:column;
  transform: translateY(100%); transition: transform .25s ease; z-index: 51;
}
.drawer.show{ transform: translateY(0); }
.drawer-head{ padding: 16px 20px 10px; display:flex; align-items:center; justify-content:space-between; border-bottom: 1px solid var(--line); }
.drawer-head h3{ font-size:18px; }
.drawer-close{ width:30px; height:30px; border-radius:50%; background:#fff; border:1px solid var(--line); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:16px; }
.drawer-list{ overflow-y:auto; padding: 8px 20px; flex:1; }
.drawer-empty{ padding: 30px 0; text-align:center; color:var(--ink-soft); font-size:14px; }
.line-item{ display:flex; align-items:center; gap:12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.li-icon{ width:48px; height:48px; border-radius:12px; background: linear-gradient(135deg, #F3E4E8, #EDEFE3); display:flex; align-items:center; justify-content:center; font-size:22px; flex:0 0 auto; }
.li-body{ flex:1; min-width:0; }
.li-name{ font-size:14px; font-weight:600; }
.li-price{ font-size:13px; color:var(--ink-soft); margin-top:2px; }
.li-qty{ display:flex; align-items:center; gap:8px; }
.qty-btn{ width:26px; height:26px; border-radius:50%; border:1px solid var(--line); background:#fff; font-size:14px; cursor:pointer; }
.qty-val{ font-size:14px; font-weight:600; width:16px; text-align:center; }
.drawer-foot{ padding: 14px 20px 20px; border-top: 1px solid var(--line); }
.foot-row{ display:flex; justify-content:space-between; font-size:14px; margin-bottom:12px; }
.foot-row b{ font-size:16px; }
.checkout-btn{ width:100%; background: var(--rose-deep); color:#fff; border:none; padding:14px; border-radius: 14px; font-weight:700; font-size:15px; cursor:pointer; }
.checkout-btn:disabled{ opacity:0.5; cursor:not-allowed; }
.checkout-note{ font-size:12px; color:var(--ink-soft); text-align:center; margin-top:8px; }

/* ---- Checkout form ---- */
.form-field{ margin-bottom: 12px; }
.form-field label{ display:block; font-size:13px; font-weight:600; margin-bottom:4px; }
.form-field input, .form-field textarea{
  width:100%; padding:10px 12px; border-radius:10px;
  border:1px solid var(--line); font-family:inherit; font-size:14px; background:#fff;
}
.form-field textarea{ resize:vertical; min-height:60px; }
.back-link{ font-size:13px; color: var(--sage-deep); font-weight:600; cursor:pointer; display:inline-block; margin-bottom:10px; }
.success-box{ text-align:center; padding: 30px 10px; }
.success-box .emoji{ font-size:44px; margin-bottom:12px; }
.success-box h3{ font-size:20px; margin-bottom:8px; }
.success-box p{ color:var(--ink-soft); font-size:14px; }
.qr-box{
  background:#fff; border:1px solid var(--line); border-radius:16px;
  padding: 18px; text-align:center; margin: 0 4px 20px;
}
.qr-img{ width: 220px; height:220px; margin: 0 auto 12px; border-radius:10px; }
.qr-note{ font-size:13px; color:var(--ink-soft); line-height:1.5; }
.qr-note b{ color: var(--ink); }

@media (min-width: 640px) and (max-width: 1023px){
  .grid{ grid-template-columns: repeat(3, 1fr); max-width:600px; margin:0 auto; }
  .hero, .topbar, .chips, .section-head, .trust{ max-width:600px; margin-left:auto; margin-right:auto; }
  .float-bar, .drawer{ max-width:600px; margin:0 auto; left:0; right:0; }
}

/* ============================================================
   DESKTOP — bố cục riêng cho màn hình rộng, không chỉ kéo giãn
   bản mobile: nav ngang cố định, hero 2 cột, lưới 4 sản phẩm,
   giỏ hàng trượt ra dạng panel bên phải thay vì khay đáy màn hình.
   ============================================================ */
@media (min-width: 1024px){
  body{ padding-bottom: 0; }

  .topbar, .hero, .chips, .section-head, .trust, footer{
    max-width: 1180px; margin-left:auto; margin-right:auto;
  }
  .topbar{ padding: 20px 32px; }
  .logo{ font-size:26px; }

  /* Hero: chữ bên trái, khối minh họa sản phẩm bên phải */
  .hero{
    display:flex; align-items:center; gap:56px;
    padding: 64px 32px 56px;
  }
  .hero-blob{ width:320px; height:320px; right:8%; top:10%; opacity:0.14; }
  .hero > .hero-copy{ flex: 0 0 auto; max-width: 420px; }
  .hero h1{ font-size: 46px; max-width: 420px; }
  .hero p{ max-width: 380px; font-size:16px; }
  .hero-visual{
    flex: 1;
    max-width: 440px;
    aspect-ratio: 4/3;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 20px 40px rgba(108,79,160,0.12);
  }
  .hero-visual img{
    width: 100%; height: 100%;
    object-fit: cover;
  }

  /* Danh mục: hàng ngang tĩnh dưới hero, căn giữa, không cuộn */
  .chips{ padding: 8px 32px 32px; justify-content:flex-start; }
  .chip{ padding: 11px 24px; font-size:15px; }

  .section-head{ padding: 0 32px; margin-bottom:20px; }
  .section-head h2{ font-size:24px; }
  .grid{ grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 0 32px 8px; }
  .card{ border-radius: 20px; transition: transform .15s ease, box-shadow .15s ease; }
  .card:hover{ transform: translateY(-4px); box-shadow: 0 12px 24px rgba(46,38,32,0.08); }
  .card-img{ font-size: 52px; }

  /* Uy tín: 3 cột thay vì xếp chồng */
  .trust{ flex-direction: row; padding: 28px 32px; gap: 28px; }
  .trust-item{ flex: 1; }

  footer{ padding: 40px 32px 32px; }

  /* Giỏ hàng nổi: ẩn đi vì đã có icon giỏ hàng trên nav */
  .float-bar{ display:none; }

  /* Khay giỏ hàng: trượt ra từ bên phải như 1 panel, không phải khay đáy màn hình */
  .drawer{
    left:auto; right:0; top:0; bottom:0;
    width: 420px; max-width: 90vw;
    height: 100vh; max-height:none;
    border-radius: 0;
    transform: translateX(100%);
  }
  .drawer.show{ transform: translateX(0); }
  .drawer-list{ padding: 8px 28px; }
  .drawer-head{ padding: 22px 28px 14px; }
  .drawer-foot{ padding: 16px 28px 24px; }
}

/* ---- Admin ---- */
.admin-wrap{ max-width: 720px; margin: 0 auto; padding: 20px; }
.admin-login{ max-width:340px; margin: 80px auto; text-align:center; }
.admin-login input{ width:100%; padding:12px; border-radius:10px; border:1px solid var(--line); margin: 14px 0; font-size:14px; }
.admin-login button, .admin-header button{
  background: var(--ink); color:#fff; border:none; padding:10px 18px; border-radius:10px; font-weight:600; cursor:pointer; font-size:14px;
}
.admin-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.tabs{ display:flex; gap:8px; margin-bottom:18px; }
.tab{ padding:8px 16px; border-radius:999px; border:1px solid var(--line); background:#fff; cursor:pointer; font-size:14px; font-weight:500; }
.tab.active{ background: var(--ink); color:#fff; border-color:var(--ink); }
.order-card, .product-row{
  background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 16px; margin-bottom:10px;
}
.order-top{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.order-top b{ font-size:15px; }
.order-meta{ font-size:13px; color:var(--ink-soft); margin-bottom:8px; }
.order-items{ font-size:13px; margin-bottom:10px; }
.order-items div{ display:flex; justify-content:space-between; padding:2px 0; }
.status-select{ padding:6px 10px; border-radius:8px; border:1px solid var(--line); font-size:13px; }
.badge{ font-size:11px; font-weight:600; padding:3px 10px; border-radius:999px; }
.badge.moi{ background:#FDECEF; color:var(--rose-deep); }
.badge.dang_giao{ background:#FFF3E0; color:#B26A00; }
.badge.hoan_thanh{ background:#E8F3E7; color:var(--sage-deep); }
.badge.huy{ background:#F1F1F1; color:var(--ink-soft); }
.badge.paid{ background:#E8F3E7; color:var(--sage-deep); }
.badge.unpaid{ background:#FFF3E0; color:#B26A00; }
.product-row{ display:flex; align-items:center; gap:12px; }
.product-row .pi{ font-size:24px; }
.product-row .pinfo{ flex:1; }
.product-row .pinfo b{ font-size:14px; }
.product-row .pinfo span{ font-size:12px; color:var(--ink-soft); display:block; }
.product-row button{ background:none; border:1px solid var(--line); border-radius:8px; padding:6px 10px; font-size:12px; cursor:pointer; }
.product-row button.danger{ color:#B23A3A; border-color:#F0CFCF; }
.variant-edit-panel{
  background:#FAFAFC; border:1px solid var(--line); border-radius:12px;
  padding:12px; margin: -6px 0 12px; display:flex; flex-direction:column; gap:14px;
}
.variant-edit-row{ display:flex; gap:12px; padding-bottom:12px; border-bottom:1px dashed var(--line); }
.variant-edit-row:last-child{ border-bottom:none; padding-bottom:0; }
.variant-edit-thumb{
  width:56px; height:56px; border-radius:10px; object-fit:cover;
  background: var(--cream); border:1px solid var(--line); flex:0 0 auto;
}
.variant-edit-fields{ flex:1; display:flex; flex-direction:column; gap:8px; }
.variant-edit-name{ font-size:13px; font-weight:600; }
.variant-edit-fields .form-row{ display:flex; gap:10px; }
.variant-edit-fields input{
  width:100%; padding:8px 10px; border-radius:8px; border:1px solid var(--line); font-size:13px;
}
.variant-edit-fields button{
  align-self:flex-start; background:var(--sage-deep); color:#fff; border:none;
  padding:8px 14px; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer;
}
.add-product-form{ background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px; margin-bottom:16px; }
.add-product-form h3{ font-size:15px; margin-bottom:10px; }
.form-row{ display:flex; gap:10px; }
.form-row .form-field{ flex:1; }
