/* ===== RESET & BODY ===== */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f5f5;
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: #e60023;
  color: #fff;
}

/* LOGO */
.topbar .logo {
  font-size: 22px;
  font-weight: bold;
  white-space: nowrap;
}

/* ===== CART ===== */

.cart-count {
  position: absolute;
  top: -6px;
  right: -10px;
  background: yellow;
  color: red;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 50%;
  font-weight: bold;
}

.cart-shake {
  animation: shake 0.4s;
}
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* ===== CATEGORY (FIX HỞ NỀN) ===== */
.category-wrapper {
  max-width: 1200px;
  margin: 0 auto;               /* FIX */
  padding: 20px 0;              /* FIX */
  display: flex;
  position: relative;
}

.category-left {
  width: 220px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.cat-item {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.cat-item:hover {
  background: #f5f5f5;
  color: #d70018;
}

.category-right {
  position: absolute;
  left: 240px;
  top: 0;
  width: 600px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
  display: none;
  z-index: 100;
}

.brand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-list span {
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
}

.brand-list span:hover {
  background: #d70018;
  color: #fff;
}

/* ===== MAIN LAYOUT (FIX BACKGROUND LIỀN) ===== */
.layout {
  display: flex;
  max-width: 1200px;             /* FIX */
  margin: 0 auto;                /* FIX */
  align-items: flex-start;
  background: transparent;       /* FIX */
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: #fff;
  padding: 15px;
  border-radius: 8px;
}

.sidebar ul {
  padding: 0;
  margin: 0;
}

.sidebar li {
  list-style: none;
  padding: 10px;
  cursor: pointer;
}

.sidebar li:hover {
  background: #eee;
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: 0 20px 20px;          /* FIX */
}

/* ===== PRODUCT GRID ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.2s ease;
}

.product-card:hover {
  transform: translateY(-5px);
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}

/* ===== PRICE ===== */
.price {
  color: red;
  font-weight: bold;
  font-size: 18px;
}

/* ===== PRODUCT DETAIL (GIỮ NGUYÊN TỈ LỆ) ===== */
.product-detail {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 40px;
  background: #fff;
  padding: 30px;
  max-width: 1100px;
  margin: 30px auto;
  border-radius: 8px;
}

.product-img img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

/* ===== FOOTER ===== */
.footer {
  background: #e60023;
  color: #fff;
  margin-top: 40px;
}

.footer-container {
  max-width: 1200px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  padding: 30px 20px;
}

.footer-column p,
.footer-column a {
  font-size: 14px;
  color: #fff;
  text-decoration: none;
}

.footer-bottom {
  text-align: center;
  padding: 10px;
  background: #c4001a;
  font-size: 13px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .product-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}
/* ===== FIX LẶP DANH MỤC ===== */
/* Chỉ hiện category hover khi màn hình nhỏ */
@media (min-width: 1025px) {
  .category-wrapper {
    display: none;
  }
}
.sidebar li.active {
  background: #e60023;
  color: #fff;
  border-radius: 6px;
}
/* SEARCH WITH ICON */
/* ===== TOPBAR FIX CHUẨN ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #e60023;
  color: #fff;
}

/* LOGO */
.topbar .logo {
  font-size: 22px;
  font-weight: bold;
  white-space: nowrap;
}

/* SEARCH */
.search-box {
  position: relative;
  flex: 1;
  max-width: 600px;
}

.search-box i {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: #999;
  font-size: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: 24px;
  border: none;
  outline: none;
  font-size: 14px;
}

/* CART */
.cart-btn {
  margin-left: auto;      /* ⭐ QUAN TRỌNG */
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}
/* ===== CLEAR SEARCH (X) ===== */
.clear-search {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 25px;
  color: #999;
  cursor: pointer;
  display: none;
}

.clear-search:hover {
  color: #e60023;
}

/* ===== SEARCH SUGGEST ===== */
.search-suggest {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  list-style: none;
  padding: 6px 0;
  margin: 0;
  display: none;
  z-index: 999;
}

.search-suggest li {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
}

.search-suggest li:hover {
  background: #f5f5f5;
}

/* ===== HIGHLIGHT TEXT ===== */
.highlight {
  background: #ffe082;
  color: #000;
  padding: 0 2px;
  border-radius: 3px;
}
.search-suggest li.active{
  background:#e53935;
  color:#fff;
}
.search-suggest li.active mark{
  background:#fff;
  color:#e53935;
}
/* ===== SEARCH SUGGEST ===== */
.search-suggest {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  display: none;
  max-height: 420px;
  overflow-y: auto;
  z-index: 999;
}

.suggest-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  align-items: center;
}

.suggest-item:hover {
  background: #f5f5f5;
}

.suggest-item img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.suggest-info {
  flex: 1;
}

.suggest-name {
  font-size: 14px;
  color: #333;
}

.suggest-price {
  font-size: 13px;
  color: #e53935;
  font-weight: bold;
}

/* highlight keyword */
.highlight {
  background: #e7e1ad;
  padding: 0 2px;
  border-radius: 3px;
}

/* ===== THUMBNAIL ===== */
.thumbs{
  display:flex;
  gap:10px;
  margin-top:12px;
  justify-content:center;
}
.thumb{
  width:60px;
  height:60px;
  border:2px solid transparent;
  border-radius:6px;
  cursor:pointer;
}
.thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
}
.thumb.active{
  border-color:red;
}
