/* =========================== RESET =========================== */
html, body { width:100%; max-width:100%; overflow-x:hidden; margin:0; }
*, *::before, *::after { box-sizing:border-box; }
img { max-width:100%; height:auto; display:block; }

/* =========================== THEME VARS =========================== */
:root{
  --main-purple:#6a0dad;
  --light-purple:#f3e8ff;
  --dark-purple:#4b0082;
  --header-h-desktop: 110px;
  --header-h-mobile: 160px;
}

/* Body offset để không bị header che */
body{ padding-top: var(--header-h-desktop); }
@media (max-width:768px){ body{ padding-top: var(--header-h-mobile); } }

html{ scroll-behavior: smooth; }
[id]{ scroll-margin-top: var(--header-h-desktop); }
@media (max-width:768px){ [id]{ scroll-margin-top: var(--header-h-mobile); } }

/* =========================== HEADER – TÍM ĐẬM CÔNG NGHỆ (LOGO HỘP TRẮNG NHỎ) =========================== */
header {
  background: linear-gradient(145deg, #120026 0%, #23004d 40%, #3b0075 100%);
  color: #fff;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 8px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: var(--header-h-desktop);
  column-gap: 12px;
  box-shadow: 0 0 20px rgba(106, 0, 244, 0.35);
  backdrop-filter: blur(6px);
}

@media (max-width:768px){
  header {
    display: block;
    min-height: var(--header-h-mobile);
    padding: 10px 12px 6px;
    background: linear-gradient(160deg, #0f0020 0%, #26005c 50%, #4c00a3 100%);
  }
}

/* LOGO: hiển thị lại đúng, không hộp trắng */
.logo-box{
  width: 280px;
  height: 90px;
  /* chỉ làm trong suốt màu nền, KHÔNG đụng tới image */
  background-color: transparent;
  background-image: url("../images/logo.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  margin: 0 auto;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Mobile giữ tỉ lệ co giãn như trước */
@media (max-width: 768px){
  .logo-box{
    width: 62vw;
    max-width: 380px;
    height: clamp(72px, 18vw, 120px);
    background-color: transparent;
    background-image: url("../images/logo.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  }
}

/* Tagline phát sáng nhẹ */
.tagline {
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 5px;
  color: #e9ddff;
  text-shadow:
    0 0 8px rgba(180, 120, 255, 1),
    0 0 18px rgba(106, 0, 244, 0.8);
  animation: taglinePulse 3s ease-in-out infinite;
}
.tagline:after {
  content: "";
  display: block;
  width: 65%;
  height: 2px;
  margin: 4px auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #8f00ff, #b5179e, #8f00ff);
  background-size: 200%;
  animation: lineGlow 3s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(180, 120, 255, 0.6);
}

/* Hiệu ứng phát sáng */
@keyframes taglinePulse {
  0%, 100% { text-shadow: 0 0 6px rgba(180,120,255,.9), 0 0 18px rgba(106,0,244,.8); }
  50% { text-shadow: 0 0 3px rgba(180,120,255,.5), 0 0 8px rgba(106,0,244,.5); }
}
@keyframes lineGlow {
  0% { background-position: 0%; }
  50% { background-position: 100%; }
  100% { background-position: 0%; }
}

/* Right tools */
.right-tools{ display:flex; align-items:center; gap:10px; justify-self:end; }
.search-bar{ width:180px; position:relative; }
.search-bar input{ width:100%; height:28px; padding:6px 30px 6px 10px; border:none; border-radius:6px; font-size:13px; }
.search-bar i{ position:absolute; right:8px; top:50%; transform:translateY(-50%); color:#444; cursor:pointer; }
.cart-btn{
  position:relative; width:36px; height:36px; border-radius:8px;
  background:rgba(255,255,255,.2); border:1px solid rgba(255,255,255,.35);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.cart-btn i{ font-size:18px; color:#fff; }
.cart-count{
  position:absolute; top:-6px; right:-6px; min-width:18px; height:18px; padding:0 5px;
  background:#e53935; color:#fff; border-radius:10px; font-size:12px; line-height:18px; text-align:center;
}

/* Desktop center absolute */
@media (min-width:769px){
  .header-center{
    position:absolute; left:50%; top:50%;
    transform:translate(-50%,-50%);
    display:flex; flex-direction:column; align-items:center; text-align:center;
    pointer-events:none;
  }
  .header-center .tagline, .header-center .logo-box{ pointer-events:auto; }
  .tagline:after{ width:140px; height:2px; margin-top:6px; }
}

/* Mobile layout */
@media (max-width:768px){
  .menu-btn{ position:absolute; left:12px; top:16px; z-index:5; }
  .right-tools{ position:absolute; right:12px; top:12px; z-index:5; display:flex; align-items:center; gap:8px; }
  .search-bar{ width:160px; }
  .header-center{
    position:absolute; left:50%; top:60%;
    transform:translate(-50%,-50%);
    display:flex; flex-direction:column; align-items:center; text-align:center; width:100%;
  }
  .logo-box{
    width:62vw; max-width:380px; height:clamp(72px,18vw,120px);
    background:url("../images/logo.png") center/contain no-repeat;
    margin:0 auto 6px;
  }
  .tagline{ font-size:15px; letter-spacing:1px; white-space:nowrap; text-align:center; }
  .tagline:after{ width:68%; }
}

/* Kéo tagline sát logo hơn */
.header-center .tagline { margin-top: -12px; line-height:1.1; }

/* =========================== HERO SLIDER – 3:1 desktop, 2:1 mobile =========================== */
.hero{
  position:relative; overflow:hidden;
  width:100%; max-width:1120px;
  margin:12px auto; border-radius:12px;
}
.hero-track{
  display:flex; transition:transform .5s ease; will-change:transform;
}
.hero-slide{
  position:relative; flex:0 0 100%; width:100%;
  aspect-ratio: 3 / 1; /* desktop 3:1 */
  background:#000; overflow:hidden;
}
/* Mobile: khung 2:1 */
@media (max-width:768px){
  .hero-slide{ aspect-ratio: 2 / 1; }
}
/* Fallback nếu không hỗ trợ aspect-ratio */
@supports not (aspect-ratio: 3 / 1) { .hero-slide{ height: calc(100vw / 3); } }
@supports not (aspect-ratio: 2 / 1) {
  @media (max-width:768px){ .hero-slide{ height: calc(100vw / 2); } }
}
.hero-slide img{
  width:100%; height:100%; object-fit:cover; display:block;
}
/* Mobile: vẫn để cover; nếu muốn không cắt ảnh, đổi thành 'contain' */
@media (max-width:768px){
  .hero-slide img{ object-fit:cover; background:#000; }
}
.hero-arrow{
  position:absolute; top:50%; transform:translateY(-50%);
  width:36px; height:36px; border:none; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.35); color:#fff; cursor:pointer; backdrop-filter:blur(4px);
}
.hero-arrow:hover{ background:rgba(0,0,0,.5); }
.hero-arrow.prev{ left:10px; } .hero-arrow.next{ right:10px; }
.hero-dots{
  position:absolute; left:50%; transform:translateX(-50%);
  bottom:10px; display:flex; gap:8px;
}
.hero-dots button{
  width:8px; height:8px; border-radius:50%; border:0; cursor:pointer;
  background:rgba(255,255,255,.5);
}
.hero-dots button.active{ background:#fff; width:20px; border-radius:999px; transition:width .25s; }

/* =========================== CATEGORIES =========================== */
.categories{ max-width:1200px; margin:16px auto 8px; padding:0 16px; }
.cat-grid{ display:grid; grid-template-columns:repeat(6,1fr); gap:14px; }
.cat-card{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px; text-decoration:none; background:#fff; border:1px solid #e9ecef;
  border-radius:8px; padding:18px 10px; color:#0f172a; position:relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
  will-change: transform;
}
.cat-card:hover{ box-shadow:0 4px 20px rgba(0,0,0,.06); transform:translateY(-2px); }
.cat-ico{ width:86px; height:86px; border-radius:50%; background:#f3f4f6; display:flex; align-items:center; justify-content:center; transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease; }
.cat-ico img{ width:70%; height:70%; object-fit:contain; transition: transform .25s ease; }
.cat-name{ font-size:14px; font-weight:600; color:#0f172a; text-align:center; position:relative; }
.cat-name::after{ content:""; position:absolute; left:50%; bottom:-6px; width:0; height:3px; border-radius:3px; transform:translateX(-50%); background:linear-gradient(90deg, var(--main-purple), #ffd86b); transition:width .22s ease; box-shadow:0 0 8px rgba(255,216,107,.6); }
.cat-card:hover .cat-ico{ transform:scale(1.06); background-color:#f7f1ff; box-shadow:0 6px 18px rgba(106,13,173,.20); }
.cat-card:hover .cat-ico img{ transform:scale(1.05); }
.cat-card:hover .cat-name::after{ width:48%; }
.cat-card::before{ content:""; position:absolute; inset:-1px; border-radius:8px; pointer-events:none; background:linear-gradient(90deg, rgba(106,13,173,.0), rgba(255,216,107,.35), rgba(106,13,173,.0)); opacity:0; transition:opacity .22s ease; }
.cat-card:hover::before{ opacity:1; }
@media (max-width:1024px){ .cat-grid{ grid-template-columns:repeat(5,1fr); } }
@media (max-width:768px){
  .cat-grid{ grid-template-columns:repeat(4,1fr); gap:10px; }
  .cat-ico{ width:74px; height:74px; }
  .cat-name{ font-size:13px; }
}
@media (max-width:480px){
  .cat-grid{ grid-template-columns:repeat(3,1fr); }
  .cat-ico{ width:68px; height:68px; }
  .cat-name{ font-size:12px; }
}

/* =========================== PRODUCTS =========================== */
.products{ padding:20px; text-align:center; }
.products-list{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px; max-width:900px; margin:0 auto; }
.product{ border:1px solid #ddd; padding:15px; border-radius:8px; transition:.3s; background:#fff; }
.product:hover{ box-shadow:0 0 10px rgba(106,13,173,.25); transform:translateY(-3px); }
.product button{ background:var(--main-purple); color:#fff; border:none; padding:8px 12px; border-radius:5px; cursor:pointer; }
.product button:hover{ background:var(--dark-purple); }

/* PRICE FILTER */
.price-filter{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin:12px auto 16px; }
.pf-btn{ background:#fff; border:1px solid #e5e7eb; color:#111827; padding:6px 12px; border-radius:999px; cursor:pointer; font-weight:600; transition:.18s ease; }
.pf-btn:hover{ transform:translateY(-1px); box-shadow:0 6px 14px rgba(0,0,0,.06); }
.pf-btn.active{ border-color: rgba(106,13,173,.35); box-shadow:0 6px 18px rgba(106,13,173,.15); background:linear-gradient(90deg, #fff, #f7f1ff); }

/* =========================== FORM ĐẶT HÀNG (MINI) =========================== */
#form-overlay{ display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:1999; }
#order-form{
  display:none; position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  background:#fff; padding:14px 16px; border-radius:10px; width:280px; z-index:2000; box-shadow:0 0 20px rgba(0,0,0,.35);
}
#order-form h3{ font-size:15px; margin:0 0 8px; font-weight:700; text-align:center; }

/* Thumb trong form */
.order-thumb{
  display:flex; align-items:center; justify-content:center;
  gap:6px; margin:8px 0 10px;
}
.order-thumb .thumb{
  width:48px; height:48px; border-radius:8px; overflow:hidden;
  border:1px solid #eee; background:#f7f7f7;
}
.order-thumb .thumb img{ width:100%; height:100%; object-fit:cover; }
.order-thumb .more{
  min-width:28px; height:28px; padding:0 8px; border-radius:999px; background:#111827; color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700;
}
@media (max-width:480px){ .order-thumb .thumb{ width:44px; height:44px; } }

#close-form{ position:absolute; top:10px; right:10px; background:var(--main-purple); color:#fff; border:none; border-radius:50%; width:24px; height:24px; cursor:pointer; font-size:14px; }
#order-form input,#order-form textarea{
  width:100%; padding:6px 8px; margin:5px 0; border:1px solid #ccc; border-radius:6px; font-size:13px; line-height:1.25;
}
#order-form textarea{ min-height:65px; resize:vertical; }
#order-form button[type="submit"]{
  display:block; width:100%; padding:7px 0; font-size:13px; text-transform:uppercase; font-weight:700; border-radius:7px; background:var(--main-purple); color:#fff; border:none; cursor:pointer;
}
#phoneError{ color:red; display:none; font-size:12.5px; margin:2px 0 4px; }
@media (max-width:480px){
  #order-form{ width:90vw; max-width:300px; padding:12px 14px; }
  #order-form h3{ font-size:14.5px; }
}

/* =========================== CART DRAWER (popup giữa màn) =========================== */
#cart-drawer{
  position: fixed;
  top: 50%;
  right: -420px;
  transform: translateY(-50%);
  width: 360px; max-width: 92vw;
  height: auto; max-height: 82vh;
  background: #fff;
  box-shadow: -8px 14px 28px rgba(0,0,0,.18);
  border-radius: 16px 0 0 16px;
  z-index: 2100;
  transition: right .28s ease;
  display: flex; flex-direction: column;
  overflow: hidden;
}
#cart-drawer.active{ right: 0; }

.cart-header{
  position: sticky; top: 0; z-index: 1;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid #eee; background:#fafafa;
}
.cart-body{
  flex: 1 1 auto;
  overflow: auto;
  padding:10px 12px;
  max-height: calc(82vh - 56px - 96px);
}
.cart-footer{
  position: sticky; bottom: 0; z-index: 1;
  border-top:1px solid #eee; background:#fafafa;
  padding:10px 12px;
}
.cart-title{ font-weight:700; }
.cart-row{ display:flex; align-items:center; justify-content:space-between; margin:4px 0; }
.cart-actions{ display:flex; gap:6px; margin-top:8px; }
.cart-actions button{ flex:1; padding:8px 10px; border:none; border-radius:8px; cursor:pointer; font-weight:700; font-size:14px; }
.btn-outline{ background:#fff; border:1px solid #ddd; }
.btn-primary{ background:#6a0dad; color:#fff; }
.total-amount{ color:#6a0dad; font-weight:800; }

.cart-item{
  display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center;
  padding:10px 8px; border-bottom:1px dashed #eee;
}
.cart-thumb{ width:56px; height:56px; border-radius:8px; overflow:hidden; background:#f3f4f6; display:flex; align-items:center; justify-content:center; border:1px solid #eee; }
.cart-thumb img{ width:100%; height:100%; object-fit:cover; }
@media (max-width:480px){ .cart-thumb{ width:50px; height:50px; } }

.cart-item .name{ font-weight:600; }
.cart-item .price{ color:#6a0dad; font-weight:700; }
.qty-control{ display:flex; align-items:center; gap:6px; margin-top:4px; }
.qty-control button{ width:24px; height:24px; border:1px solid #ccc; background:#fff; border-radius:6px; cursor:pointer; }
.remove-btn{ background:none; border:none; color:#e53935; cursor:pointer; }

.toast{ position:fixed; bottom:16px; left:50%; transform:translateX(-50%); z-index:2200; background:#323232; color:#fff; padding:10px 14px; border-radius:8px; opacity:0; pointer-events:none; transition:opacity .2s; }
.toast.show{ opacity:1; }

/* =========================== MOBILE MENU (SỬA CHUẨN 3/4 MÀN HÌNH) =========================== */
.overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.45);
  opacity:0; pointer-events:none; transition:opacity .2s ease; z-index:1200;
  backdrop-filter: blur(2px);
}
.overlay.active{ opacity:1; pointer-events:auto; }

/* 👉 GỘP & SỬA: KHÔNG full height, top 12vh, cao tối đa 75vh, rộng 75vw */
.mobile-menu{
  position:fixed;
  top:12vh;
  left:0;
  width:75vw;              /* ~3/4 chiều rộng */
  max-width:420px;         /* tránh quá to trên máy lớn */
  height:auto;
  max-height:75vh;         /* ~3/4 chiều cao */
  background:#ffffff;
  box-shadow: 6px 8px 28px rgba(0,0,0,.18);
  border-radius:16px;
  transform:translateX(-100%); transition: transform .25s ease;
  z-index:1300; display:flex; flex-direction:column;
  overflow:hidden;         /* bo góc gọn */
}
.mobile-menu.active{ transform:translateX(0); }

.mm-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid #eee; background:#fafafa;
}
.mm-head strong{ font-size:16px; }
.mm-close{ background:#fff; border:1px solid #e5e7eb; width:32px; height:32px; border-radius:8px; cursor:pointer; }

/* Vùng danh mục cuộn trong khung */
.mm-nav{
  display:flex; flex-direction:column;
  padding:8px 6px;
  overflow:auto;                      /* cuộn bên trong menu */
  max-height:calc(75vh - 56px);       /* trừ phần header menu */
}
.mm-nav a{
  display:flex; align-items:center; gap:10px; padding:12px 12px; margin:4px 6px;
  border-radius:10px; text-decoration:none; color:#111827; font-weight:600;
  border:1px solid #f1f1f1; background:#fff; transition:.18s ease;
}
.mm-nav a:hover{ transform:translateX(4px); box-shadow:0 4px 16px rgba(0,0,0,.06); border-color:#ececec; }

@media (min-width:769px){
  /* Cho phép mở trên desktop nhưng vẫn gọn */
  .mobile-menu{ width:360px; max-width:360px; }
  .overlay{ display:block; }
}

/* =========================== GRID/CARD cho trang danh mục =========================== */
.products .products-list{
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px;
}
.card{
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover{ box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
.card-media{
  position: relative; background: #fff;
  aspect-ratio: 1/1;
  display: flex; align-items: center; justify-content: center;
}
.card-media img{ max-width: 90%; max-height: 90%; object-fit: contain; }
.brand-chip{
  position: absolute; top: 10px; left: 10px;
  background: #e8f0fe; color: #2563eb;
  font-size: 12px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px;
}
.card-body{ padding: 12px 12px 14px; display: grid; gap: 6px; }
.card-title{ color: #0ea25a; font-weight: 600; line-height: 1.3; }
.card-price{ display: flex; align-items: center; gap: 10px; }
.price-new{ color: #ef4444; font-weight: 800; }
.price-old{ color:#9ca3af; text-decoration: line-through; }
.discount-tag{
  display:inline-block; border:1px solid #111827; color:#111827;
  font-size: 12px; padding: 2px 6px; border-radius: 6px;
}
.card-actions{ margin-top: 8px; }
.card-actions .btn-buy{
  width: 100%; border: 1px solid #7c3aed; color: #fff; background: #7c3aed;
  padding: 8px 10px; border-radius: 8px; font-weight: 600;
}
.card-actions .btn-buy:hover{ filter: brightness(.95); }
.card-actions.three{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
@media (max-width: 480px){ .card-actions.three{ grid-template-columns: 1fr; } }
.btn-primary{ background:#7c3aed; color:#fff; border:1px solid #7c3aed; padding:8px 10px; border-radius:8px; font-weight:600; }
.btn-outline{ background:#fff; color:#111; border:1px solid #d1d5db; padding:8px 10px; border-radius:8px; font-weight:600; }
.btn-buy{ background:#10b981; color:#fff; border:1px solid #10b981; padding:8px 10px; border-radius:8px; font-weight:600; }
.btn-primary:hover,.btn-buy:hover{ filter:brightness(.95); }

/* =========================== MOBILE HARDENING – chống cuộn ngang =========================== */
html, body { width: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
header, .hero, .categories, .products, #order-form, #cart-drawer, .mobile-menu, .overlay {
  max-width: 100%; overflow-x: hidden;
}
@media (max-width: 480px){
  .cat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .cat-ico { width: 64px; height: 64px; }
  .cat-name { font-size: 12.5px; }
}
@media (max-width: 768px){
  .header-center{
    left: 50%; transform: translate(-50%,-50%);
    width: calc(100% - 24px); max-width: 100%; overflow: hidden;
  }
  .tagline{ white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 100%; display: block; }
}
.price-filter { padding: 0 8px; overflow: hidden; }
.pf-btn { max-width: 100%; }
section, div, nav, aside, form { max-width: 100%; }
.products-list .product h3, .cart-item .name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.mm-nav .back-home {
  font-weight: 600; color: #007aff;
  border-top: 1px solid #e5e7eb; padding-top: 10px; margin-top: 6px;
}

/* Ngăn iPhone tự zoom khi nhập */
input, textarea, select { font-size: 16px !important; }

/* Gợi ý địa chỉ */
.addr-group { margin: 8px 0 10px; }
.addr-group label { display:block; font-weight:700; margin-bottom:6px; }
.addr-row { display:grid; grid-template-columns: 1fr 1fr 1fr; gap:8px; }
.addr-row select, #addr-street{
  width:100%; padding:8px 10px; border:1px solid #ccc; border-radius:6px; font-size:16px;
}
@media (max-width: 480px){ .addr-row { grid-template-columns:1fr; } }
/* =========================== MOBILE FONT SCALE =========================== */
@media (max-width: 768px) {
  html, body {
    font-size: 17px; /* tăng nhẹ toàn trang (mặc định ~16px) */
  }

  /* Giúp chữ trong form và nút rõ nét hơn */
  input, textarea, select, button {
    font-size: 18px !important;
    line-height: 1.4;
  }

  /* Tăng size cho các tiêu đề và mô tả */
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.2rem; }
  p, label, span, a { font-size: 1rem; }
}
/* =========================== CATEGORY CARD – TÍM ĐẬM NGẢ ĐEN CÔNG NGHỆ =========================== */
.cat-card {
  background: linear-gradient(145deg, #1a002d 0%, #2d0066 45%, #4b0099 100%);
  border: 1px solid rgba(140, 80, 255, 0.3);
  border-radius: 10px;
  box-shadow:
    0 0 20px rgba(106, 0, 244, 0.2),
    inset 0 0 8px rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Ánh sáng quét nhẹ khi hover */
.cat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.3) 40%,
    rgba(255, 255, 255, 0.05) 100%
  );
  opacity: 0;
  transform: translateX(-100%);
  transition: all 0.6s ease;
}
.cat-card:hover::before {
  opacity: 1;
  transform: translateX(100%);
}

/* Hiệu ứng nổi sáng khi hover */
.cat-card:hover {
  box-shadow:
    0 0 25px rgba(140, 80, 255, 0.55),
    0 0 40px rgba(90, 0, 180, 0.45);
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Icon tròn phát sáng */
.cat-ico {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6a00f4, #3a0ca3 70%, #150022);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(140, 80, 255, 0.45);
  transition: all 0.3s ease;
}
.cat-ico img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
  transition: transform 0.3s ease;
}
.cat-card:hover .cat-ico {
  transform: scale(1.1);
  box-shadow: 0 0 22px rgba(160, 100, 255, 0.75);
}
.cat-card:hover .cat-ico img {
  transform: scale(1.05);
}

/* Tên danh mục ánh sáng tím neon */
.cat-name {
  font-size: 15px;
  font-weight: 700;
  color: #e9ddff;
  text-shadow:
    0 0 6px rgba(170, 100, 255, 0.9),
    0 0 12px rgba(106, 0, 244, 0.7);
  position: relative;
}
.cat-name::after {
  content: "";
  display: block;
  width: 0;
  height: 3px;
  margin: 6px auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #8f00ff, #b5179e, #8f00ff);
  box-shadow: 0 0 12px rgba(180, 120, 255, 0.7);
  transition: width 0.3s ease;
}
.cat-card:hover .cat-name::after {
  width: 60%;
}

/* Responsive */
@media (max-width:768px){
  .cat-ico{ width:74px; height:74px; }
  .cat-name{ font-size:14px; }
}
@media (max-width:480px){
  .cat-ico{ width:68px; height:68px; }
  .cat-name{ font-size:13px; }
}
/* ===== PRODUCT GRID ===== */
.product-grid {
  padding: 30px 20px;
}

.product-grid .section-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 16px;
  text-align: center;
  color: #4b0082;
}

.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 8px;
}

.product-card h3 {
  font-size: 15px;
  color: #333;
  margin: 6px 0;
  line-height: 1.3;
}

.product-card .price {
  color: #6a0dad;
  font-weight: bold;
}
.all-products {
  margin: 40px auto;
  padding: 0 20px;
  max-width: 1200px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.product-card {
  border: 1px solid #eee;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 0 8px rgba(0,0,0,0.05);
  padding: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
  background: #fff;
  cursor: pointer;
}
.product-card img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.product-card h3 {
  font-size: 15px;
  margin: 8px 0 4px;
  color: #333;
}
.product-card .price {
  color: purple;
  font-weight: bold;
}
.search-results {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
}

.search-results.active {
  display: block;
}

.search-results .result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}

.search-results .result-item:hover {
  background: #f9f9f9;
}

.search-results img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

.search-results .info {
  flex: 1;
}

.search-results .info h4 {
  font-size: 14px;
  margin: 0;
  color: #333;
}

.search-results .info span {
  font-size: 13px;
  color: #6a0dad;
  font-weight: 600;
}
/* ===================== KẾT QUẢ TÌM KIẾM (POPUP Ở GIỮA MÀN HÌNH) ===================== */
.search-results {
  position: fixed; /* ✅ dùng fixed để tách khỏi header */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 600px;
  max-height: 70vh;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
}

/* Khi có kết quả thì hiển thị */
.search-results.active {
  display: flex;
}

/* Nền mờ khi hiện hộp tìm kiếm */
#search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.4);
  z-index: 9998;
  display: none;
}
#search-overlay.active {
  display: block;
}

/* Item kết quả */
.search-results .result-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}
.search-results .result-item:hover {
  background: #f3f3f3;
}
.search-results img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 10px;
}
.search-results .info {
  flex: 1;
}
.search-results .info .name {
  font-weight: 600;
}
.search-results .info .price {
  color: #e53935;
}
/* ====== POPUP KẾT QUẢ TÌM KIẾM ====== */
#search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
}
#search-overlay.active {
  display: block;
}

.search-results {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 600px;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
}
.search-results.active {
  display: flex;
}

.search-results .result-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.search-results .result-item:hover {
  background: #f5f5f5;
}
.search-results img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 10px;
}
.search-results .info {
  flex: 1;
}
.search-results .name {
  font-weight: 600;
}
.search-results .price {
  color: #e53935;
}
/* Kết quả tìm kiếm popup */
#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 100;
}
#search-overlay.active {
  display: block;
}

.search-results {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  width: 90%;
  max-width: 500px;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  padding: 10px;
  z-index: 200;
}

.search-results.active {
  display: block;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #ddd;
  padding: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.search-item:hover {
  background: #f0f0f0;
}
.search-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
}
.search-item .info {
  flex: 1;
}
.search-item .info h4 {
  margin: 0;
  font-size: 14px;
}
.search-item .info p {
  margin: 3px 0 0;
  color: #666;
  font-size: 13px;
}
.no-results {
  text-align: center;
  padding: 20px;
  color: #555;
}
.search-results {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 15px;
  max-width: 90%;
  width: 400px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  display: none;
  z-index: 9999;
}

.search-results.active {
  display: block;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.result-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
}

.no-results {
  text-align: center;
  color: #666;
  font-size: 14px;
  padding: 10px;
}
/* ========== KẾT QUẢ TÌM KIẾM POPUP GIỮA MÀN HÌNH ========== */
#search-results {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 10px;
  display: none;
  z-index: 9999;
}

#search-results.active {
  display: block;
}

/* nền mờ */
#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  z-index: 9998;
}

#search-overlay.active {
  display: block;
}

/* từng sản phẩm */
#search-results .result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

#search-results .result-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
}

#search-results .result-item .info {
  flex: 1;
}

#search-results .result-item h4 {
  font-size: 14px;
  margin: 0;
}

#search-results .result-item span {
  color: #f00;
  font-weight: bold;
  font-size: 13px;
}
/* Kết quả tìm kiếm hiển thị giữa màn hình */
#search-results {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 10px;
  display: none;
  z-index: 9999;
}

#search-results.active {
  display: block;
}

/* nền mờ phía sau */
#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  z-index: 9998;
}

#search-overlay.active {
  display: block;
}

/* tùy chọn: làm đẹp item trong kết quả */
#search-results .result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid #eee;
}

#search-results .result-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

#search-results .result-item h4 {
  margin: 0;
  font-size: 16px;
}

#search-results .result-item span {
  color: #e60000;
  font-weight: 600;
}
/* --- KHU HÌNH ẢNH CHÍNH --- */
.pd-main {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}
.pd-main img, .pd-main video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.pd-main img:hover, .pd-main video:hover {
  transform: scale(1.03);
}

/* --- DANH SÁCH THUMB --- */
.pd-thumbs {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, 80px);
  gap: 10px;
  justify-content: center;
}
.pd-thumbs .thumb {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pd-thumbs .thumb:hover {
  transform: scale(1.05);
}
.pd-thumbs .thumb.active {
  outline: 2px solid #7c3aed;
}
.pd-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- LIGHTBOX --- */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
#lightbox.active { display: flex; }
#lightbox img, #lightbox video {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
}
#lightbox button {
  position: absolute;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 50%;
}
#lightbox #close-lightbox { top: 20px; right: 20px; }
#lightbox #prev-lightbox { left: 20px; }
#lightbox #next-lightbox { right: 20px; }

/* ===== ẢNH CHÍNH ===== */
.pd-main {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 1/1;
}
.pd-main img, .pd-main video {
  max-width: 95%;
  max-height: 95%;
  border-radius: 10px;
}
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.8);
  border: none;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}
