/* 侧边栏样式 - Sidebar Styles */

/* 平滑过渡 */
* {
  --transition-duration: 0.3s;
  --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

.sider {
  background: #1e293b;
  color: white;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  contain: layout style paint;
  opacity: 1;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Vue挂载前的占位样式 */
.sider:empty::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
}

/* 平滑过渡，但不闪烁 */
.sider > * {
  animation: none;
}

.sider h2 {
  color: white;
  font-size: 20px;
  font-weight: 600;
  padding: 10px 20px;
  margin: 0;
  flex-shrink: 0;
}

.menu-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  scrollbar-gutter: stable;
}

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

.menu > li {
  margin-bottom: 4px;
}

.menu > li > div {
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #cbd5e1;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
}

.menu > li > div:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.menu > li > ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu > li > ul > li {
  padding: 0;
}

.menu > li > ul > li > a {
  display: block;
  padding: 10px 20px 10px 40px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.menu > li > ul > li > a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  border-left-color: #3b82f6;
}

.menu > li > ul > li > a.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-left-color: #3b82f6;
  font-weight: 500;
}

/* 用户面板样式 */
.user-panel {
  position: relative;
  padding: 16px 20px;
  flex-shrink: 0;
  background: #1e293b;
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.user-info:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
  transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-details {
  flex: 1;
  min-width: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-name {
  color: white;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-id {
  color: #94a3b8;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-caret {
  color: #94a3b8;
  font-size: 12px;
  transition: transform 0.2s ease, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.user-panel.open .user-caret {
  transform: rotate(180deg);
}

/* 用户菜单 */
.user-menu {
  display: none;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-panel.open .user-menu {
  display: block;
}

.user-menu-item {
  padding: 12px 16px;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-menu-item:last-child {
  border-bottom: none;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.user-menu-item.logout {
  color: #fca5a5;
}

.user-menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* 滚动条样式 */
.sider::-webkit-scrollbar,
.menu-wrapper::-webkit-scrollbar {
  width: 6px;
}

.sider::-webkit-scrollbar-track,
.menu-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.sider::-webkit-scrollbar-thumb,
.menu-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sider::-webkit-scrollbar-thumb:hover,
.menu-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 展开/收起图标 */
.menu > li > div span:last-child {
  float: right;
  transition: transform 0.2s ease;
}

/* 响应式 */
@media (max-width: 768px) {
  .sider {
    width: 200px;
  }
  
  .sider h2 {
    font-size: 18px;
  }
  
  .menu > li > div {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .menu > li > ul > li > a {
    padding: 8px 16px 8px 32px;
    font-size: 12px;
  }
  
  .sider.sidebar-collapsed {
    width: 50px !important;
  }
}

/* 侧边栏折叠样式 - 仅应用于.sider元素 */
.sider.sidebar-collapsed {
  width: 60px !important;
}

.sider.sidebar-collapsed h2 {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sider.sidebar-collapsed .menu-wrapper {
  padding: 10px 0;
}

.sider.sidebar-collapsed .menu > li > div {
  padding: 12px 8px;
  justify-content: center;
}

.sider.sidebar-collapsed .menu > li > div span:first-child {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sider.sidebar-collapsed .menu > li > div span:last-child {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sider.sidebar-collapsed .menu > li > ul {
  display: none !important;
}

.sider.sidebar-collapsed .user-details {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sider.sidebar-collapsed .user-avatar {
  margin-right: 0;
}

.sider.sidebar-collapsed .user-info {
  justify-content: center;
  min-height: auto;
  padding: 12px 8px;
}

.sider.sidebar-collapsed .user-caret {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* 菜单展开/收起动画 */
.menu-expand-enter-active,
.menu-expand-leave-active {
  transition: all 0.3s ease;
  overflow: hidden;
}

.menu-expand-enter-from {
  opacity: 0;
  max-height: 0;
  transform: translateY(-10px);
}

.menu-expand-leave-to {
  opacity: 0;
  max-height: 0;
  transform: translateY(-10px);
}

.menu-expand-enter-to,
.menu-expand-leave-from {
  opacity: 1;
  max-height: 500px;
  transform: translateY(0);
}

/* 按钮悬停效果 */
button[title*="侧边栏"]:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

/* 菜单项悬停效果 */
.menu > li > div:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

/* 折叠状态下的菜单项 */
.sider.sidebar-collapsed .menu > li > div:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 侧边栏折叠按钮 - 使用 Element Plus 风格 */
.sidebar-toggle-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  transform: scale(1.05);
}

.sidebar-toggle-btn:active {
  transform: scale(0.95);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 菜单组标题 */
.menu-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px 20px;
  transition: all 0.2s ease;
  color: #cbd5e1;
  font-weight: 500;
  font-size: 14px;
  border-radius: 4px;
  margin: 0 8px;
}

.menu-group-title:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.menu-group-label {
  transition: opacity 0.3s ease;
  flex: 1;
}

.menu-caret {
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* 用户菜单图标 */
.user-menu-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}


