/* ==========================================================================
   1. NỀN TẢNG – màu sắc, chữ, nút bấm, ô nhập
   Muốn đổi màu chủ đạo của cả website: chỉ cần sửa các biến trong :root.
   ========================================================================== */

:root {
  --c-primary: #1d4ed8;
  --c-primary-dark: #1a3fb0;
  --c-primary-soft: #eaf1ff;
  --c-accent: #ea580c;
  --c-accent-soft: #fff1e7;
  --c-text: #0f172a;
  --c-muted: #5b6474;
  --c-border: #e3e8ef;
  --c-bg: #f6f8fb;
  --c-surface: #ffffff;
  --c-footer: #0f172a;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .1);

  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --container: 1240px;
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { line-height: 1.3; letter-spacing: -.01em; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 10px 16px; background: var(--c-primary); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

.icon { flex: none; }

/* ---------- Nút bấm ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: 10px;
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-outline { background: var(--c-surface); border-color: #c9d3e2; color: var(--c-text); }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-outline.is-done { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-link { padding: 0; border: 0; background: none; color: var(--c-primary); font-weight: 600; font-size: 14px; }
.btn-link:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 10px; background: none; color: var(--c-text);
}
.icon-btn:hover { background: var(--c-bg); }

/* ---------- Ô nhập ---------- */

input[type="text"], input[type="search"], input[type="tel"], input[type="email"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1.5px solid #c9d3e2; border-radius: var(--radius-sm);
  background: var(--c-surface);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }

/* ---------- Nhãn nhỏ ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  font-size: 12.5px; font-weight: 500; line-height: 1.6; white-space: nowrap;
}
.chip-soft { background: var(--c-bg); color: var(--c-muted); }
.chip-accent { background: var(--c-accent); color: #fff; font-weight: 600; }
a.chip:hover { text-decoration: none; background: #dbe7ff; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; line-height: 1.6;
}
.badge-sale { background: var(--c-accent-soft); color: var(--c-accent); }

.price { color: var(--c-accent); font-weight: 700; }
.price-old { color: var(--c-muted); font-size: .85em; }

.muted { color: var(--c-muted); }

/* ---------- Thông báo nổi ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px); padding: 12px 18px;
  background: var(--c-text); color: #fff; border-radius: 12px; box-shadow: var(--shadow-md);
  font-size: 14.5px;
}
.toast a { color: #93b4f5; font-weight: 600; white-space: nowrap; }

/* ==========================================================================
   2. KHUNG TRANG – thanh thông báo, đầu trang, menu, chân trang
   ========================================================================== */

.notice-bar {
  padding: 8px var(--gutter); background: var(--c-accent-soft); color: #9a3412;
  font-size: 13.5px; text-align: center;
}
.notice-bar .icon { display: inline-block; margin-right: 4px; vertical-align: -3px; }

/* ---------- Đầu trang ---------- */

.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); }

.header-main {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "toggle logo cart" "search search search";
  align-items: center; gap: 10px 8px; padding-block: 10px 12px;
}
.nav-toggle { grid-area: toggle; margin-left: -10px; }

.logo { grid-area: logo; display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--c-text); font-weight: 700; font-size: 17px; }
.logo:hover { text-decoration: none; }
.logo img { flex: none; }
.logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search { grid-area: search; position: relative; display: flex; }
.search input { min-height: 46px; padding-left: 16px; border-radius: 12px 0 0 12px; border-right: 0; }
.search input:focus { box-shadow: none; }
.search > button {
  flex: none; display: grid; place-items: center; width: 54px;
  border: 0; border-radius: 0 12px 12px 0; background: var(--c-primary); color: #fff;
}
.search > button:hover { background: var(--c-primary-dark); }