.nav-btn:hover { background: #0ea5e9; color: white; }
#prev-btn { left: 10px; }
#next-btn { right: 10px; }

/* ===== NHÓM ẢNH NHỎ ===== */
.thumbs-wrapper {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 5px;
}
.pd-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.pd-thumbs::-webkit-scrollbar { display: none; }
.thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb.active { outline: 2px solid #7c3aed; }
.thumb-nav {
  background: #f3f4f6;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}
.thumb-nav:hover { background: #0ea5e9; color: white; }

/* ===== HIỆU ỨNG FADE + SLIDE ===== */
.pd-main img, 
.pd-main video {
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.pd-main img.show, 
.pd-main video.show {
  opacity: 1;
  transform: translateX(0);
}

/* ===== NÚT NEXT / PREV ===== */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  z-index: 5;
}
.nav-btn:hover {
  background: rgba(0,0,0,0.7);
}
#prev-btn { left: 8px; }
#next-btn { right: 8px; }

/* ===== MÔ TẢ SẢN PHẨM ===== */
.product-description {
  max-width: 950px;
  margin: 40px auto;
  padding: 30px 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
  line-height: 1.7;
  color: #1f2937;
}

.product-description h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  border-bottom: 2px solid #0ea5e9;
  display: inline-block;
  padding-bottom: 4px;
}

.product-description h3 {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  margin-top: 22px;
}

.product-description p {
  margin: 10px 0;
  text-align: justify;
}
/* ===== ĐÁNH GIÁ SẢN PHẨM ===== */
.product-reviews {
  max-width: 950px;
  margin: 40px auto;
  background: #fff8f5;
  border: 1px solid #f2e0d8;
  border-radius: 10px;
  padding: 24px 28px;
  color: #333;
}
.product-reviews h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  border-bottom: 2px solid #f1d3c3;
  padding-bottom: 6px;
}
.review-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 20px;
}
.review-summary .score {
  font-size: 36px;
  color: #e55300;
  font-weight: 800;
}
.review-summary .score span {
  font-size: 18px;
  color: #555;
}
.review-summary .stars {
  color: #ff9800;
  font-size: 24px;
  margin: 4px 0;
}
.review-summary .filters button {
  margin: 5px 4px;
  padding: 5px 10px;
  border: 1px solid #ccc;
  background: white;
  border-radius: 6px;
  cursor: pointer;
}
.review-summary .filters button.active {
  border-color: #e55300;
  color: #e55300;
  background: #fff2ec;
}

.review-list .review-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.review-item .stars {
  color: #ff9800;
  margin-bottom: 4px;
}
.review-item .name {
  font-weight: 600;
}
.review-item .comment {
  margin: 6px 0;
}
.review-item .time {
  color: #777;
  font-size: 13px;
}

/* ==== BỐ CỤC SẢN PHẨM ==== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 15px;
  justify-items: center;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  max-width: 260px;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

.product-card img {
  width: 100%;
  height: auto;
  display: block;
  border-bottom: 1px solid #eee;
}

.product-card h3 {
  font-size: 15px;
  padding: 10px;
  color: #222;
  font-weight: 600;
  min-height: 45px;
}

.product-card p {
  font-size: 14px;
  font-weight: 700;
  color: #d70018;
  margin-bottom: 10px;
}

/* 📱 Giao diện điện thoại: chia 2 cột */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr); /* 👉 2 sản phẩm / hàng */
    gap: 10px;
    padding: 10px;
  }

  .product-card {
    max-width: 100%;
    font-size: 13px;
  }

  .product-card h3 {
    font-size: 13px;
    padding: 8px 4px;
  }
}
/* Hiển thị dạng lưới 2 sản phẩm/hàng trên mobile, 3–4 trên desktop */
#cat-products {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  gap: 16px !important;
  justify-items: center;
}

