/* Sidenav и Menu оптимизация */
.sidenav {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  overflow-x: hidden;
  transition: width 0.3s ease; /* Уменьшено время анимации для большей отзывчивости */
}

#mySidenav.open {
  width: clamp(250px, 100%, 350px); /* Гибкая ширина для разных экранов */
  box-shadow: 10px 0 20px rgba(0, 0, 0, 0.1);
}

#menu-icon {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  transition: transform 0.2s ease; /* Ускоренная анимация */
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

#menu-icon.active {
  background: rgb(255, 255, 255) url("/uploads/icons/menu-icon-green.svg") center/45px no-repeat;
  opacity: 1;
  backdrop-filter: blur(10px);
}

#menu-icon.x {
  background: rgb(255, 255, 255) url("/uploads/icons/close-icon.svg") center/45px no-repeat;
}

#menu-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.vertical-menu {
  width: 100%;
  max-width: 350px;
  height: 100%;
  background: #fff;
  overflow-y: auto;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-item {
  padding: 0 20px 0 15px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s ease; /* Ускоренная анимация */
}

.menu-item:hover {
  background: #f0f8ff;
}

.menu-category {
  display: flex;
  align-items: center;
  gap: 20px;
}

.category-image {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ccc;
  position: relative; /* Добавлено для корректного позиционирования .category-count */
}

.circle-image,
.placeholder {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ccc;
}

.circle-image {
  object-fit: cover;
}

.category-name {
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
  flex-grow: 1;
}

.toggle-icon {
  font-size: 18px;
  font-weight: bold;
  color: #28a745;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.toggle-icon.rotated {
  transform: rotate(45deg);
}

.submenu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 40px 80px; /* Объединено padding */
}

.submenu-item {
  padding: 5px 0;
}

.submenu-item:hover {
  background: #e8f0f7;
}

.submenu-link {
  color: #007bff;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.submenu-link:hover {
  color: #0056b3;
}

.submenu-link.active {
  font-weight: bold;
  color: #555;
  text-decoration: underline;
}

/* Счетчик товаров в категориях */
.category-count {
  position: absolute;
  top: 0px;
  right: -10px;
  background-color: #ffffff;
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Медиа-запросы объединены и упрощены */
@media (max-width: 768px) {
  body.menu-open {
      overflow: hidden;
  }
  .submenu-link {
      display: block;
      padding: 5px 0;
  }
}

@media (max-height: 450px) {
  .sidenav {
      padding-top: 15px;
  }
}