.search-suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  padding: 6px; background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 12px; box-shadow: var(--shadow-md);
}
.search-suggest a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--c-text); }
.search-suggest a:hover, .search-suggest a:focus-visible { background: var(--c-bg); text-decoration: none; }
.search-suggest strong { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.search-suggest span { display: block; color: var(--c-muted); font-size: 13px; }
.search-suggest .suggest-all { color: var(--c-primary); font-weight: 600; font-size: 14px; border-top: 1px solid var(--c-border); border-radius: 0 0 8px 8px; margin-top: 4px; }
.search-suggest .suggest-empty { padding: 10px 12px; color: var(--c-muted); font-size: 14px; }

.cart-link {
  grid-area: cart; position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--c-text); font-weight: 600; font-size: 15px;
}
.cart-link:hover { background: var(--c-bg); text-decoration: none; }
.cart-text { display: none; }
.cart-count {
  position: absolute; top: 2px; left: 26px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--c-accent); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}

/* ---------- Menu máy tính ---------- */

.main-nav { display: none; border-top: 1px solid var(--c-border); }
.main-nav > ul { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; }
.main-nav > ul > li > a,
.main-nav > ul > li > button {
  display: inline-flex; align-items: center; gap: 4px; padding: 13px 8px;
  border: 0; background: none; color: var(--c-text); font-size: 14px; font-weight: 500; white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li > button:hover,
.main-nav .is-active { color: var(--c-primary); text-decoration: none; }
.main-nav > ul > li > .is-active { box-shadow: inset 0 -2px 0 var(--c-primary); }

.mega {
  display: none; position: absolute; top: 100%; left: var(--gutter); right: var(--gutter); z-index: 30;
  grid-template-columns: auto 1fr; gap: 28px; padding: 24px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-md);
}
.has-mega.is-open .mega { display: grid; }
@media (hover: hover) { .has-mega:hover .mega { display: grid; } }

.mega-heading { margin-bottom: 8px; color: var(--c-muted); font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.mega-grades { display: grid; grid-template-columns: repeat(3, minmax(140px, auto)); gap: 20px; padding-right: 28px; border-right: 1px solid var(--c-border); }
.mega-level a {
  display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; margin-inline: -10px;
  border-radius: 8px; color: var(--c-text); font-size: 14.5px; font-weight: 500;
}
.mega-level a .icon { opacity: 0; }
.mega-level a:hover, .mega-level a.is-active { background: var(--c-primary-soft); color: var(--c-primary-dark); text-decoration: none; }
.mega-level a.is-active .icon { opacity: 1; }

.mega-panel { display: none; }
.mega-panel.is-active { display: block; }
.mega-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 16px; }
.mega-subjects a { padding: 7px 10px; margin-inline: -10px; border-radius: 8px; color: var(--c-text); font-size: 14.5px; }
.mega-subjects a:hover { background: var(--c-bg); color: var(--c-primary); text-decoration: none; }
.mega-all { display: inline-flex; align-items: center; gap: 4px; margin-top: 16px; font-size: 14px; font-weight: 600; }

/* ---------- Menu điện thoại ---------- */

.drawer-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(15, 23, 42, .45); }
.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(88vw, 360px);
  display: flex; flex-direction: column; background: var(--c-surface); box-shadow: var(--shadow-md);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--c-border); font-size: 17px; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px 12px 24px; }
.drawer-nav a, .drawer-nav summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 10px; border-radius: 8px; color: var(--c-text); font-weight: 500; cursor: pointer;
}
.drawer-nav a:hover, .drawer-nav summary:hover { background: var(--c-bg); text-decoration: none; }
.drawer-nav summary { list-style: none; }
.drawer-nav summary::-webkit-details-marker { display: none; }
.drawer-nav details[open] > summary .icon { transform: rotate(180deg); }
.drawer-sub { margin-left: 10px; padding-left: 10px; border-left: 2px solid var(--c-border); }
.drawer-sub a, .drawer-sub summary { padding-block: 9px; font-size: 15px; font-weight: 400; }
.drawer-sub > details > summary { font-weight: 500; }

/* ---------- Chân trang ---------- */

