/* Màu thương hiệu và hiệu ứng dùng chung */
:root {
  color-scheme: light;
  --ink: #171930;
  --muted: #60637c;
  --surface: #ffffff;
  --canvas: #f5f5fa;
  --line: #e6e6f0;
  --brand: #5d42d7;
  --brand-hover: #4a30c3;
  --lime: #ddfd77;
  --round: 18px;
  --shadow: 0 10px 28px #26234b0b;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; display: block; }
i[data-icon] { flex: 0 0 auto; display: inline-grid; place-items: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #8b71f5; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.shell { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }
/* Thanh trên, thanh tìm và nút tài khoản */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-layout { min-height: 78px; display: grid; grid-template-columns: auto minmax(200px, 1fr) auto; gap: 36px; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 26px; letter-spacing: -.07em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 13px; background: linear-gradient(145deg, #8e72f5, #5a40d7); color: white; box-shadow: 0 5px 12px #5d42d735; }
.brand-accent { color: var(--brand); }
.search { display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 13px; min-width: 0; background: #f6f5fb; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); }
.search input { min-width: 0; width: 100%; background: transparent; border: 0; color: var(--ink); }
.search input:focus-visible { outline: 0; }
.search:focus-within { border-color: var(--brand); }
.search-button { min-height: 34px; background: #ebe7fd; border-radius: 9px; color: #4f38b0; font-size: .875rem; }
.search-button:hover { transform: none; background: #e0d8ff; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.login-button, .saved-button { border-color: var(--line); }
.saved-button { padding: 0; width: 43px; }
.saved-button[aria-pressed="true"] { color: var(--brand); background: #eee9ff; }
#account-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
/* Banner với ảnh có chiều sâu và nút chuyển động */
.main-content { padding-block: 24px 50px; }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 352px; border-radius: 27px; display: flex; align-items: center; background: #100d2a; color: white; box-shadow: 0 18px 40px #25244d21; }
.hero-art { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 60% 100%, #353080, transparent 65%), #100d2a; }
.hero-art::before { content: ""; position: absolute; inset: 0 0 0 36%; background: url("../assets/hero.webp") right 51% / cover no-repeat; }
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #100d2b 0%, #100d2b 31%, #100d2bdb 43%, #100d2b08 72%); }
.hero-content { padding: 34px 48px; width: min(100%, 640px); }
.hero-label { color: #dfcfff; font-size: .83rem; letter-spacing: .15em; font-weight: 750; margin: 0 0 13px; }
.hero h1 { font-size: clamp(2.5rem, 4.35vw, 4.2rem); line-height: 1.04; margin: 0; letter-spacing: -.065em; font-weight: 850; }
.hero h1 em { font-style: normal; color: var(--lime); }
.hero-description { color: #dfdbee; max-width: 395px; margin: 16px 0 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.hero-actions .button { min-height: 47px; padding-inline: 15px; }
/* Danh mục, bộ lọc, thẻ sản phẩm */
.categories { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 25px 24px; }
.category { min-height: 46px; color: #45465f; border: 1px solid var(--line); background: #fff; }
.category i { color: var(--brand); }
.category:hover { border-color: #bfadfa; }
.category[aria-pressed="true"] { color: white; background: var(--brand); border-color: var(--brand); box-shadow: 0 5px 13px #5d42d72a; }
.category[aria-pressed="true"] i { color: inherit; }
.catalog { scroll-margin-top: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { font-size: 1.9rem; line-height: 1.15; letter-spacing: -.04em; margin: 0; }
.section-heading p { font-size: .9rem; color: var(--muted); margin: 5px 0 0; }
.sort { display: flex; align-items: center; color: var(--muted); gap: 7px; background: white; border: 1px solid var(--line); border-radius: 11px; padding-left: 10px; }
.sort select { cursor: pointer; appearance: none; color: var(--ink); font-weight: 650; font-size: .9rem; min-width: 120px; max-width: 100%; height: 42px; border: 0; border-radius: inherit; padding: 0 27px 0 1px; background: transparent; }
.sort::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; margin-left: -24px; margin-right: 12px; }
.products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { position: relative; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: var(--round); background: white; box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease; }
.card:hover, .card:focus-within { box-shadow: 0 12px 26px #2924461a; }
.card:hover { transform: translateY(-4px); }
.card-media { border: 0; padding: 0; width: 100%; display: block; border-radius: 13px; overflow: hidden; aspect-ratio: 1.44; background: #efecfa; text-align: left; }
.card-media img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .4s ease; }
.card:hover img { transform: scale(1.045); }
.card-heart { position: absolute; top: 16px; right: 16px; border: 1px solid #ffffff9e; min-height: 38px; width: 38px; padding: 0; background: #ffffffed; box-shadow: 0 3px 8px #25234b11; }
.card-heart[aria-pressed="true"] { color: #be316b; }
.card-heart[aria-pressed="true"] svg { fill: #ffbad6; }
.condition { position: absolute; top: 17px; left: 16px; background: #ffffffea; color: #333449; border-radius: 7px; padding: 3px 8px; font-size: .8rem; font-weight: 750; pointer-events: none; }
.card-content { padding: 11px 6px 7px; }
.card h3 { margin: 0; line-height: 1.2; }
.card-title { border: 0; padding: 0; background: transparent; text-align: left; font-size: 1rem; font-weight: 760; }
.card-title:hover { color: var(--brand); }
.price { color: #5037c5; font-size: 1.19rem; font-weight: 800; margin: 7px 0 9px; }
.card-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; gap: 6px; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.seller-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating { font-weight: 700; flex: 0 0 auto; color: #3e3e56; }
.rating span { color: #9c6111; }
.empty { grid-column: 1 / -1; padding: 27px; border: 1px dashed var(--line); background: white; border-radius: var(--round); color: var(--muted); margin: 0; }
.footer { background: white; border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; min-height: 72px; color: var(--muted); padding-block: 12px; }
.footer-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.footer button, .text-button { background: none; border: 0; color: var(--brand-hover); padding: 4px 0; font-weight: 700; text-align: left; }
.footer button:hover, .text-button:hover { text-decoration: underline; }
.mobile-nav { display: none; }
/* Cửa sổ chi tiết, tài khoản, đăng tin và quản lý */
dialog { width: min(590px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 90px #0d102a55; }
dialog::backdrop { background: #15132994; backdrop-filter: blur(4px); }
body:has(dialog[open]) { overflow: hidden; }
.panel-top { position: sticky; top: 0; z-index: 2; background: white; display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 15px 22px; border-bottom: 1px solid var(--line); }
.panel-top h2 { margin: 0; line-height: 1.2; letter-spacing: -.025em; font-size: 1.42rem; }
#panel-body { padding: 17px 22px 23px; }
#panel-body p { margin: 0 0 10px; }
.panel-photo { display: block; width: 100%; aspect-ratio: 2.2; object-fit: cover; border-radius: 14px; }
#panel-body .price { margin: 12px 0 3px; font-size: 1.45rem; }
.detail-meta, .helper { color: var(--muted); }
.panel-form { display: grid; gap: 12px; }
.panel-form label { font-weight: 650; display: grid; gap: 5px; }
.panel-form input, .panel-form select, .panel-form textarea { min-height: 43px; width: 100%; border: 1px solid #cccce0; border-radius: 9px; padding: 8px 11px; color: var(--ink); background: #fafafe; font-weight: 450; }
.panel-form textarea { min-height: 78px; resize: vertical; }
.panel-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.panel-form legend { font-weight: 650; }
.stars { display: flex; gap: 6px; align-items: center; }
.stars label { position: relative; cursor: pointer; }
.stars input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.stars span { display: block; color: #716f89; font-size: 1.55rem; }
.stars label:has(input:checked) span, .stars label:has(~ label input:checked) span { color: #ab6d02; }
.stars input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.panel-section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.panel-section h3 { margin: 0 0 8px; }
.review-list { list-style: none; margin: 0 0 12px; padding: 0; }
.review-list li, .manage-row { border-bottom: 1px solid var(--line); padding: 9px 0; overflow-wrap: anywhere; }
.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.manage-row p { color: var(--muted); font-size: .9rem; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.toast { position: fixed; z-index: 5; right: 24px; bottom: 22px; max-width: min(360px, calc(100% - 48px)); border-radius: 12px; background: #21203b; color: white; padding: 11px 16px; box-shadow: 0 8px 30px #0003; }
dialog .toast { position: static; }
@media (max-width: 1000px) {
  .header-layout { gap: 16px; }
  .hero-content { padding-inline: 34px; }
  .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .header-layout { grid-template-columns: 1fr auto; gap: 9px; padding-block: 10px; }
  .search { grid-row: 2; grid-column: 1 / -1; }
  .header-actions .saved-button, .header-post { display: none; }
  .search-button { min-height: 34px; padding-inline: 10px; }
  .brand { font-size: 24px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .login-button { min-height: 39px; padding-inline: 10px; font-size: .875rem; }
  .main-content { padding-top: 13px; padding-bottom: 28px; }
  .hero { min-height: 305px; align-items: end; border-radius: 20px; }
  .hero-art::before { inset: 0; background-position: center 43%; }
  .hero-art::after { background: linear-gradient(0deg, #100d2bf5 7%, #100d2bf3 22%, #100d2be6 40%, #100d2b73 68%, #100d2b35 100%); }
  .hero-content { padding: 54px 18px 18px; }
  .hero-label { font-size: .72rem; letter-spacing: .11em; margin-bottom: 9px; }
  .hero h1 { font-size: clamp(1.9rem, 8.5vw, 3.5rem); }
  .hero-description { margin: 10px 0 14px; font-size: .94rem; max-width: 360px; }
  .hero-actions .button { min-height: 42px; padding-inline: 10px; font-size: .88rem; }
  .hero-actions .button svg { width: 16px; height: 16px; }
  .categories { flex-wrap: nowrap; overflow-x: auto; padding: 3px 2px 8px; margin-block: 13px 12px; scrollbar-width: thin; }
  .category { min-height: 42px; font-size: .875rem; padding-inline: 10px; }
  .category svg { width: 17px; height: 17px; }
  .section-heading { margin-bottom: 12px; }
  .section-heading h2 { font-size: 1.45rem; }
  .sort select { min-width: 100px; width: 120px; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .card { padding: 5px; border-radius: 14px; }
  .card-media { aspect-ratio: 1.1; border-radius: 10px; }
  .card-heart { top: 9px; right: 9px; width: 38px; }
  .condition { top: 10px; left: 9px; padding-inline: 5px; font-size: .76rem; }
  .card-content { padding: 9px 4px 5px; }
  .card-title { font-size: .94rem; }
  .card-foot { font-size: .78rem; padding-top: 7px; }
  .price { font-size: 1.03rem; }
  .footer { padding-bottom: 66px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 4; inset: auto 0 0; background: #fff; border-top: 1px solid var(--line); padding: 5px 4px max(5px, env(safe-area-inset-bottom)); }
  .mobile-nav button { display: grid; place-items: center; gap: 3px; min-height: 48px; border: 0; padding: 3px; background: transparent; font-size: .81rem; font-weight: 700; }
  .mobile-nav .mobile-post, .mobile-nav button[aria-pressed="true"] { color: var(--brand-hover); background: #f0ecff; border-radius: 10px; }
  .toast { bottom: 68px; }
}
@media (max-width: 350px) {
  .shell { width: calc(100% - 22px); }
  .card-foot { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* Chuyển động theo con trỏ trên thiết bị dùng chuột. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .hero-art::before {
    scale: 1.04;
    translate: var(--art-x, 0px) var(--art-y, 0px);
    transition: translate .36s cubic-bezier(.2, .8, .2, 1);
  }
}
