/* Trang danh mục, giỏ hàng, thanh toán, đơn của tôi. Dùng chung token trong style.css */

/* ───────── Bố cục 2 cột: bộ lọc / tài khoản ───────── */
.layout-side { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
.side { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 140px; }
.side fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.side legend { font-weight: 700; font-size: 15px; margin-bottom: 8px; padding: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 34px; font-size: 14px; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.check span { margin-left: auto; color: var(--muted); font-size: 13px; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.select { height: 42px; border: 1px solid #CFCDC2; border-radius: 10px; padding: 0 12px; background: #fff; color: var(--ink); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fchip { height: 34px; padding: 0 12px; border-radius: 17px; background: var(--accent-soft); color: var(--accent-dark); border: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.fchip:hover { background: #D6E4D0; }

.acc-nav { display: flex; flex-direction: column; gap: 2px; }
.acc-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.acc-nav a:hover { background: var(--bg); color: var(--ink); }
.acc-nav a.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.acc-nav a span { margin-left: auto; font-size: 12px; font-weight: 700; color: #fff; background: var(--gold); border-radius: 10px; padding: 1px 8px; }
.acc-user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ───────── Form ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink); }
.field label i { font-style: normal; color: #B91C1C; }
.field input, .field textarea, .field select { height: 48px; border: 1px solid #CFCDC2; border-radius: 10px; padding: 0 14px; background: #fff; color: var(--ink); font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field small { font-size: 13px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pay { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .15s, background-color .15s; }
.pay:hover { border-color: var(--accent-mid); }
.pay:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay input { width: 20px; height: 20px; accent-color: var(--accent); margin: 2px 0 0; }
.pay b { display: block; }
.pay small { color: var(--muted); font-size: 13px; }

/* ───────── Giỏ hàng, tóm tắt đơn ───────── */
.line-item { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto 120px 44px; gap: 18px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .art { width: 88px; height: 88px; border-radius: 12px; }
.line-item .art svg { width: 66%; height: 66%; }
.line-price { text-align: right; font-weight: 700; font-size: 16px; }
.qty { display: flex; align-items: center; border: 1px solid #CFCDC2; border-radius: 10px; background: #fff; }
.qty button { width: 40px; height: 40px; border: 0; background: none; font-size: 18px; color: var(--ink); }
.qty input { width: 36px; text-align: center; border: 0; font-weight: 600; background: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 0; background: none; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: #FEF2F2; color: #B91C1C; }
.summary { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 140px; }
.summary h2 { margin: 0; font-size: 20px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--text); }
.sum-row.minus { color: var(--ok); }
.sum-row.total { border-top: 1px solid var(--line); padding-top: 14px; font-size: 17px; font-weight: 700; color: var(--ink); align-items: baseline; }
.sum-row.total b { font-size: 24px; color: var(--gold); }
.voucher { display: flex; gap: 8px; }
.voucher input { flex: 1; min-width: 0; height: 44px; border: 1px dashed #B9B6A8; border-radius: 10px; padding: 0 12px; background: var(--bg); }
.voucher .btn { height: 44px; }
.note { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.note .ico { margin-top: 1px; }

.steps { display: flex; align-items: center; gap: 10px; list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li + li::before { content: ""; width: 48px; height: 2px; background: var(--line); margin-right: 2px; }
.steps b { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; background: #fff; }
.steps .done { color: var(--ink); }
.steps .done b { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps .now { color: var(--ink); font-weight: 700; }
.steps .now b { border-color: var(--accent); color: var(--accent); }

/* ───────── Đơn của tôi ───────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 12px 16px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.tabs a span { font-size: 12px; margin-left: 4px; color: var(--muted); }
.order { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.order-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #FCFBF8; font-size: 14px; color: var(--muted); }
.order-head b { color: var(--ink); font-size: 15px; }
.status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 14px; font-size: 13px; font-weight: 700; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-wait { background: var(--gold-soft); color: #92400E; }
.st-ship { background: #E6EEF9; color: #1E4E8C; }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-cancel { background: #F1F1EF; color: #4B5563; }
.order-body { padding: 4px 20px; }
.order-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.order-item:last-child { border-bottom: 0; }
.order-item .art { width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0; }
.order-item .art svg { width: 66%; height: 66%; }
.order-item div { flex: 1; }
.order-item small { display: block; color: var(--muted); font-size: 13px; }
.order-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.order-foot .total { margin-right: auto; color: var(--muted); }
.order-foot .total b { color: var(--gold); font-size: 19px; margin-left: 6px; }
.order-foot .btn { height: 40px; padding: 0 16px; font-size: 14px; }
.order-msg { margin: 0 20px 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 14px; color: var(--text); display: flex; gap: 10px; }
.track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 18px 8px 8px; list-style: none; margin: 0; }
.track li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; color: var(--muted); }
.track li::before { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.track li:first-child::before { display: none; }
.track li i { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--line); }
.track li.done { color: var(--ink); }
.track li.done::before, .track li.now::before { background: var(--accent); }
.track li.done i { background: var(--accent); border-color: var(--accent); }
.track li.now { color: var(--accent); font-weight: 700; }
.track li.now i { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.banner-ok { display: flex; gap: 16px; align-items: center; padding: 20px 24px; border-radius: 18px; background: var(--ok-bg); border: 1px solid #CDE5CD; }
.banner-ok .ico { width: 36px; height: 36px; color: var(--ok); }
.banner-ok p { margin: 2px 0 0; color: var(--text); }

/* ───────── Trang sản phẩm: phần mở/đóng cũ (app.js) trong giao diện mới ───────── */
.p-accordion .acc-toggle { width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; align-items: center; transition: border-color .15s, background-color .15s; }
.p-accordion .acc-toggle::after { content: "+"; font-size: 20px; color: var(--muted); }
.p-accordion .acc-toggle[aria-expanded="true"]::after { content: "−"; }
.p-accordion .acc-toggle:hover { border-color: var(--accent-mid); background: var(--bg); }
.p-accordion .acc-panel { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0 0 8px; }
.faq-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-answer { margin-top: 6px; color: var(--text); }
a.chip { color: var(--ink); }
a.chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.qty input { font-size: 15px; }
.opt { text-decoration: none; }
.order-item .thumb { width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0; }
#order-tabs a { border-radius: 0; background: none; }

/* trang thông tin: giới thiệu, chính sách, liên hệ */
.page-body { line-height: 1.7; color: var(--text); max-width: 760px; }
.page-body h1 { margin: 0 0 16px; font-size: 30px; color: var(--ink); line-height: 1.25; }
.page-body h2 { margin: 26px 0 8px; font-size: 19px; color: var(--ink); }
.page-body p { margin: 0 0 12px; }
.page-body ul, .page-body ol { margin: 0 0 12px; padding-left: 22px; }
.page-body li { margin-bottom: 6px; }
.page-body a { color: var(--accent); text-decoration: underline; }

/* ═════════ Điện thoại (≤ 760px) ═════════
   Nhiều trang đặt lưới bằng style inline; quy tắc [style*="grid-template-columns"] gom chúng về một cột
   (trừ lưới auto-fill, vốn tự co). Trang nào cần khác thì thêm quy tắc riêng bên dưới. */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .wrap { padding: 0 16px; }
  main [style*="grid-template-columns"]:not([style*="auto-fill"]):not([style*="auto-fit"]),
  .mega .wrap { grid-template-columns: minmax(0, 1fr) !important; }
  main [style*="padding:32px"], main [style*="padding:24px"] { padding: 18px !important; }
  h1[style*="font-size"] { font-size: 26px !important; }

  /* header: logo + nút bên phải, ô tìm kiếm hàng dưới, menu cuộn ngang */
  .topbar .wrap { min-height: 32px; font-size: 12px; }
  .topbar span:nth-of-type(n+2), .topbar nav { display: none; }
  .hdr { position: static; }
  .hdr-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 4px; padding-top: 10px; padding-bottom: 10px; }
  .logo-mark, .logo img { width: 38px !important; height: 38px !important; }
  .logo-text b { font-size: 19px; }
  .logo-text small, .search-hot { display: none; }
  .search { grid-column: 1 / -1; order: 3; flex: none; }
  .search-box { height: 44px; }
  .hdr-act { padding: 6px 8px; }
  .hdr-act > span:not(.hdr-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hdr-nav > .wrap { height: 46px; overflow-x: auto; scrollbar-width: none; padding: 0; }
  .hdr-nav > .wrap::-webkit-scrollbar { display: none; }
  .cat-btn { min-width: 0; height: 46px; padding: 0 14px; margin-right: 4px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
  .nav-link { height: 46px; padding: 0 10px; white-space: nowrap; flex-shrink: 0; }
  .nav-ely { display: none; }
  .mega { max-height: 70vh; overflow-y: auto; }
  .mega-promo { display: none; }

  /* lưới, thẻ sản phẩm: 2 cột */
  .grid-prods { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  .prod-body { padding: 10px 12px 12px; }
  .prod-name { font-size: 14px; }
  .prod-row b { font-size: 16px; }
  .prod .btn { height: 40px; font-size: 14px; padding: 0 10px; }
  .sec-head h2 { font-size: 22px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div:nth-child(2n) { border-right: 0; }
  .facts div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }

  /* bố cục 2 cột → 1 cột; thanh bên thành menu cuộn ngang */
  .layout-side { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .side, .summary { position: static; }
  .side .acc-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .side .acc-nav a { white-space: nowrap; flex-shrink: 0; }
  .row2 { grid-template-columns: minmax(0, 1fr); }

  /* giỏ hàng */
  .line-item { grid-template-columns: 72px minmax(0, 1fr) 40px; gap: 6px 12px; }
  .line-item .thumb { width: 72px !important; height: 72px !important; grid-row: span 2; }
  .line-item .qty { grid-column: 2; justify-self: start; }
  .line-item .line-price { grid-column: 2; grid-row: 3; text-align: left; }
  .line-item .icon-btn { grid-column: 3; grid-row: 1; }
  .steps li + li::before { width: 16px; }
  .steps { font-size: 13px; flex-wrap: wrap; }

  /* đơn hàng */
  .order-head, .order-foot { padding: 12px 14px; }
  .order-body { padding: 4px 14px; }
  .track li { font-size: 11px; }

  /* footer */
  .ft { margin-top: 40px; }
  .ft-promise .wrap { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ft-cols { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 28px; padding-bottom: 28px; }
  .ft-bottom .wrap { padding-right: 16px; padding-bottom: 84px; }
  .bct, .bct-logo { margin-left: 0; }
  .ely-fab { right: 16px; bottom: 16px; height: 52px; padding: 0 16px; }

  /* trang chủ: khối đầu bỏ ảnh ghép; trang sản phẩm: 2 nút chính chiếm cả hàng */
  .hero-art { display: none !important; }
  .hero-text { padding: 28px 22px !important; }
  .hero-text h1 { font-size: 30px !important; }
  .buy-row { flex-wrap: wrap; }
  .buy-row .btn[style*="flex:1"] { flex: 1 1 calc(50% - 6px) !important; height: 50px !important; padding: 0 10px; }

  /* chat */
  .chat { height: calc(100vh - 170px) !important; min-height: 440px; }
  .bubble { max-width: 88%; }
  .chat .chat-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chat .chat-chips .chip { white-space: nowrap; flex-shrink: 0; }
  .chat .chat-head .btn { display: none; }
  .page-body { padding: 20px !important; }
}
