/* Category Menu Dropdown Style - Inspired by the attached image 
 * This implements a megamenu-style category navigation with blue background
 */
 
/* APPLE PRODUCTS specific style - orange text like in the image */
.left-category-sidebar li a[data-category-name*="APPLE"],
.left-category-sidebar li a[data-category-name*="Apple"] {
  color: #ff6600 !important;
  font-weight: bold !important;
}

/* Create specific category icons to match the attached image */
.left-category-sidebar .main-category[data-category-name*="battery"]::before,
.left-category-sidebar .main-category[data-category-name*="แบตเตอรี่"]::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  background-color: #e6e6e6;
  border-radius: 50%;
}

.left-category-sidebar .main-category[data-category-name*="Camera"]::before,
.left-category-sidebar .main-category[data-category-name*="กล้อง"]::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  background-color: #e6e6e6;
  border-radius: 50%;
}

/* Style DIY computer and notebook with special arrow indicators */
.left-category-sidebar .main-category[data-category-name*="DIY"]::after,
.left-category-sidebar .main-category[data-category-name*="Notebook"]::after,
.left-category-sidebar .main-category[data-category-name*="คอมพิวเตอร์"]::after,
.left-category-sidebar .main-category[data-category-name*="โน้ตบุ๊ค"]::after {
  content: '›';
  margin-left: auto;
  font-size: 24px;
  font-weight: bold;
  color: #0066cc;
}

/* Reset the previous styles for the category sidebar */
.left-category-sidebar {
  background-color: #eef5ff !important; /* Light blue background like in image */
  border-radius: 8px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
  overflow: visible !important; /* Allow submenu to extend outside */
  position: relative !important;
  border: 1px solid #d0e1ff !important;
  transition: all 0.3s ease !important;
  max-height: 350px !important; /* Fixed maximum height to match advertisement area */
}

/* Main header styling */
.left-category-sidebar .sidebar-header {
  background: linear-gradient(to right, #2e4585, #364f9b) !important; /* Gradient blue header like in the image */
  color: white !important;
  padding: 14px 15px !important;
  font-weight: bold !important;
  border-radius: 8px 8px 0 0 !important;
  position: relative !important;
  border-bottom: none !important;
  font-size: 16px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Category list style */
.left-category-sidebar .sidebar-body {
  max-height: 280px !important; /* Match the height constraint from enhancement CSS */
  overflow-y: auto !important; /* Enable vertical scrolling */
  padding: 0 !important;
  margin: 0 !important;
  position: relative !important;
}

/* Style for all list items */
.left-category-sidebar ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.left-category-sidebar li {
  border-bottom: 1px solid #eee !important;
  position: relative !important;
}

/* Style for main category links */
.left-category-sidebar .main-category {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 15px !important;
  color: #333 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  border-left: 3px solid transparent !important; /* For hover effect */
  font-size: 14px !important;
}

.left-category-sidebar .main-category:hover,
.left-category-sidebar .main-category.active {
  background-color: #eaf0ff !important;
  color: #3050b3 !important; /* Blue color similar to the image */
  border-left: 3px solid #3050b3 !important;
  padding-left: 12px !important; /* Adjust for the border */
}

/* Style for the arrow indicator */
.left-category-sidebar .main-category .arrow {
  font-size: 18px !important;
  transition: transform 0.3s ease !important;
  color: #777 !important;
}

.left-category-sidebar .main-category.active .arrow {
  transform: rotate(90deg) !important;
  color: #3050b3 !important;
}

/* Submenu dropdown styling */
.category-submenu {
  position: absolute !important;
  left: 100% !important;
  top: 0 !important;
  width: 320px !important; /* Wider submenu like in image */
  background: white !important;
  border: 1px solid #c0d1ee !important;
  border-radius: 8px !important; /* More rounded corners */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important; /* Deeper shadow for more depth */
  display: none !important;
  z-index: 1000 !important;
  overflow: hidden !important; /* Keep content within rounded corners */
  opacity: 0 !important;
  transform: translateX(10px) !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.category-submenu.active {
  display: block !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
}

/* Submenu header styling - matching the header in the image */
.submenu-header {
  background: linear-gradient(to right, #2e4585, #364f9b) !important; /* Same gradient as main header */
  color: white !important;
  padding: 14px 15px !important;
  border-bottom: 1px solid #2e4585 !important;
  font-weight: bold !important;
  border-radius: 8px 8px 0 0 !important;
  font-size: 14px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Submenu items styling - more like the image */
.submenu-items {
  max-height: 500px !important;
  overflow-y: auto !important;
  padding: 8px 0 !important;
  background-color: #f8faff !important; /* Light blue background */
}

.submenu-item {
  padding: 10px 15px !important;
  display: flex !important;
  align-items: center !important;
  color: #333 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  border-bottom: 1px solid #eef3ff !important;
  font-size: 14px !important;
}

/* Special styling for "view all" option */
.submenu-item.view-all {
  font-weight: bold !important;
  background-color: #f0f5ff !important;
}

.submenu-item:hover {
  background-color: #e0ebff !important;
  color: #3050b3 !important;
  border-left: 3px solid #3050b3 !important;
  padding-left: 12px !important; /* Adjust for the border */
}

/* Add arrow icons to submenu items like in the image */
.submenu-item::before {
  content: '›';
  margin-right: 8px;
  font-size: 18px;
  color: #90a4d4;
}

/* Close button for submenu */
.submenu-close {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  cursor: pointer !important;
  color: #777 !important;
  font-size: 16px !important;
}

.submenu-close:hover {
  color: #333 !important;
}

/* Styling for submenu items with children */
.submenu-item.has-children::after {
  content: '›';
  margin-left: 8px;
  font-size: 18px;
  color: #90a4d4;
  font-weight: bold;
}

/* Mobile optimization */
@media (max-width: 768px) {
  .category-submenu {
    left: 0 !important;
    top: 100% !important;
    width: 100% !important;
  }
}

/* Special styling for the APPLE PRODUCTS section, similar to the image */
.left-category-sidebar li.apple-products .main-category {
  color: #ff6600 !important; /* Orange like in the image */
  font-weight: bold !important;
}

.left-category-sidebar li.apple-products {
  background-color: #fafafa !important;
}

/* Add scrollbar to submenu for longer lists */
.submenu-items::-webkit-scrollbar {
  width: 8px !important;
}

.submenu-items::-webkit-scrollbar-track {
  background: #f1f1f1 !important;
}

.submenu-items::-webkit-scrollbar-thumb {
  background: #0066cc !important;
  border-radius: 10px !important;
}

.submenu-items::-webkit-scrollbar-thumb:hover {
  background: #0055aa !important;
}

/* Add scrollbar to sidebar body */
.left-category-sidebar .sidebar-body::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

.left-category-sidebar .sidebar-body::-webkit-scrollbar-track {
  background: #f1f1f1 !important;
  border-radius: 10px !important;
}

.left-category-sidebar .sidebar-body::-webkit-scrollbar-thumb {
  background: #0066cc !important;
  border-radius: 10px !important;
}

.left-category-sidebar .sidebar-body::-webkit-scrollbar-thumb:hover {
  background: #0055aa !important;
}

/* New megamenu overlay container */
.megamenu-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 999 !important;
  display: none !important;
}

.megamenu-overlay.active {
  display: block !important;
}
