/*
Theme Name: Đèn Đóm
Theme URI: https://www.facebook.com/dendomchuyendentrangtridep
Author: Đèn Đóm
Description: Theme bán đèn trang trí của Đèn Đóm, chuyển từ website HTML và giữ nguyên giao diện. Tương thích WooCommerce: trang chủ, cửa hàng, danh mục và chi tiết sản phẩm lấy dữ liệu từ WooCommerce. Menu thả xuống quản lý trong Giao diện › Menu. Có công cụ nhập 596 mẫu đèn (Công cụ › Nhập dữ liệu Đèn Đóm).
Version: 1.0.0
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: den-dom
Tags: e-commerce, custom-menu, custom-logo, featured-images, theme-options, translation-ready
WC requires at least: 8.0
WC tested up to: 9.8
*/
:root {
  /* Bảng màu thương hiệu — tỉ lệ 60% nền trung tính, 30% mảng tối, 10% vàng nhấn */
  --background: #FAF9F6;            /* Ivory white: nền trang */
  --card: #FFFFFF;                  /* Pure white: thẻ sản phẩm, hộp thoại */
  --accent: #C4A26A;                /* Champagne gold: điểm nhấn */
  --button: #98743D;                /* Bronze gold: nút bấm */
  --primary: #242424;               /* Charcoal: tiêu đề, điều hướng, mảng tối */
  --text: #242424;
  --muted: #666666;                 /* Neutral gray: chữ phụ */
  --line: #E5E2DC;                  /* Light beige: đường viền */
  --sale: #B42318;                  /* Deep red: giá bán */
  /* Sắc độ phụ suy ra từ bảng màu trên */
  --surface: #F3F1EC;               /* khối nền phụ, ô ảnh trống */
  --button-hover: #7F6032;
  --accent-soft: #F6F0E4;           /* nền vàng rất nhạt */
  --accent-ink: #98743D;            /* vàng đậm khi làm chữ trên nền sáng */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(36, 36, 36, .05), 0 10px 26px rgba(36, 36, 36, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 130px; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 16px/1.6 "Be Vietnam Pro", system-ui, sans-serif;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: Lora, Georgia, serif; line-height: 1.2; margin: 0 0 .5em; color: var(--text); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
button { font: inherit; cursor: pointer; }
.wrap { width: min(1220px, 100% - 32px); margin-inline: auto; }

.promo {
  background: var(--accent); color: var(--text); text-align: center;
  font-size: .88rem; font-weight: 600; padding: 7px 16px;
}
.promo .short { display: none; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 249, 246, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.logo img { display: block; height: 56px; width: auto; }
.footer .logo img { height: 70px; }
.nav { display: flex; align-items: stretch; gap: 24px; margin-left: auto; align-self: stretch; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav-link:hover, .nav-item.has-menu:hover > .nav-link, .nav-item.has-menu:focus-within > .nav-link { color: var(--accent-ink); }
.nav-item { display: flex; }
.chev { transition: transform .2s; flex-shrink: 0; }
.nav-item.has-menu:hover .chev, .nav-item.has-menu:focus-within .chev { transform: rotate(180deg); }

/* Menu thả xuống "Sản phẩm" (máy tính) */
.mega {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--card); border-top: 1px solid var(--line); border-bottom: 3px solid var(--accent);
  box-shadow: 0 18px 40px rgba(36, 36, 36, .12);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility 0s .18s;
}
.nav-item.has-menu:hover .mega, .nav-item.has-menu:focus-within .mega {
  opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s, visibility 0s;
}
.nav-item.has-menu.closed .mega { opacity: 0; visibility: hidden; }
.nav-item.has-menu.closed .chev { transform: none; }
.mega-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 24px; padding: 22px 0 18px; }
.mega-cat {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font: 700 1rem/1.3 Lora, Georgia, serif; color: var(--text); text-decoration: none;
  padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.mega-cat span, .mega ul span { font: 500 .78rem "Be Vietnam Pro", sans-serif; color: var(--muted); }
.mega-cat:hover { color: var(--accent-ink); }
.mega ul { list-style: none; margin: 0; padding: 0; }
.mega li a {
  display: flex; justify-content: space-between; gap: 8px; padding: 6px 0;
  color: var(--text); text-decoration: none; font-size: .9rem;
}
.mega li a:hover { color: var(--accent-ink); }
.mega-all {
  grid-column: 1 / -1; justify-self: end; margin-top: 6px;
  color: var(--accent-ink); font-weight: 700; font-size: .9rem; text-decoration: none;
}
.mega-all:hover { text-decoration: underline; }

/* Nút menu và menu trên điện thoại */
.menu-btn { display: none; border: 0; background: none; color: var(--text); padding: 8px; margin-left: -8px; border-radius: 10px; }
.menu-btn path { transition: transform .2s, opacity .2s; transform-origin: center; }
.menu-btn[aria-expanded="true"] .l1 { transform: translateY(5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .l2 { opacity: 0; }
.menu-btn[aria-expanded="true"] .l3 { transform: translateY(-5px) rotate(-45deg); }
.mobile-menu {
  position: absolute; left: 0; right: 0; top: 100%;
  border-top: 1px solid var(--line); background: var(--card);
  max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 18px 40px rgba(36, 36, 36, .15);
}
.mobile-menu .wrap { padding: 6px 0 18px; }
.mm-toggle, .mm-link, .mm-cat-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  min-height: 52px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); background: none;
  color: var(--text); font: 600 1.02rem "Be Vietnam Pro", sans-serif; text-decoration: none; text-align: left;
}
.mm-toggle[aria-expanded="true"] .chev, .mm-cat-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.mm-cats { padding-left: 12px; border-left: 3px solid var(--accent); margin: 4px 0 8px; }
.mm-cat-btn { min-height: 48px; font-size: .98rem; }
.mm-cat-btn span { margin-left: auto; font-weight: 500; font-size: .8rem; color: var(--muted); }
.mm-subs { display: grid; padding: 4px 0 10px 12px; }
.mm-subs a {
  display: flex; justify-content: space-between; align-items: center; min-height: 44px;
  color: var(--text); text-decoration: none; font-size: .95rem; border-bottom: 1px dashed var(--line);
}
.mm-subs a span { color: var(--muted); font-size: .8rem; }
.mm-subs a:first-child { color: var(--accent-ink); font-weight: 600; }
.mm-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.mm-contact .btn { padding: 12px 10px; }

/* Nút liên hệ nhanh (điện thoại) */
.cart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; border: 0;
  background: var(--primary); color: #fff; font-weight: 600;
}
.cart-btn:hover { background: var(--text); }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--accent); color: var(--text);
  font-size: .8rem; display: inline-grid; place-items: center;
}
.cart-count.bump { animation: bump .4s; }
@keyframes bump { 50% { transform: scale(1.35); } }

