/* VDX Shop storefront. Mobile first; brand blue #1a4fa0 / #0080f0, orange #f08000. */
:root {
  --blue: #1a4fa0; --blue-2: #0080f0; --orange: #f08000; --red: #e03131;
  --ink: #1f2430; --muted: #6b7280; --line: #e5e7eb; --bg: #f4f6fa; --card: #fff; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.topbar { background: var(--blue); color: #fff; font-size: 13px; }
.topbar .wrap { display: flex; justify-content: space-between; gap: 12px; padding-top: 6px; padding-bottom: 6px; }
.topbar a { color: #fff; }
.header { background: linear-gradient(90deg, var(--blue), var(--blue-2)); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.header .wrap { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 20px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { width: 32px; height: 32px; }
.search { display: flex; background: #fff; border-radius: 8px; overflow: hidden; }
.search input { flex: 1; border: 0; padding: 10px 12px; min-width: 0; outline: none; }
.search button { border: 0; background: var(--orange); color: #fff; padding: 0 16px; cursor: pointer; }
.hdr-links { display: flex; gap: 16px; align-items: center; }
.hdr-links a { color: #fff; display: flex; align-items: center; gap: 6px; position: relative; font-size: 14px; }
.hdr-links svg { width: 24px; height: 24px; }
.badge-count { position: absolute; top: -6px; left: 14px; background: var(--orange); color: #fff; border-radius: 10px; font-size: 11px; min-width: 18px; text-align: center; padding: 0 5px; line-height: 18px; }
.catbar { background: #fff; border-bottom: 1px solid var(--line); }
.catbar .wrap { display: flex; gap: 8px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.catbar a { white-space: nowrap; padding: 4px 12px; border-radius: 16px; background: var(--bg); color: var(--ink); font-size: 14px; }
.catbar a.on, .catbar a:hover { background: #e6effc; color: var(--blue); text-decoration: none; }
@media (max-width: 720px) {
  .header .wrap { grid-template-columns: 1fr auto; }
  .header .search { grid-column: 1 / -1; grid-row: 2; }
  .hdr-links .label { display: none; }
  .topbar .hide-sm { display: none; }
}

/* blocks */
main { padding: 16px 0 32px; }
.section { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-h h2 { font-size: 18px; margin: 0; }
.hero { border-radius: var(--radius); background: linear-gradient(120deg, var(--blue) 0%, var(--blue-2) 60%, #4fb3ff 100%); color: #fff; padding: 28px 24px; margin-bottom: 16px; position: relative; overflow: hidden; }
.hero h1 { font-size: 26px; margin: 0 0 6px; max-width: 560px; }
.hero p { margin: 0 0 16px; max-width: 520px; opacity: .92; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #d97300; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-outline { background: #fff; border-color: var(--orange); color: var(--orange); }
.btn-light { background: #fff; color: var(--blue); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); text-align: center; font-size: 13px; }
.cat:hover { text-decoration: none; color: var(--blue); }
.cat .ic { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 20px; overflow: hidden; }
.cat .ic img { width: 100%; height: 100%; object-fit: cover; }
.flash-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.flash-h h2 { color: var(--red); text-transform: uppercase; letter-spacing: .5px; }
.countdown { display: inline-flex; gap: 4px; font-weight: 700; }
.countdown span { background: var(--ink); color: #fff; border-radius: 4px; padding: 2px 6px; min-width: 28px; text-align: center; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
@media (min-width: 640px) { .row-scroll { grid-auto-columns: 30%; } }
@media (min-width: 900px) { .row-scroll { grid-auto-columns: calc(20% - 8px); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; color: var(--ink); position: relative; transition: box-shadow .15s, transform .15s; }
.card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(26,79,160,.15); transform: translateY(-2px); }
.card .img { aspect-ratio: 1 / 1; background: #f2f4f8; }
.card .img img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .name { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.price { color: var(--red); font-weight: 700; font-size: 16px; }
.was { color: var(--muted); text-decoration: line-through; font-size: 13px; margin-left: 6px; font-weight: 400; }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: auto; gap: 6px; }
.meta .vendor { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-off { position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.tag-out { position: absolute; inset: 0; background: rgba(255,255,255,.6); display: flex; align-items: center; justify-content: center; }
.tag-out span { background: rgba(31,36,48,.8); color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 13px; }

/* listing */
.listing { display: grid; gap: 16px; }
@media (min-width: 900px) { .listing { grid-template-columns: 240px 1fr; } }
.filters { background: var(--card); border-radius: var(--radius); padding: 16px; align-self: start; }
.filters h3 { font-size: 15px; margin: 0 0 8px; }
.filters .grp { margin-bottom: 16px; }
.filters label { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #cfd5df; border-radius: 8px; padding: 9px 11px; background: #fff; }
.input:focus { outline: 2px solid rgba(0,128,240,.35); border-color: var(--blue-2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sortbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sortbar h1 { font-size: 20px; margin: 0; }
.sorts { display: flex; gap: 6px; flex-wrap: wrap; }
.sorts a { padding: 6px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 13px; }
.sorts a.on { border-color: var(--blue); color: var(--blue); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 12px; border-radius: 6px; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.pager .on { background: var(--blue); color: #fff; border-color: var(--blue); }
details.mobile-filter > summary { display: none; }
@media (max-width: 899px) { details.mobile-filter > summary { display: inline-flex; cursor: pointer; } details.mobile-filter:not([open]) .filters { display: none; } }

/* product page */
.pd { display: grid; gap: 20px; background: var(--card); border-radius: var(--radius); padding: 16px; }
@media (min-width: 900px) { .pd { grid-template-columns: 460px 1fr; padding: 24px; } }
.gallery .main { aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; background: #f2f4f8; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.thumbs button { border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; cursor: pointer; width: 64px; height: 64px; flex: 0 0 auto; overflow: hidden; }
.thumbs button.on { border-color: var(--orange); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd h1 { font-size: 22px; margin: 0 0 6px; line-height: 1.3; }
.pd .sub { color: var(--muted); font-size: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.pricebox { background: #fff5f5; border-radius: 8px; padding: 12px 16px; margin: 12px 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.pricebox .price { font-size: 26px; }
.off-pill { background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.sale-ends { width: 100%; font-size: 13px; color: var(--red); }
.opt-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; margin: 12px 0; align-items: start; }
@media (max-width: 500px) { .opt-row { grid-template-columns: 1fr; } }
.opt-row .lbl { color: var(--muted); padding-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: inline-block; border: 1px solid #cfd5df; border-radius: 6px; padding: 6px 12px; cursor: pointer; background: #fff; font-size: 14px; }
.chips input:checked + span { border-color: var(--orange); color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
.chips input:focus-visible + span { outline: 2px solid var(--blue-2); }
.qty { display: inline-flex; border: 1px solid #cfd5df; border-radius: 8px; overflow: hidden; }
.qty button { width: 36px; border: 0; background: #f2f4f8; cursor: pointer; font-size: 18px; }
.qty input { width: 52px; text-align: center; border: 0; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 180px; padding: 12px; }
.perks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.perks li::before { content: "✓ "; color: #16a34a; font-weight: 700; }
.vendor-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.vendor-card .av { width: 48px; height: 48px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex: 0 0 auto; }
.desc { white-space: pre-line; line-height: 1.65; }

/* cart & checkout */
.layout-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .layout-2 { grid-template-columns: 1fr 360px; align-items: start; } }
.line { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.line:first-of-type { border-top: 0; }
.line img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #f2f4f8; }
.line .opts { color: var(--muted); font-size: 13px; }
.line .warn { color: var(--red); font-size: 13px; }
.line-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }
.summary { background: var(--card); border-radius: var(--radius); padding: 16px; position: sticky; top: 120px; }
.summary .r { display: flex; justify-content: space-between; margin: 6px 0; }
.summary .total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.hint { background: #fff7ed; color: #9a4b00; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 8px 0; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; margin-bottom: 4px; font-weight: 600; }
.field .err { color: var(--red); font-size: 13px; margin-top: 4px; }
.pay { display: grid; gap: 8px; }
.pay label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #cfd5df; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.pay label.dis { opacity: .55; cursor: not-allowed; }
.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.alert-err { background: #fdecec; color: #8a1c1c; }
.alert-ok { background: #e8f7ee; color: #14532d; }
.done { text-align: center; padding: 32px 16px; }
.done .ok { width: 64px; height: 64px; border-radius: 50%; background: #16a34a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 34px; margin-bottom: 12px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; background: #eef2f7; padding: 2px 8px; border-radius: 6px; }
.state { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; background: #eef2f7; }
.state.awaiting_payment, .state.pending { background: #fff4e5; color: #9a4b00; }
.state.confirmed, .state.shipping { background: #e6effc; color: var(--blue); }
.state.delivered, .state.completed { background: #e8f7ee; color: #166534; }
.state.cancelled, .state.returned { background: #f1f2f4; color: #4b5563; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 0 0 12px 12px; }
.timeline li:first-child { border-color: var(--blue); }
.qr { max-width: 240px; margin: 12px auto; border: 1px solid var(--line); border-radius: 8px; }

/* footer */
.footer { background: #fff; border-top: 1px solid var(--line); padding: 24px 0; font-size: 14px; color: var(--muted); }
.footer .cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer h4 { color: var(--ink); margin: 0 0 8px; font-size: 15px; }
.footer a { color: var(--muted); display: block; margin: 2px 0; }
.demo-note { background: #fff7ed; color: #9a4b00; text-align: center; font-size: 13px; padding: 6px 16px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.toast a { color: #ffd08a; margin-left: 8px; }
