/* ========================================
   SIDEBAR — ПЛОСКОЕ МЕНЮ (БЕЗ СЕКЦИЙ)
   ======================================== */

.sidebar {
  position: fixed;
  top: 20px;
  left: 20px;
  bottom: 20px;
  width: 260px;
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  border-radius: 16px;
}

.sidebar.collapsed {
  width: 72px;
}

/* === ШАПКА САЙДБАРА === */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f1c40f, #f39c12);
  flex-shrink: 0;
  height: 56px;
  box-sizing: border-box;
  border-radius: 16px 16px 0 0;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  padding: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.5);
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #1a1a1a;
  border-radius: 2px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  width: 0;
  display: none;
}

/* === МЕНЮ (С ГРУППИРОВКОЙ, БЕЗ ПОДЧЁРКИВАНИЙ) === */
.sidebar-menu {
  list-style: none;
  padding: 8px;
  margin: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: auto;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* Пункты верхнего уровня */
.sidebar-menu > li {
  margin-bottom: 2px;
}

/* Ссылки меню */
.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #2c3e50;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  border-radius: 10px;
  border: 1px solid transparent;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.sidebar-menu a:hover {
  background: #fef9e7;
  color: #2c3e50;
  border-color: #f9e79f;
}

.sidebar-menu a:active {
  background: #f9e79f;
}

.sidebar-menu a i {
  font-size: 18px;
  min-width: 22px;
  max-width: 22px;
  text-align: center;
  font-style: normal;
  flex-shrink: 0;
}

.menu-text {
  transition: opacity 0.2s;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .menu-text {
  display: none;
}

/* === РАЗДЕЛИТЕЛЬ === */
.sidebar-divider {
  height: 1px;
  background: #e8e8e8;
  margin: 8px 12px;
}

/* === ВЫХОД === */
.sidebar-menu a.logout {
  color: #e74c3c;
  margin-top: 4px;
}

.sidebar-menu a.logout:hover {
  background: #ffeaea;
  color: #c0392b;
  border-color: #f5c6cb;
}

/* === TOOLTIP (свёрнутое меню) === */
.sidebar.collapsed .sidebar-menu > li > a {
  justify-content: center;
  padding: 10px;
}

.sidebar.collapsed .sidebar-menu a:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #2c3e50;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* === МОБИЛЬНОЕ МЕНЮ === */
@media (max-width: 768px) {
  .sidebar {
    top: 0;
    left: -280px;
    bottom: 0;
    width: 260px;
    border-radius: 0;
    transition: left 0.3s ease;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .sidebar.collapsed {
    width: 260px;
  }
}