/* Hero */
.hero { position: relative; color: #fff; overflow: hidden; background: var(--primary); }
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 82% 30%, rgba(196, 162, 106, .26), transparent 42%),
    linear-gradient(120deg, #1A1A1A 0%, var(--primary) 70%);
}
.hero-inner { position: relative; padding: 88px 0 120px; }
.hero-text { max-width: 640px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .9rem; letter-spacing: .03em; margin: 0 0 14px; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); margin-bottom: 18px; color: #fff; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { color: rgba(255, 255, 255, .82); font-size: 1.12rem; max-width: 34em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 26px; }
.hero-perks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-perks li {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22);
  padding: 5px 12px; border-radius: 999px; font-size: .88rem;
}
.hero-perks li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; font-weight: 700;
  text-decoration: none; border: 1px solid transparent; transition: .15s;
}
.btn-primary { background: var(--button); color: #fff; }
.btn-primary:hover { background: var(--button-hover); }
.hero .btn-primary { background: var(--accent); color: var(--text); }
.hero .btn-primary:hover { background: #D2B582; }
.btn-ghost { border-color: currentColor; background: transparent; color: inherit; }
.btn-ghost:hover { background: var(--surface); }
.hero .btn-ghost { color: #fff; }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Ô danh mục */
.cats { margin-top: -60px; position: relative; z-index: 2; }
.cat-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.cat-card {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 46px 18px 18px; min-height: 160px;
  background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--accent);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: .2s;
}
.cat-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.cat-card b { font: 700 1.1rem/1.3 Lora, Georgia, serif; }
.cat-card small { color: var(--muted); font-size: .88rem; }
.cat-card .cat-subs { margin-top: 6px; font-size: .78rem; line-height: 1.4; color: var(--accent-ink); }
.cat-card .cat-go { margin-top: auto; padding-top: 10px; color: var(--accent-ink); font-weight: 700; font-size: .88rem; }
.cat-card .cat-chip {
  position: absolute; top: 14px; left: 18px;
  background: var(--surface); color: var(--primary); font-weight: 700; font-size: .78rem;
  padding: 3px 10px; border-radius: 999px;
}

/* Thanh danh mục + tìm kiếm */
.shop { padding: 40px 0 24px; }
.catnav-wrap {
  position: sticky; top: 64px; z-index: 20;
  background: rgba(250, 249, 246, .95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.catnav-inner { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.catnav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.catnav::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px; text-decoration: none;
  border: 1.5px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.chip span { color: var(--muted); font-weight: 500; font-size: .82rem; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active span { color: var(--accent); }
.controls { display: flex; gap: 8px; }
.controls input, .controls select, .field input, .field textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 14px;
}
.controls input { width: 280px; }
.controls input:focus, .controls select:focus, .field input:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; background: var(--card);
}

/* Các mục sản phẩm */
.cat-section { padding: 44px 0 8px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 20px; margin-bottom: 6px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 12px; }
.section-head h2::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--accent); }
.section-head .count { font: 600 .9rem "Be Vietnam Pro"; color: var(--primary); background: var(--surface); padding: 3px 10px; border-radius: 999px; }
.cat-info { color: var(--muted); font-size: .95rem; max-width: 64em; margin: 8px 0 20px; }
.sub-links { display: flex; flex-wrap: wrap; gap: 8px; }
.sub-links a {
  text-decoration: none; font-size: .86rem; font-weight: 600; color: var(--text);
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px;
}
.sub-links a:hover { border-color: var(--accent); color: var(--accent-ink); }
/* Danh mục con */
.sub-block { margin-top: 26px; }
.sub-block + .sub-block { margin-top: 40px; padding-top: 28px; border-top: 1px dashed var(--line); }
.sub-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.sub-head h3 { margin: 0; font-size: 1.3rem; display: flex; align-items: baseline; gap: 10px; }
.sub-head h3 span { font: 600 .82rem "Be Vietnam Pro", sans-serif; color: var(--muted); }
.sub-info { color: var(--muted); font-size: .9rem; max-width: 64em; margin: 4px 0 16px; }
.link-btn { border: 0; background: none; color: var(--accent-ink); font-weight: 700; padding: 4px 0; }
.link-btn:hover { text-decoration: underline; }
.more-wrap { text-align: center; margin: 22px 0 0; }
.more-btn {
  border: 1.5px solid var(--primary); color: var(--primary); background: var(--card);
  border-radius: 999px; padding: 11px 22px; font-weight: 700;
}
.more-btn:hover { background: var(--primary); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--accent); }
.card .photo { position: relative; display: block; border: 0; padding: 0; background: var(--surface); cursor: pointer; aspect-ratio: 4 / 3; overflow: hidden; }
.card .photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s, transform .5s; }
.card .photo .alt { opacity: 0; }
.card:hover .photo .alt { opacity: 1; }
.card:hover .photo img { transform: scale(1.04); }
/* Ô thay ảnh khi mẫu chưa có ảnh */
.no-photo {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--surface); color: var(--primary); text-align: center; padding: 12px;
}
.no-photo b { font: 700 1.25rem/1.2 Lora, Georgia, serif; letter-spacing: .02em; }
.no-photo small { color: var(--muted); font-size: .76rem; }
.no-photo::before { content: ""; width: 28px; height: 2px; background: var(--accent); margin-bottom: 8px; }
.badge {
  position: absolute; z-index: 1; top: 10px; left: 10px;
  background: var(--card); color: var(--primary); font-size: .72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
}
.badge.sale { left: auto; right: 10px; background: var(--sale); color: #fff; border-color: var(--sale); }
.pics { position: absolute; z-index: 1; right: 10px; bottom: 10px; background: rgba(36, 36, 36, .75); color: #fff; font-size: .72rem; padding: 3px 8px; border-radius: 999px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.code { font-size: .76rem; color: var(--muted); letter-spacing: .04em; font-weight: 500; }
.card h3 { font: 600 .98rem/1.35 "Be Vietnam Pro", sans-serif; margin: 0; cursor: pointer; }
.card h3:hover { color: var(--primary); text-decoration: underline; }
.size { font-size: .82rem; color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.price { font-weight: 800; color: var(--sale); font-size: 1.08rem; }
.price.ask { color: var(--muted); font-weight: 600; font-size: .95rem; }
.price-wrap { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.price-old { color: var(--muted); font-size: .8rem; }
.price-wrap.big { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 4px 0 2px; }
.price-wrap.big .price { font-size: 1.7rem; }
.price-wrap.big .price-old { font-size: 1rem; }
.price-wrap .save { background: var(--sale); color: #fff; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.line-right .price-wrap { align-items: flex-end; }
/* thẻ hẹp (máy tính bảng, điện thoại): nút Thêm vào giỏ xuống dòng dưới giá, rộng hết thẻ */
.card { container-type: inline-size; }
@container (max-width: 270px) {
  .card-foot { flex-direction: column; align-items: stretch; }
}
.add {
  white-space: nowrap;
  border: 0; border-radius: 999px; padding: 8px 14px;
  background: var(--button); color: #fff; font-weight: 700; font-size: .85rem;
}
.add:hover { background: var(--button-hover); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.price-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 40px; }

/* Tư vấn & chính sách */
.advice { background: var(--surface); padding: 64px 0; margin-top: 40px; }
.section-lead { color: var(--muted); margin-top: -4px; }
.advice-grid, .policy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.policy-grid { grid-template-columns: repeat(4, 1fr); }
.advice article, .policy-grid > div {
  background: var(--card); border-radius: var(--radius); padding: 22px; border: 1px solid var(--line);
}
.advice article { border-top: 4px solid var(--accent); }
.advice h3, .policy h3 { font-size: 1.12rem; }
.advice p, .policy p { margin: 0; color: var(--muted); font-size: .95rem; }
.policy { padding: 64px 0; }
.pi { font-size: 1.8rem; display: block; margin-bottom: 6px; }

.footer { background: var(--text); color: rgba(255, 255, 255, .75); padding: 40px 0; border-top: 4px solid var(--accent); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer p { margin: 6px 0; }
.footer b { color: #fff; font-weight: 600; }
.footer a { color: var(--accent); }

/* Giỏ hàng */
.overlay { position: fixed; inset: 0; background: rgba(36, 36, 36, .5); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(420px, 100%); background: var(--card);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
  box-shadow: -12px 0 32px rgba(36, 36, 36, .18);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.4rem; margin: 0; }
.icon-btn { border: 0; background: none; font-size: 1.2rem; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; background: var(--surface); }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line-pic { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.line-pic img { width: 100%; height: 100%; object-fit: cover; }
.line-name { font-weight: 600; font-size: .92rem; line-height: 1.35; }
.line-meta { font-size: .8rem; color: var(--muted); }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; margin-top: 6px; background: var(--card); }
.qty button { border: 0; background: none; width: 30px; height: 28px; color: var(--text); font-weight: 700; }
.qty span { min-width: 22px; text-align: center; font-size: .9rem; }
.line-right { text-align: right; }
.line-right .remove { border: 0; background: none; color: var(--muted); font-size: .8rem; text-decoration: underline; padding: 0; margin-top: 6px; }
.row { display: flex; justify-content: space-between; gap: 12px; margin: 4px 0; }
.row.total { font-weight: 800; font-size: 1.1rem; margin-top: 8px; }
.ship-hint { background: var(--accent-soft); color: var(--text); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: .88rem; margin: 10px 0 14px; font-weight: 500; }
.small { font-size: .82rem; color: var(--muted); }
.cart-empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Hộp thoại chi tiết / đặt hàng */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(980px, calc(100% - 32px));
  max-height: calc(100% - 32px); background: var(--card); color: var(--text);
  box-shadow: 0 24px 64px rgba(36, 36, 36, .3);
}
dialog::backdrop { background: rgba(36, 36, 36, .6); }
.detail { display: grid; grid-template-columns: 1.15fr 1fr; }
.gallery { background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.empty-gallery { position: relative; min-height: 320px; }
.empty-gallery .no-photo b { font-size: 1.8rem; }
.stage { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card); }
.stage img { width: 100%; height: 100%; object-fit: cover; }
.stage .nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .92); color: var(--text); font-size: 1.2rem; font-weight: 700;
  box-shadow: 0 4px 12px rgba(36, 36, 36, .25);
}
.stage .prev { left: 10px; } .stage .next { right: 10px; }
.stage .counter { position: absolute; right: 10px; bottom: 10px; background: rgba(36, 36, 36, .75); color: #fff; font-size: .78rem; padding: 4px 9px; border-radius: 999px; }
.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.thumbs button { border: 2px solid transparent; padding: 0; border-radius: 9px; overflow: hidden; background: none; opacity: .65; transition: .15s; }
.thumbs button img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.thumbs button.on, .thumbs button:hover { opacity: 1; border-color: var(--accent); }
.detail-body { padding: 28px; position: relative; }
.detail-body h2 { font-size: 1.55rem; padding-right: 32px; }
.close { position: absolute; top: 12px; right: 12px; }
.more-card { display: none; }
.specs { margin: 14px 0; padding: 0; list-style: none; font-size: .92rem; }
.specs li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 12px; }
.specs li span:first-child { color: var(--muted); white-space: nowrap; }
.specs li span:last-child { text-align: right; }
.detail .group-info { font-size: .88rem; color: var(--muted); }
.detail-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.cat-tag { display: inline-block; background: var(--accent-soft); color: var(--accent-ink); font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-right: 6px; }

.checkout { padding: 28px; position: relative; }
.checkout-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: .9rem; }
.field textarea { min-height: 72px; resize: vertical; }
.field .err { color: #c62828; font-size: .8rem; min-height: 1em; }
.summary { background: var(--surface); border-radius: var(--radius); padding: 16px; font-size: .9rem; }
.summary .row span:first-child { color: var(--muted); }
.order-text {
  width: 100%; min-height: 220px; font: .85rem/1.5 ui-monospace, Consolas, monospace;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface); color: var(--text);
}
.contact-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 60;
  box-shadow: 0 10px 30px rgba(36, 36, 36, .25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Màn hình nhỏ */
@media (max-width: 1120px) {
  .mega-grid { grid-template-columns: repeat(3, 1fr); gap: 14px 32px; }
}
@media (max-width: 1220px) {
  .cat-cards { grid-template-columns: repeat(3, 1fr); }
  .cats { margin-top: -50px; }
}
@media (max-width: 1060px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .controls input { width: 200px; }
}
@media (max-width: 960px) {
  .cat-cards { grid-template-columns: repeat(6, 170px); overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
  .cat-cards::-webkit-scrollbar { display: none; }
  .advice-grid { grid-template-columns: repeat(2, 1fr); }
  .policy-grid { grid-template-columns: repeat(2, 1fr); }
  .catnav-inner { flex-wrap: wrap; }
  .catnav { flex-basis: 100%; }
  .controls { flex: 1 1 100%; min-width: 0; }
  .controls input { flex: 1; width: auto; min-width: 0; }
  .controls select { flex: 0 1 auto; min-width: 0; max-width: 45%; }
  .detail { grid-template-columns: 1fr; }
  .empty-gallery { min-height: 180px; }
}
/* Trong từng danh mục con, nhãn loại đèn trên ảnh là thừa (chỉ giữ ở kết quả tìm kiếm) */
.sub-block .badge:not(.sale) { display: none; }
/* Tên sản phẩm tối đa 2 dòng để các thẻ thẳng hàng */
.card h3 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-toggle { display: none; }

@media (max-width: 860px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; place-items: center; }
  .cart-btn { margin-left: auto; }
  .topbar-inner { gap: 12px; }
}
@media (min-width: 861px) { .mobile-menu { display: none !important; } }

@media (max-width: 720px) {
  html { scroll-padding-top: 130px; }
  body.menu-open { overflow: hidden; }
  .promo { font-size: .78rem; padding: 6px 12px; }
  .promo .long { display: none; }
  .promo .short { display: inline; }
  .topbar-inner { height: 58px; }
  .logo img { height: 48px; }
  .cart-btn { padding: 9px 12px; }
  .cart-btn span { display: none; }

  /* Đầu trang */
  .hero-inner { padding: 40px 0 84px; }
  .hero h1 { font-size: 2.15rem; }
  .lead { font-size: 1rem; }
  .hero-cta { margin: 22px 0 20px; }
  .hero-cta .btn { flex: 1 1 auto; padding: 13px 16px; }
  .hero-perks li { font-size: .8rem; }

  /* Ô danh mục: vuốt ngang, có điểm dừng */
  .cat-cards { grid-template-columns: repeat(6, 156px); scroll-snap-type: x mandatory; scroll-padding-left: 16px; margin-inline: -16px; padding-inline: 16px; }
  .cat-card { min-height: 132px; padding: 40px 14px 14px; scroll-snap-align: start; }
  .cat-card b { font-size: 1rem; }

  /* Thanh danh mục dính trên cùng: chỉ một hàng, ô tìm kiếm mở khi bấm kính lúp */
  .shop { padding-top: 28px; }
  .catnav-inner { flex-wrap: wrap; gap: 8px; padding: 8px 0; }
  .catnav { flex: 1 1 0; flex-basis: 0; min-width: 0; }
  .chip { padding: 8px 12px; font-size: .88rem; min-height: 40px; }
  .search-toggle {
    display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 40px;
    border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text);
  }
  .search-toggle[aria-expanded="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
  .controls { display: none; }
  .catnav-wrap.searching .controls { display: flex; flex: 1 1 100%; }
  .controls input, .controls select { font-size: 16px; min-height: 44px; } /* 16px để iPhone không tự phóng to */

  /* Mục sản phẩm */
  .cat-section { padding-top: 32px; }
  .section-head h2 { font-size: 1.5rem; }
  .sub-links { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; margin-inline: -16px; padding-inline: 16px; }
  .sub-links::-webkit-scrollbar { display: none; }
  .sub-links a { white-space: nowrap; padding: 8px 12px; }
  .sub-head h3 { font-size: 1.12rem; }
  .sub-info, .cat-info { font-size: .86rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 10px 11px 12px; }
  .card h3 { font-size: .9rem; }
  .code, .size { font-size: .74rem; }
  .price { font-size: 1rem; }
  .card:hover { transform: none; }
  .no-photo { padding-top: 34px; }
  .no-photo b { font-size: 1.05rem; }
  .empty-gallery .no-photo { padding-top: 12px; }
  .add { padding: 10px; min-height: 40px; }
  .more-btn { width: 100%; min-height: 46px; }
  .advice { padding: 44px 0; }
  .policy { padding: 44px 0 90px; }
  .advice-grid, .policy-grid { grid-template-columns: 1fr; }
  .footer { padding-bottom: 96px; }

  /* Chi tiết sản phẩm: trượt lên từ dưới, nút Thêm vào giỏ luôn ở đáy */
  dialog {
    width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }
  dialog[open] { animation: sheet .22s ease-out; }
  @keyframes sheet { from { transform: translateY(40px); opacity: .6; } }
  .gallery { padding: 10px; }
  .stage { aspect-ratio: 4 / 3; }
  .detail-body { padding: 18px 18px 0; }
  .detail-body h2 { font-size: 1.3rem; }
  .price-wrap.big .price { font-size: 1.45rem; }
  .detail-actions {
    position: sticky; bottom: 0; z-index: 2; margin: 14px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line);
  }
  .detail-actions .btn { flex: 1; }
  .detail-body > .small { margin-bottom: 4px; }
  .checkout { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .checkout-grid { grid-template-columns: 1fr; }
  .field input, .field textarea { font-size: 16px; }
  .contact-btns .btn { flex: 1 1 100%; }

  /* Giỏ hàng: nút đủ lớn để bấm bằng ngón tay */
  .drawer-foot { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .qty button { width: 40px; height: 38px; }
  .line-right .remove { padding: 8px 0 4px; }

  /* Thanh điều hướng dưới cùng */
  body { padding-bottom: calc(var(--bn-h) + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 36;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(36, 36, 36, .06);
  }
  .bn-item {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: none; color: var(--text); text-decoration: none; font-size: .68rem; font-weight: 600; padding: 0;
  }
  .bn-item span { line-height: 1.1; }
  .bn-item:active { background: var(--surface); }
  .bn-zalo b {
    display: grid; place-items: center; width: 40px; height: 24px; border-radius: 8px;
    background: #0068ff; color: #fff; font-size: .72rem; font-weight: 800;
  }
  .bn-count {
    position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--sale); color: #fff; font-size: .68rem; display: grid; place-items: center;
  }
  .bn-count.bump { animation: bump .4s; }
  .mobile-menu { max-height: calc(100dvh - 90px - var(--bn-h) - env(safe-area-inset-bottom)); }
  .footer { padding-bottom: 32px; }
  .policy { padding-bottom: 44px; }
  .toast { bottom: calc(var(--bn-h) + 14px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); text-align: center; border-radius: 16px; }
  .cart-btn { display: none; } /* giỏ hàng đã có ở thanh dưới cùng */
  .topbar-inner { justify-content: space-between; }
  .logo { margin-inline: auto; transform: translateX(-20px); }

  /* Danh mục con chưa mở hết: một hàng vuốt ngang, lộ một phần thẻ kế tiếp để báo còn nữa */
  .sub-block:not(.open) .grid {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    margin-inline: -16px; padding: 2px 16px 8px; scroll-padding-inline: 16px; scrollbar-width: none;
  }
  .sub-block:not(.open) .grid::-webkit-scrollbar { display: none; }
  .sub-block:not(.open) .grid > * { flex: 0 0 44%; scroll-snap-align: start; }
  .sub-block:not(.open) .more-wrap { display: none; }
  .more-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border: 1.5px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft);
    color: var(--accent-ink); font-weight: 700; font-size: .88rem; padding: 12px; text-align: center;
  }
  .more-card b { font: 700 1.6rem Lora, Georgia, serif; }
  .sub-block + .sub-block { margin-top: 26px; padding-top: 20px; }
  .sub-head .link-btn { font-size: .86rem; min-height: 36px; }

  /* Đầu trang gọn hơn để thấy sản phẩm sớm */
  .hero-inner { padding: 26px 0 74px; }
  .eyebrow { font-size: .78rem; margin-bottom: 8px; }
  .hero h1 { font-size: 1.95rem; margin-bottom: 10px; }
  .lead { font-size: .95rem; line-height: 1.5; }
  .hero-cta { flex-wrap: nowrap; gap: 8px; margin: 16px 0 14px; }
  .hero-cta .btn { padding: 12px 10px; font-size: .92rem; }
  .hero-perks { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .hero-perks::-webkit-scrollbar { display: none; }
  .hero-perks li { white-space: nowrap; }

  /* Nút đóng cửa sổ chi tiết nổi trên ảnh, thanh kéo trên cùng */
  dialog::before {
    content: ""; position: sticky; top: 6px; display: block; width: 40px; height: 4px; margin: 6px auto -10px;
    border-radius: 2px; background: rgba(36, 36, 36, .25); z-index: 3;
  }
  .detail { position: relative; }
  .detail-body { position: static; }
  .detail .close {
    position: absolute; top: 18px; right: 18px; z-index: 4;
    width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 10px rgba(36, 36, 36, .2); color: var(--text); display: grid; place-items: center;
  }
  .detail-body h2 { padding-right: 0; }
}
:root { --bn-h: 58px; }
.bottom-nav { display: none; }
@media (max-width: 720px) { .bottom-nav { display: grid; } }

/* Chạm mượt: bỏ trễ chạm đúp, bỏ nền xanh khi chạm trên điện thoại */
a, button, select, summary { touch-action: manipulation; -webkit-tap-highlight-color: rgba(196, 162, 106, .2); }
@media (max-width: 380px) {
  .hero h1 { font-size: 1.9rem; }
  .chip { padding: 8px 10px; }
  .card-body { padding: 9px 9px 11px; }
}