/* Mỗi thẻ sản phẩm co theo grid, không full dòng */
#cat-products .product-card {
  max-width: none !important;
  margin: 0 !important;
  width: 100% !important;
}

.product-reviews .review-item {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 12px;
  margin-bottom: 10px;
}
.product-reviews .stars {
  color: #facc15;
  font-size: 18px;
}
.product-reviews .name {
  font-weight: 600;
  color: #111;
}
.product-reviews .comment {
  margin: 6px 0;
  color: #333;
}
.product-reviews .time {
  color: #666;
  font-size: 13px;
}
/* ===== PHÂN LOẠI SẢN PHẨM ===== */
.pd-variants {
  margin: 18px 0;
}
.pd-variants h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111;
  margin-bottom: 10px;
}
.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.variant-item {
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  transform: scale(1);
}
.variant-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  transition: all 0.25s ease;
}
.variant-item span {
  font-size: 14px;
  color: #111;
  font-weight: 500;
}
.variant-item:hover {
  border-color: #7c3aed;
  background: #faf5ff;
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(124,58,237,0.25);
}
.variant-item:hover img {
  transform: scale(1.08);
}
.variant-item.active {
  border-color: #7c3aed;
  background: #f5f3ff;
  box-shadow: 0 0 8px rgba(124,58,237,0.3);
  transform: scale(1.03);
}
/* Logo bấm được về trang chủ */
.logo-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.logo-link:hover {
  opacity: 0.9;
}