/**
 * 侧边栏开关按钮固定定位修复
 * 确保按钮在页面滚动时始终可见
 */

/* 基础固定定位 - 确保按钮始终可见 */
.menu-toggle {
  position: fixed !important;
  top: 8px !important;
  left: 20px !important;
  z-index: 9999 !important; /* 提高z-index确保在最顶层 */
  background: transparent !important;
  border: none !important;
  font-size: 1.5rem !important;
  color: #333 !important;
  cursor: pointer !important;
  padding: 8px !important;
  border-radius: 6px !important;
  transition: all 0.3s ease !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  width: 44px !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.menu-toggle:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  transform: scale(1.05) !important;
  box-shadow: none !important;
}

.menu-toggle:active {
  transform: scale(0.95) !important;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .menu-toggle {
    top: 12px !important;
    left: 12px !important;
    width: 40px !important;
    height: 40px !important;
    font-size: 1.3rem !important;
    z-index: 9999 !important;
    background: transparent !important;
    backdrop-filter: none !important;
  }
}

@media (max-width: 480px) {
  .menu-toggle {
    top: 10px !important;
    left: 10px !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 1.2rem !important;
  }
}

@media (max-width: 360px) {
  .menu-toggle {
    top: 8px !important;
    left: 8px !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 1.1rem !important;
  }
}

/* 确保按钮在所有状态下都可见 */
.menu-toggle {
  pointer-events: auto !important;
  user-select: none !important;
}

/* 防止按钮被其他元素遮挡 */
.menu-toggle::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  z-index: -1;
}

/* 对比度和可访问性优化 */
@media (prefers-contrast: high) {
  .menu-toggle {
    background: #fa8c32 !important;
    border: 2px solid #000 !important;
    color: #000 !important;
  }
}

/* 减少动画的用户偏好支持 */
@media (prefers-reduced-motion: reduce) {
  .menu-toggle {
    transition: none !important;
  }

  .menu-toggle:hover {
    transform: none !important;
  }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .menu-toggle {
    background: transparent !important;
    color: #fff !important;
    box-shadow: none !important;
  }
}

/* 焦点状态优化 */
.menu-toggle:focus {
  outline: 3px solid rgba(250, 140, 50, 0.5) !important;
  outline-offset: 2px !important;
}

/* 确保在打印时隐藏 */
@media print {
  .menu-toggle {
    display: none !important;
  }
}