.site-footer { margin-top: 64px; background: var(--c-footer); color: #cbd5e1; font-size: 14.5px; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; gap: 32px; padding-block: 48px 32px; }
.site-footer h2 { margin-bottom: 14px; color: #fff; font-size: 15px; font-weight: 600; }
.site-footer li { margin-bottom: 8px; }
.footer-about .logo { color: #fff; margin-bottom: 14px; }
.footer-about p { max-width: 36ch; }
.footer-grades { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0 24px; }
.footer-contact li { display: flex; gap: 10px; align-items: flex-start; }
.footer-contact .icon { margin-top: 3px; color: #94a3b8; }
.footer-bottom { padding-block: 18px; border-top: 1px solid #1e293b; color: #94a3b8; font-size: 13.5px; }

/* ---------- Màn hình rộng ---------- */

@media (min-width: 768px) {
  .header-main { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "toggle logo search cart"; gap: 20px; padding-block: 14px; }
  .search { max-width: 620px; width: 100%; justify-self: center; }
  .cart-text { display: inline; }
  .logo { font-size: 19px; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr; }
}

@media (min-width: 1200px) {
  .nav-toggle { display: none; }
  .header-main { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "logo search cart"; }
  .main-nav { display: block; }
  .site-header { position: sticky; top: 0; z-index: 35; }
}

/* ==========================================================================
   3. THÀNH PHẦN – thẻ sản phẩm, ảnh bìa, lưới, tiêu đề khu vực
   ========================================================================== */

/* ---------- Khu vực ---------- */

.section { padding-block: 40px; }
.section-alt { background: var(--c-bg); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(21px, 2.6vw, 26px); }
.section-head p { margin-top: 4px; color: var(--c-muted); font-size: 15px; }
.more-link { display: inline-flex; align-items: center; gap: 2px; flex: none; font-size: 14.5px; font-weight: 600; }

/* ---------- Lưới và thẻ sản phẩm ---------- */

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { border-color: #cfd8e6; box-shadow: var(--shadow-md); }

.card-cover, .product-cover {
  position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden;
  background: var(--c-bg); container-type: inline-size;
}

.cover-img { width: 100%; height: 100%; object-fit: cover; }

/* Bìa tự vẽ cho tài liệu chưa có ảnh bìa */
.cover-auto {
  display: flex; flex-direction: column; justify-content: space-between; width: 100%; height: 100%;
  padding: 9cqw; color: #fff;
  background: linear-gradient(160deg, var(--cover, #1d4ed8), color-mix(in srgb, var(--cover, #1d4ed8) 62%, #0f172a));
}
.cover-auto-grade { align-self: flex-start; padding: 1.2cqw 4.5cqw; border-radius: 999px; background: #fff; color: var(--cover, #1d4ed8); font-size: 6cqw; font-weight: 700; }
.cover-auto-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; font-size: 9cqw; font-weight: 700; line-height: 1.28; }
.cover-auto-foot { font-size: 5.4cqw; font-weight: 500; opacity: .92; }

.card-body { display: flex; flex-direction: column; gap: 9px; flex: 1; padding: 12px; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.4; letter-spacing: 0; }
.card-title a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--c-text); }
.card-title a:hover { color: var(--c-primary); text-decoration: none; }
.card-price { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: auto; font-size: 17px; }
.card-actions { display: grid; gap: 8px; }

/* ---------- Đường dẫn và đầu trang con ---------- */

.page { padding-top: 20px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--c-muted); font-size: 13.5px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: #b6c0cf; }
.breadcrumbs a { color: var(--c-muted); }
.breadcrumbs [aria-current] { color: var(--c-text); }

.page-head { margin-block: 14px 22px; }
.page-head h1 { font-size: clamp(24px, 3.4vw, 32px); }
.page-head p { margin-top: 6px; max-width: 70ch; color: var(--c-muted); }

/* ---------- Trạng thái trống ---------- */

.empty {
  display: grid; justify-items: center; gap: 10px; padding: 44px 20px;
  border: 1.5px dashed #cfd8e6; border-radius: var(--radius); text-align: center; color: var(--c-muted);
}
.empty strong { color: var(--c-text); font-size: 18px; }
.empty p { max-width: 52ch; }
.empty-page { margin-block: 40px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.loading { padding: 32px 0; color: var(--c-muted); }

/* ---------- Các bước mua hàng ---------- */

.steps { display: grid; gap: 14px; counter-reset: none; }
.steps li { display: flex; gap: 14px; padding: 18px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.steps strong { display: block; font-size: 16px; }
.steps p { margin-top: 2px; color: var(--c-muted); font-size: 14.5px; }
.step-num { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c-primary-soft); color: var(--c-primary); font-weight: 700; }
.steps-compact { margin-bottom: 26px; }
.steps-compact li { padding: 14px; }

/* ---------- Hàng nút chọn nhanh ---------- */

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.pill { padding: 7px 14px; border: 1px solid var(--c-border); border-radius: 999px; color: var(--c-text); font-size: 14px; font-weight: 500; }
.pill:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }

@media (min-width: 480px) {
  .card-actions { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 640px) {
  .product-grid { gap: 20px; }
  .card-body { padding: 14px; }
}
@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .section { padding-block: 52px; }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   4. TỪNG TRANG – trang chủ, danh sách, chi tiết, giỏ hàng, đặt mua
   ========================================================================== */

/* ---------- Trang chủ: banner ---------- */

.hero { background: linear-gradient(180deg, var(--c-primary-soft) 0%, #fff 100%); }
.hero-inner { display: grid; gap: 28px; align-items: center; padding-block: 40px 28px; }
.eyebrow { display: inline-block; margin-bottom: 14px; padding: 4px 12px; border-radius: 999px; background: #fff; color: var(--c-primary); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-sm); }
.hero h1 { font-size: clamp(28px, 4.6vw, 46px); line-height: 1.18; letter-spacing: -.02em; }
.hero-desc { margin-top: 16px; max-width: 56ch; color: var(--c-muted); font-size: clamp(16px, 1.6vw, 18px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 28px; color: var(--c-muted); font-size: 14.5px; }
.hero-facts strong { margin-right: 4px; color: var(--c-text); font-size: 20px; }
.hero-art { display: none; }

/* ---------- Trang chủ: khối lớp ---------- */

.grade-groups { display: grid; gap: 22px; }
.grade-group h3 { margin-bottom: 10px; color: var(--c-muted); font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.grade-tile {
  display: grid; gap: 2px; padding: 14px 12px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px;
  color: var(--c-text); text-align: center;
  transition: border-color .15s, background-color .15s;
}
.grade-tile strong { font-size: 17px; }
.grade-tile span { color: var(--c-muted); font-size: 12.5px; }
.grade-tile:hover { border-color: var(--c-primary); background: var(--c-primary-soft); text-decoration: none; }
.grade-tile:hover strong { color: var(--c-primary-dark); }

/* ---------- Trang chủ: môn học ---------- */

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.subject-tile {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; color: var(--c-text);
}
.subject-tile strong { flex: 1; font-size: 15px; font-weight: 600; }
.subject-tile span:last-child:not(.subject-dot) { color: var(--c-muted); font-size: 12.5px; white-space: nowrap; }
.subject-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--subject); }
.subject-tile:hover { border-color: var(--subject); text-decoration: none; }

/* ---------- Trang danh sách ---------- */

.filters {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  padding: 16px; margin-bottom: 18px; background: var(--c-bg); border-radius: var(--radius);
}
.filter span { display: block; margin-bottom: 4px; color: var(--c-muted); font-size: 13px; font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; min-height: 28px; }
.result-count { font-weight: 600; }
.active-query { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 12px; border-radius: 999px; background: var(--c-primary-soft); color: var(--c-primary-dark); font-size: 14px; }
.active-query button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; }
.active-query button:hover { background: #cfe0ff; }
.load-more { display: grid; justify-items: center; margin-top: 28px; }

/* ---------- Trang chi tiết ---------- */

.product { display: grid; gap: 24px; margin-top: 18px; }
.product-media { width: 100%; max-width: 340px; margin-inline: auto; }
.product-cover { border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.product-info h1 { margin-top: 12px; font-size: clamp(23px, 3.2vw, 32px); }
.product-lead { margin-top: 10px; color: var(--c-muted); font-size: 16.5px; }
.product-price { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 18px; font-size: 30px; line-height: 1.2; }
.product-price .price-old { font-size: 17px; }
.product-actions { display: grid; gap: 10px; margin-top: 20px; }
.product-note { display: flex; gap: 8px; margin-top: 16px; color: var(--c-muted); font-size: 14px; }
.product-note .icon { margin-top: 2px; }

.specs { margin-top: 22px; border-top: 1px solid var(--c-border); }
.specs div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--c-border); font-size: 15px; }
.specs dt { color: var(--c-muted); }
.specs dd { font-weight: 500; }

.product-section { margin-top: 44px; }
.product-section h2 { margin-bottom: 16px; font-size: 22px; }
.prose { max-width: 75ch; }
.prose p + p { margin-top: 12px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.preview-grid a { display: block; overflow: hidden; border: 1px solid var(--c-border); border-radius: 10px; }
.preview-grid a:hover { border-color: var(--c-primary); }

.lightbox { max-width: min(94vw, 760px); max-height: 94vh; padding: 0; border: 0; border-radius: 12px; overflow: auto; }
.lightbox::backdrop { background: rgba(15, 23, 42, .75); }
.lightbox img { width: 100%; }
.lightbox .icon-btn { position: sticky; top: 8px; float: right; margin: 8px; background: #fff; box-shadow: var(--shadow-md); }

/* ---------- Giỏ hàng và đặt mua ---------- */

.cart-layout { display: grid; gap: 24px; align-items: start; }
.panel { padding: 20px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.panel h2 { margin-bottom: 14px; font-size: 18px; }
.panel h2:not(:first-child) { margin-top: 26px; }

.cart-list li { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--c-border); }
.cart-list li:first-child { padding-top: 0; }
.cart-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.cart-thumb { display: block; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 6px; background: var(--c-bg); container-type: inline-size; }
.cart-thumb .cover-auto-title, .cart-thumb .cover-auto-foot { display: none; }
.cart-thumb .cover-auto-grade { align-self: center; margin-block: auto; padding: 2cqw 6cqw; font-size: 15cqw; }
.cart-item-title { display: block; color: var(--c-text); font-weight: 600; line-height: 1.4; }
.cart-item-meta { color: var(--c-muted); font-size: 13.5px; }
.cart-item-side { display: grid; justify-items: end; gap: 2px; }
.cart-item-side .price { font-size: 16px; white-space: nowrap; }
.cart-remove { display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; border: 0; background: none; color: var(--c-muted); font-size: 13.5px; }
.cart-remove:hover { color: #b91c1c; }

.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; color: var(--c-muted); }
.summary-total { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--c-border); color: var(--c-text); font-weight: 600; }
.summary-total .price { font-size: 22px; }
.summary-actions { display: grid; gap: 10px; margin-top: 18px; }
.summary-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14.5px; }
.summary-list li span:last-child { flex: none; font-weight: 600; }

.form-grid { display: grid; gap: 14px; }
.form-grid label > span { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.form-hint { margin-bottom: 14px; color: var(--c-muted); font-size: 14px; }

.channel-list { display: grid; gap: 10px; }
.order-status { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--c-primary-soft); color: var(--c-primary-dark); font-size: 14.5px; }
.callout { padding: 12px 14px; border-radius: 10px; background: var(--c-accent-soft); color: #9a3412; font-size: 14.5px; }
.order-preview { margin-top: 16px; }
.order-preview summary { cursor: pointer; color: var(--c-primary); font-weight: 600; font-size: 14.5px; }
.order-preview pre { margin: 10px 0; padding: 14px; overflow-x: auto; background: var(--c-bg); border-radius: 10px; font: 13.5px/1.6 var(--font); white-space: pre-wrap; }

/* ---------- Màn hình rộng ---------- */

@media (min-width: 480px) {
  .product-actions { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .hero-inner { grid-template-columns: 1.15fr .85fr; gap: 40px; padding-block: 56px 44px; }
  .hero-art { display: block; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product { grid-template-columns: 300px minmax(0, 1fr); gap: 36px; }
  .product-media { margin: 0; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
  .channel-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .grade-groups { grid-template-columns: 5fr 4fr 3fr; gap: 28px; }
  .grade-group:nth-child(1) .grade-grid { grid-template-columns: repeat(5, 1fr); }
  .grade-group:nth-child(2) .grade-grid { grid-template-columns: repeat(4, 1fr); }
  .grade-group:nth-child(3) .grade-grid { grid-template-columns: repeat(3, 1fr); }
  .grade-tile { padding-inline: 4px; }
  .filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .product { grid-template-columns: 380px minmax(0, 1fr); gap: 48px; }
  .cart-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}
