/* ========================================
   Mega Menu Dropdown (Desktop)
   ======================================== */

/* Ensure parent containers allow overflow */
.category-nav, .category-list {
  overflow: visible !important;
}

/* 关键：让下拉菜单相对于整个导航列表定位，而不是单个菜单项 */
.category-list {
  position: relative !important;
}

.category-list li {
  position: static !important; /* 覆盖 main.css 或之前的 relative */
}

.category-dropdown {
  position: absolute;
  top: 40px; /* 导航栏高度 */
  left: 0;
  width: 100%; /* 全宽 */
  background-color: #fafafa; /* 浅灰色背景，突出白色卡片 */
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999; /* Ensure high z-index */
  opacity: 0;
  visibility: hidden;
  display: block; /* 确保 display 不是 none */
  border-top: 1px solid #eee;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none; /* Prevent clicks when hidden */
}

.category-list li:hover .category-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto; /* Enable clicks on hover */
}

/* 滚动容器 */
.dropdown-scroll-container {
  max-height: 450px;
  overflow-y: auto;
  padding: 20px 30px;
  /* 自定义滚动条 */
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5;
}

.dropdown-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.dropdown-scroll-container::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.dropdown-scroll-container::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

/* 内部布局：左侧分类 + 右侧品牌 */
.dropdown-inner {
  display: flex;
  gap: 40px;
}

/* 左侧分类区域 */
.dropdown-categories {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-content: flex-start;
  align-items: flex-start; /* 关键：防止子元素被拉伸高度 */
}

.category-column {
  width: calc(33.33% - 20px); /* 3列布局 */
  min-width: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* 确保内容靠上对齐 */
  height: auto; /* 防止被拉伸 */
}

.category-group-title {
  color: var(--primary-orange) !important;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px; /* 减小间距 */
  display: block;
  text-decoration: none;
  border-bottom: none !important;
  padding: 0 !important;
  line-height: 1.4;
}

.category-group-title:hover {
  color: var(--primary-orange-dark) !important;
  background: none !important;
}

.category-sub-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-sub-list li {
  margin-bottom: 6px; /* 减小间距 */
  display: block;
  line-height: 1.4;
}

.category-sub-list a {
  color: #333 !important;
  font-size: 13px; /* 稍微调小字体 */
  text-decoration: none;
  transition: color 0.2s;
  padding: 0 !important;
  display: inline-block !important;
  border: none !important;
  background: none !important;
}

.category-sub-list a:hover {
  color: var(--primary-orange) !important;
  background: none !important;
  padding-left: 0 !important; /* 取消位移，保持整洁 */
  text-decoration: underline;
}

/* 右侧品牌区域 */
.dropdown-brands {
  width: 420px; /* 稍微加宽以容纳4列 */
  flex-shrink: 0;
  border-left: 1px solid #eee;
  padding-left: 30px;
}

.brands-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4列 Logo */
  gap: 10px;
}

.brand-item {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eee;
  border-radius: 8px;
  height: 70px; /* 稍微调小高度 */
  padding: 5px;
  transition: all 0.2s;
  background-color: #fff;
  overflow: hidden;
}

.brand-item:hover {
  border-color: var(--primary-orange);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transform: translateY(-2px);
}

.brand-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
