.brandbox-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  direction: rtl;
  margin-top: 20px;
}

#brandbox-category-tree {
  width: 240px;
  min-width: 200px;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px;
  background: #f9f9f9;
}

.brandbox-category-header {
  cursor: pointer;
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 6px;
  background: #f1f1f1;
  font-weight: 500;
  transition: all 0.2s ease;
}

.brandbox-category-header:hover {
  background: #eaeaea;
}

.brandbox-category-sublist {
  padding-right: 15px;
  margin-top: -6px;
  margin-bottom: 6px;
}

.brandbox-category-subitem {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 6px;
  background: #f7f7f7;
  margin: 4px 0;
  transition: background 0.2s ease;
}

.brandbox-category-subitem:hover {
  background: #e0e0e0;
}

.brandbox-category-header.active,
.brandbox-category-subitem.active {
  background: #0422a5;
  color: #ffffff;
  font-weight: bold;
}

#brandbox-product-list {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.brandbox-product-card {
  display: block;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brandbox-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.brandbox-product-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-bottom: 1px solid #eee;
}

.brandbox-product-card h4 {
  font-size: 15px;
  padding: 12px;
  color: #333;
  text-align: center;
  min-height: 48px;
}

/* Responsive: دو ستون در تبلت */
@media (max-width: 768px) {
  #brandbox-product-list {
    grid-template-columns: repeat(2, 1fr);
  }

  #brandbox-category-tree {
    width: 100%;
    margin-bottom: 20px;
  }

  .brandbox-layout {
    flex-direction: column;
  }
}

/* Responsive: یک ستون در موبایل */
@media (max-width: 480px) {
  #brandbox-product-list {
    grid-template-columns: 1fr;
  }
}
